vendor: 17,565 bytes, lines 1-5
1import{r as Js,j as Fo,H as Oo}from"./index-3Uo7xo90.js";/** 2 * @license 3 * Copyright 2010-2024 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Fs="171",Bo=0,Qs=1,zo=2,$a=1,Ho=2,Kt=3,pn=0,Mt=1,$t=2,hn=0,ti=1,ea=2,ta=3,na=4,Vo=5,Rn=100,Go=101,ko=102,Wo=103,Xo=104,qo=200,Yo=201,Zo=202,Ko=203,Zr=204,Kr=205,$o=206,jo=207,Jo=208,Qo=209,el=210,tl=211,nl=212,il=213,rl=214,$r=0,jr=1,Jr=2,ri=3,Qr=4,es=5,ts=6,ns=7,ja=0,sl=1,al=2,fn=0,ol=1,ll=2,cl=3,ul=4,hl=5,fl=6,dl=7,Ja=300,si=301,ai=302,is=303,rs=304,hr=306,ss=1e3,Cn=1001,as=1002,Bt=1003,pl=1004,Pi=1005,Gt=1006,_r=1007,Pn=1008,tn=1009,Qa=1010,eo=1011,Ei=1012,Os=1013,Ln=1014,jt=1015,yi=1016,Bs=1017,zs=1018,oi=1020,to=35902,no=1021,io=1022,Ot=1023,ro=1024,so=1025,ni=1026,li=1027,ao=1028,Hs=1029,oo=1030,Vs=1031,Gs=1033,tr=33776,nr=33777,ir=33778,rr=33779,os=35840,ls=35841,cs=35842,us=35843,hs=36196,fs=37492,ds=37496,ps=37808,ms=37809,_s=37810,gs=37811,vs=37812,xs=37813,Ms=37814,Ss=37815,Es=37816,ys=37817,Ts=37818,As=37819,bs=37820,Rs=37821,sr=36492,ws=36494,Cs=36495,lo=36283,Ps=36284,Ds=36285,Ls=36286,ml=3200,_l=3201,gl=0,vl=1,un="",At="srgb",ci="srgb-linear",or="linear",Ze="srgb",Nn=7680,ia=519,xl=512,Ml=513,Sl=514,co=515,El=516,yl=517,Tl=518,Al=519,Us=35044,ra="300 es",Jt=2e3,lr=2001;class hi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const dt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],gr=Math.PI/180,Is=180/Math.PI;function dn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(dt[i&255]+dt[i>>8&255]+dt[i>>16&255]+dt[i>>24&255]+"-"+dt[e&255]+dt[e>>8&255]+"-"+dt[e>>16&15|64]+dt[e>>24&255]+"-"+dt[t&63|128]+dt[t>>8&255]+"-"+dt[t>>16&255]+dt[t>>24&255]+dt[n&255]+dt[n>>8&255]+dt[n>>16&255]+dt[n>>24&255]).toLowerCase()}function Ie(i,e,t){return Math.max(e,Math.min(t,i))}function bl(i,e){return(i%e+e)%e}function vr(i,e,t){return(1-t)*i+t*e}function Vt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Ke(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Be{constructor(e=0,t=0){Be.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ie(this.x,e.x,t.x),this.y=Ie(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ie(this.x,e,t),this.y=Ie(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ie(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ie(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ce{constructor(e,t,n,r,s,a,o,l,c){Ce.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,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,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],f=n[2],m=n[5],v=n[8],M=r[0],p=r[3],u=r[6],A=r[1],T=r[4],E=r[7],U=r[2],R=r[5],w=r[8];return s[0]=a*M+o*A+l*U,s[3]=a*p+o*T+l*R,s[6]=a*u+o*E+l*w,s[1]=c*M+h*A+d*U,s[4]=c*p+h*T+d*R,s[7]=c*u+h*E+d*w,s[2]=f*M+m*A+v*U,s[5]=f*p+m*T+v*R,s[8]=f*u+m*E+v*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,f=o*l-h*s,m=c*s-a*l,v=t*d+n*f+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/v;return e[0]=d*M,e[1]=(r*c-h*n)*M,e[2]=(o*n-r*a)*M,e[3]=f*M,e[4]=(h*t-r*l)*M,e[5]=(r*s-o*t)*M,e[6]=m*M,e[7]=(n*l-c*t)*M,e[8]=(a*t-n*s)*M,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(xr.makeScale(e,t)),this}rotate(e){return this.premultiply(xr.makeRotation(-e)),this}translate(e,t){return this.premultiply(xr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const xr=new Ce;function uo(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function cr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Rl(){const i=cr("canvas");return i.style.display="block",i}const sa={};function Qn(i){i in sa||(sa[i]=!0,console.warn(i))}function wl(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Cl(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Pl(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const aa=new Ce().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),oa=new Ce().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Dl(){const i={enabled:!0,workingColorSpace:ci,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ze&&(r.r=en(r.r),r.g=en(r.g),r.b=en(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ze&&(r.r=ii(r.r),r.g=ii(r.g),r.b=ii(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===un?or:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[ci]:{primaries:e,whitePoint:n,transfer:or,toXYZ:aa,fromXYZ:oa,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:At},outputColorSpaceConfig:{drawingBufferColorSpace:At}},[At]:{primaries:e,whitePoint:n,transfer:Ze,toXYZ:aa,fromXYZ:oa,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:At}}}),i}const ke=Dl();function en(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ii(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Fn;class Ll{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Fn===void 0&&(Fn=cr("canvas")),Fn.width=e.width,Fn.height=e.height;const n=Fn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Fn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=en(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(en(t[n]/255)*255):t[n]=en(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Ul=0;class ho{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ul++}),this.uuid=dn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Mr(r[a].image)):s.push(Mr(r[a]))}else s=Mr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Mr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ll.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Il=0;class vt extends hi{constructor(e=vt.DEFAULT_IMAGE,t=vt.DEFAULT_MAPPING,n=Cn,r=Cn,s=Gt,a=Pn,o=Ot,l=tn,c=vt.DEFAULT_ANISOTROPY,h=un){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Il++}),this.uuid=dn(),this.name="",this.source=new ho(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Be(0,0),this.repeat=new Be(1,1),this.center=new Be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ce,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace
vendor: 5,538 bytes, line 5
5=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ja)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ss:e.x=e.x-Math.floor(e.x);break;case Cn:e.x=e.x<0?0:1;break;case as:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ss:e.y=e.y-Math.floor(e.y);break;case Cn:e.y=e.y<0?0:1;break;case as:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}vt.DEFAULT_IMAGE=null;vt.DEFAULT_MAPPING=Ja;vt.DEFAULT_ANISOTROPY=1;class rt{constructor(e=0,t=0,n=0,r=1){rt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],d=l[8],f=l[1],m=l[5],v=l[9],M=l[2],p=l[6],u=l[10];if(Math.abs(h-f)<.01&&Math.abs(d-M)<.01&&Math.abs(v-p)<.01){if(Math.abs(h+f)<.1&&Math.abs(d+M)<.1&&Math.abs(v+p)<.1&&Math.abs(c+m+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,E=(m+1)/2,U=(u+1)/2,R=(h+f)/4,w=(d+M)/4,I=(v+p)/4;return T>E&&T>U?T<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(T),r=R/n,s=w/n):E>U?E<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),n=R/r,s=I/r):U<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(U),n=w/s,r=I/s),this.set(n,r,s,t),this}let A=Math.sqrt((p-v)*(p-v)+(d-M)*(d-M)+(f-h)*(f-h));return Math.abs(A)<.001&&(A=1),this.x=(p-v)/A,this.y=(d-M)/A,this.z=(f-h)/A,this.w=Math.acos((c+m+u-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ie(this.x,e.x,t.x),this.y=Ie(this.y,e.y,t.y),this.z=Ie(this.z,e.z,t.z),this.w=Ie(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ie(this.x,e,t),this.y=Ie(this.y,e,t),this.z=Ie(this.z,e,t),this.w=Ie(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ie(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}
vendor: 9,138 bytes, line 5
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Nl extends hi{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new rt(0,0,e,t),this.scissorTest=!1,this.viewport=new rt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new vt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new ho(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Un extends Nl{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class fo extends vt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Bt,this.minFilter=Bt,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Fl extends vt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Bt,this.minFilter=Bt,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ti{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],d=n[r+3];const f=s[a+0],m=s[a+1],v=s[a+2],M=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=f,e[t+1]=m,e[t+2]=v,e[t+3]=M;return}if(d!==M||l!==f||c!==m||h!==v){let p=1-o;const u=l*f+c*m+h*v+d*M,A=u>=0?1:-1,T=1-u*u;if(T>Number.EPSILON){const U=Math.sqrt(T),R=Math.atan2(U,u*A);p=Math.sin(p*R)/U,o=Math.sin(o*R)/U}const E=o*A;if(l=l*p+f*E,c=c*p+m*E,h=h*p+v*E,d=d*p+M*E,p===1-o){const U=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=U,c*=U,h*=U,d*=U}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],f=s[a+1],m=s[a+2],v=s[a+3];return e[t]=o*v+h*d+l*m-c*f,e[t+1]=l*v+h*f+c*d-o*m,e[t+2]=c*v+h*m+o*f-l*d,e[t+3]=h*v-o*d-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),d=o(s/2),f=l(n/2),m=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=f*h*d+c*m*v,this._y=c*m*d-f*h*v,this._z=c*h*v+f*m*d,this._w=c*h*d-f*m*v;break;case"YXZ":this._x=f*h*d+c*m*v,this._y=c*m*d-f*h*v,this._z=c*h*v-f*m*d,this._w=c*h*d+f*m*v;break;case"ZXY":this._x=f*h*d-c*m*v,this._y=c*m*d+f*h*v,this._z=c*h*v+f*m*d,this._w=c*h*d-f*m*v;break;case"ZYX":this._x=f*h*d-c*m*v,this._y=c*m*d+f*h*v,this._z=c*h*v-f*m*d,this._w=c*h*d+f*m*v;break;case"YZX":this._x=f*h*d+c*m*v,this._y=c*m*d+f*h*v,this._z=c*h*v-f*m*d,this._w=c*h*d-f*m*v;break;case"XZY":this._x=f*h*d-c*m*v,this._y=c*m*d-f*h*v,this._z=c*h*v+f*m*d,this._w=c*h*d+f*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],f=n+o+d;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>d){const m=2*Math.sqrt(1+n-o-d);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>d){const m=2*Math.sqrt(1+o-n-d);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ie(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-t)*h)/c,f=Math.sin(t*h
vendor: 10,062 bytes, line 5
5)/c;return this._w=a*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(la.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(la.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ie(this.x,e.x,t.x),this.y=Ie(this.y,e.y,t.y),this.z=Ie(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ie(this.x,e,t),this.y=Ie(this.y,e,t),this.z=Ie(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ie(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Sr.copy(this).projectOnVector(e),this.sub(Sr)}reflect(e){return this.sub(Sr.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(Ie(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Sr=new F,la=new Ti;class Ai{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(It.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(It.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=It.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,It):It.fromBufferAttribute(s,a),It.applyMatrix4(e.matrixWorld),this.expandByPoint(It);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Di.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Di.copy(n.boundingBox)),Di.applyMatrix4(e.matrixWorld),this.union(Di)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,It),It.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 19,834 bytes, line 5
5s}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pi),Li.subVectors(this.max,pi),On.subVectors(e.a,pi),Bn.subVectors(e.b,pi),zn.subVectors(e.c,pi),rn.subVectors(Bn,On),sn.subVectors(zn,Bn),xn.subVectors(On,zn);let t=[0,-rn.z,rn.y,0,-sn.z,sn.y,0,-xn.z,xn.y,rn.z,0,-rn.x,sn.z,0,-sn.x,xn.z,0,-xn.x,-rn.y,rn.x,0,-sn.y,sn.x,0,-xn.y,xn.x,0];return!Er(t,On,Bn,zn,Li)||(t=[1,0,0,0,1,0,0,0,1],!Er(t,On,Bn,zn,Li))?!1:(Ui.crossVectors(rn,sn),t=[Ui.x,Ui.y,Ui.z],Er(t,On,Bn,zn,Li))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,It).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(It).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:(Wt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Wt=[new F,new F,new F,new F,new F,new F,new F,new F],It=new F,Di=new Ai,On=new F,Bn=new F,zn=new F,rn=new F,sn=new F,xn=new F,pi=new F,Li=new F,Ui=new F,Mn=new F;function Er(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Mn.fromArray(i,s);const o=r.x*Math.abs(Mn.x)+r.y*Math.abs(Mn.y)+r.z*Math.abs(Mn.z),l=e.dot(Mn),c=t.dot(Mn),h=n.dot(Mn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Ol=new Ai,mi=new F,yr=new F;class ks{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Ol.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mi.subVectors(e,this.center);const t=mi.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(mi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(yr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mi.copy(e.center).add(yr)),this.expandByPoint(mi.copy(e.center).sub(yr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Xt=new F,Tr=new F,Ii=new F,an=new F,Ar=new F,Ni=new F,br=new F;class Bl{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Xt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xt.copy(this.origin).addScaledVector(this.direction,t),Xt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Tr.copy(e).add(t).multiplyScalar(.5),Ii.copy(t).sub(e).normalize(),an.copy(this.origin).sub(Tr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ii),o=an.dot(this.direction),l=-an.dot(Ii),c=an.lengthSq(),h=Math.abs(1-a*a);let d,f,m,v;if(h>0)if(d=a*l-o,f=a*o-l,v=s*h,d>=0)if(f>=-v)if(f<=v){const M=1/h;d*=M,f*=M,m=d*(d+a*f+2*o)+f*(a*d+f+2*l)+c}else f=s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;else f<=-v?(d=Math.max(0,-(-a*s+o)),f=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c):f<=v?(d=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(d=Math.max(0,-(a*s+o)),f=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+f*(f+2*l)+c);else f=a>0?-s:s,d=Math.max(0,-(a*f+o)),m=-d*d+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Tr).addScaledVector(Ii,f),m}intersectSphere(e,t){Xt.subVectors(e.center,this.origin);const n=Xt.dot(this.direction),r=Xt.dot(Xt)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),h>=0?(s=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(o=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Xt)!==null}intersectTriangle(e,t,n,r,s){Ar.subVectors(t,e),Ni.subVectors(n,e),br.crossVectors(Ar,Ni);let a=this.direction.dot(br),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;an.subVectors(this.origin,e);const l=o*this.direction.dot(Ni.crossVectors(an,Ni));if(l<0)return null;const c=o*this.direction.dot(Ar.cross(an));if(c<0||l+c>a)return null;const h=-o*an.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 st{constructor(e,t,n,r,s,a,o,l,c,h,d,f,m,v,M,p){st.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,d,f,m,v,M,p)}set(e,t,n,r,s,a,o,l,c,h,d,f,m,v,M,p){const u=this.elements;return u[0]=e,u[4]=t,u[8]=n,u[12]=r,u[1]=s,u[5]=a,u[9]=o,u[13]=l,u[2]=c,u[6]=h,u[10]=d,u[14]=f,u[3]=m,u[7]=v,u[11]=M,u[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new st().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/Hn.setFromMatrixColumn(e,0).length(),s=1/Hn.setFromMatrixColumn(e,1).length(),a=1/Hn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=a*h,m=a*d,v=o*h,M=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=f-M*c,t[9]=-o*l,t[2]=M-f*c,t[6]=v+m*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,m=l*d,v=c*h,M=c*d;t[0]=f+M*o,t[4]=v*o-m,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=m*o-v,t[6]=M+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,m=l*d,v=c*h,M=c*d;t[0]=f-M*o,t[4]=-a*d,t[8]=v+m*o,t[1]=m+v*o,t[5]=a*h,t[9]=M-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,m=a*d,v=o*h,M=o*d;t[0]=l*h,t[4]=v*c-m,t[8]=f*c+M,t[1]=l*d,t[5]=M*c+f,t[9]=m*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,m=a*c,v=o*l,M=o*c;t[0]=l*h,t[4]=M-f*d,t[8]=v*d+m,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=m*d+v,t[10]=f-M*d}else if(e.order==="XZY"){const f=a*l,m=a*c,v=o*l,M=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=f*d+M,t[5]=a*h,t[9]=m*d-v,t[2]=v*d-m,t[6]=o*h,t[10]=M*d+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zl,e,Hl)}lookAt(e,t,n){const r=this.elements;return yt.subVectors(e,t),yt.lengthSq()===0&&(yt.z=1),yt.normalize(),on.crossVectors(n,yt),on.lengthSq()===0&&(Math.abs(n.z)===1?yt.x+=1e-4:yt.z+=1e-4,yt.normalize(),on.crossVectors(n,yt)),on.normalize(),Fi.crossVectors(yt,on),r[0]=on.x,r[4]=Fi.x,r[8]=yt.x,r[1]=on.y,r[5]=Fi.y,r[9]=yt.y,r[2]=on.z,r[6]=Fi.z,r[10]=yt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],f=n[9],m=n[13],v=n[2],M=n[6],p=n[10],u=n[14],A=n[3],T=n[7],E=n[11],U=n[15],R=r[0],w=r[4],I=r[8],S=r[12],x=r[1],C=r[5],q=r[9],z=r[13],W=r[2],$=r[6],G=r[10],Q=r[14],V=r[3],re=r[7],ue=r[11],ge=r[15];return s[0]=a*R+o*x+l*W+c*V,s[4]=a*w+o*C+l*$+c*re,s[8]=a*I+o*q+l*G+c*ue,s[12]=a*S+o*z+l*Q+c*ge,s[1]=h*R+d*x+f*W+m*V,s[5]=h*w+d*C+f*$+m*re,s[9]=h*I+d*q+f*G+m*ue,s[13]=h*S+d*z+f*Q+m*ge,s[2]=v*R+M*x+p*W+u*V,s[6]=v*w+M*C+p*$+u*re,s[10]=v*I+M*q+p*G+u*ue,s[14]=v*S+M*z+p*Q+u*ge,s[3]=A*R+T*x+E*W+U*V,s[7]=A*w+T*C+E*$+U*re,s[11]=A*I+T*q+E*G+U*ue,s[15]=A*S+T*z+E*Q+U*ge,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],f=e[10],m=e[14],v=e[3],M=e[7],p=e[11],u=e[15];return v*(+s*l*d-r*c*d-s*o*f+n*c*f+r*o*m-n*l*m)+M*(+t*l*m-t*c*f+s*a*f-r*a*m+r*c*h-s*l*h)+p*(+t*c*d-t*o*m-s*a*d+n*a*m+s*o*h-n*c*h)+u*(-r*o*h-t*l*d+t*o*f+r*a*d-n*a*f+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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],f=e[10],m=e[11],v=e[12],M=e[13],p=e[14],u=e[15],A=d*p*c-M*f*c+M*l*m-o*p*m-d*l*u+o*f*u,T=v*f*c-h*p*c-v*l*m+a*p*m+h*l*u-a*f*u,E=h*M*c-v*d*c+v*o*m-a*M*m-h*o*u+a*d*u,U=v*d*l-h*M*l-v*o*f+a*M*f+h*o*p-a*d*p,R=t*A+n*T+r*E+s*U;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/R;return e[0]=A*w,e[1]=(M*f*s-d*p*s-M*r*m+n*p*m+d*r*u-n*f*u)*w,e[2]=(o*p*s-M*l*s+M*r*c-n*p*c-o*r*u+n*l*u)*w,e[3]=(d*l*s-o*f*s-d*r*c+n*f*c+o*r*m-n*l*m)*w,e[4]=T*w,e[5]=(h*p*s-v*f*s+v*r*m-t*p*m-h*r*u+t*f*u)*w,e[6]=(v*l*s-a*p*s-v*r*c+t*p*c+a*r*u-t*l*u)*w,e[7]=(a*f*s-h*l*s+h*r*c-t*f*c-a*r*m+t*l*m)*w,e[8]=E*w,e[9]=(v*d*s-h*M*s-v*n*m+t*M*m+h*n*u-t*d*u)*w,e[10]=(a*M*s-v*o*s+v*n*c-t*M*c-a*n*u+t*o*u)*w,e[11]=(h*o*s-a*d*s-h*n*c+t*d*c+a*n*m-t*o*m)*w,e[12]=U*w,e[13]=(h*M*r-v*d*r+v*n*f-t*M*f-h*n*p+t*d*p)*w,e[14]=(v*o*r-a*M*r-v*n*l+t*M*l+a*n*p-t*o*p)*w,e[15]=(a*d*r-h*o*r+h*n*l-t*d*l-a*n*f+t*o*f)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,f=s*c,m=s*h,v=s*d,M=a*h,p=a*d,u=o*d,A=l*c,T=l*h,E=l*d,U=n.x,R=n.y,w=n.z;return r[0]=(1-(M+u))*U,r[1]=(m+E)*U,r[2]=(v-T)*U,r[3]=0,r[4]=(m-E)*R,r[5]=(1-(f+u))*R,r[6]=(p+A)*R,r[7]=0,r[8]=(v+T)*w,r[9]=(p-A)*w,r[10]=(1-(f+M))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=Hn.set(r[0],r[1],r[2]).length();const a=Hn.set(r[4],r[5],r[6]).length(),o=Hn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Nt.copy(this);const c=1/s,h=1/a,d=1/o;return Nt.elements[0]*=c,Nt.elements[1]*=c,Nt.elements[2]*=c,Nt.elements[4]*=h,Nt.elements[5]*=h,Nt.elements[6]*=h,Nt.elements[8]*=d,Nt.elements[9]*=d,Nt.elements[10]*=d,t.setFromRotationMatrix(Nt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Jt){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r);let m,v;if(o===Jt)m=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===lr)m=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Jt){const l=this.elements,c=1/(t-e),h=1/(n-r),d=1/(a-s),f=(t+e)*c,m=(n+r)*h;let v,M;if(o===Jt)v=(a+s)*d,M=-2*d;else if(o===lr)v=s*d,M=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=M,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Hn=new F,Nt=new st,zl=new F(0,0,0),Hl=new F(1,1,1),on=new F,Fi=new F,yt=new F,ca=new st,ua=new Ti;class nn{constructor(e=0,t=0,n=0,r=nn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Ie(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ie(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ie(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ie(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ie(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-Ie(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ca.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ca,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ua.setFromEuler(this),this.setFromQuaternion(ua,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}nn.DEFAULT_ORDER="XYZ";class po{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}
vendor: 5,575 bytes, line 5
5isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Vl=0;const ha=new F,Vn=new Ti,qt=new st,Oi=new F,_i=new F,Gl=new F,kl=new Ti,fa=new F(1,0,0),da=new F(0,1,0),pa=new F(0,0,1),ma={type:"added"},Wl={type:"removed"},Gn={type:"childadded",child:null},Rr={type:"childremoved",child:null};class St extends hi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Vl++}),this.uuid=dn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new F,t=new nn,n=new Ti,r=new F(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new st},normalMatrix:{value:new Ce}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new po,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Vn.setFromAxisAngle(e,t),this.quaternion.multiply(Vn),this}rotateOnWorldAxis(e,t){return Vn.setFromAxisAngle(e,t),this.quaternion.premultiply(Vn),this}rotateX(e){return this.rotateOnAxis(fa,e)}rotateY(e){return this.rotateOnAxis(da,e)}rotateZ(e){return this.rotateOnAxis(pa,e)}translateOnAxis(e,t){return ha.copy(e).applyQuaternion(this.quaternion),this.position.add(ha.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fa,e)}translateY(e){return this.translateOnAxis(da,e)}translateZ(e){return this.translateOnAxis(pa,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(qt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Oi.copy(e):Oi.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),_i.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?qt.lookAt(_i,Oi,this.up):qt.lookAt(Oi,_i,this.up),this.quaternion.setFromRotationMatrix(qt),r&&(qt.extractRotation(r.matrixWorld),Vn.setFromRotationMatrix(qt),this.quaternion.premultiply(Vn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ma),Gn.child=e,this.dispatchEvent(Gn),Gn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Wl),Rr.child=e,this.dispatchEvent(Rr),Rr.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),qt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),qt.multiply(e.parent.matrixWorld)),e.applyMatrix4(qt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ma),Gn.child=e,this.dispatchEvent(Gn),Gn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_i,e,Gl),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_i,kl,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,564 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),f=a(e.skeletons),m=a(e.animations),v=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),f.length>0&&(n.skeletons=f),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=r,n;function a(o){const l=[];for(const c in o){const 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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}St.DEFAULT_UP=new F(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ft=new F,Yt=new F,wr=new F,Zt=new F,kn=new F,Wn=new F,_a=new F,Cr=new F,Pr=new F,Dr=new F,Lr=new rt,Ur=new rt,Ir=new rt;class Dt{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ft.subVectors(e,t),r.cross(Ft);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}
vendor: 9,023 bytes, line 5
5static getBarycoord(e,t,n,r,s){Ft.subVectors(r,t),Yt.subVectors(n,t),wr.subVectors(e,t);const a=Ft.dot(Ft),o=Ft.dot(Yt),l=Ft.dot(wr),c=Yt.dot(Yt),h=Yt.dot(wr),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const f=1/d,m=(c*l-o*h)*f,v=(a*h-o*l)*f;return s.set(1-m-v,v,m)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Zt)===null?!1:Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Zt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Zt.x),l.addScaledVector(a,Zt.y),l.addScaledVector(o,Zt.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return Lr.setScalar(0),Ur.setScalar(0),Ir.setScalar(0),Lr.fromBufferAttribute(e,t),Ur.fromBufferAttribute(e,n),Ir.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Lr,s.x),a.addScaledVector(Ur,s.y),a.addScaledVector(Ir,s.z),a}static isFrontFacing(e,t,n,r){return Ft.subVectors(n,t),Yt.subVectors(e,t),Ft.cross(Yt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ft.subVectors(this.c,this.b),Yt.subVectors(this.a,this.b),Ft.cross(Yt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Dt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Dt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Dt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Dt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Dt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;kn.subVectors(r,n),Wn.subVectors(s,n),Cr.subVectors(e,n);const l=kn.dot(Cr),c=Wn.dot(Cr);if(l<=0&&c<=0)return t.copy(n);Pr.subVectors(e,r);const h=kn.dot(Pr),d=Wn.dot(Pr);if(h>=0&&d<=h)return t.copy(r);const f=l*d-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(kn,a);Dr.subVectors(e,s);const m=kn.dot(Dr),v=Wn.dot(Dr);if(v>=0&&m<=v)return t.copy(s);const M=m*c-l*v;if(M<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(n).addScaledVector(Wn,o);const p=h*v-m*d;if(p<=0&&d-h>=0&&m-v>=0)return _a.subVectors(s,r),o=(d-h)/(d-h+(m-v)),t.copy(r).addScaledVector(_a,o);const u=1/(p+M+f);return a=M*u,o=f*u,t.copy(n).addScaledVector(kn,a).addScaledVector(Wn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const mo={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},ln={h:0,s:0,l:0},Bi={h:0,s:0,l:0};function Nr(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ye{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ke.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,ke.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ke.workingColorSpace){if(e=bl(e,1),t=Ie(t,0,1),n=Ie(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Nr(a,s,e+1/3),this.g=Nr(a,s,e),this.b=Nr(a,s,e-1/3)}return ke.toWorkingColorSpace(this,r),this}setStyle(e,t=At){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=At){const n=mo[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=en(e.r),this.g=en(e.g),this.b=en(e.b),this}copyLinearToSRGB(e){return this.r=ii(e.r),this.g=ii(e.g),this.b=ii(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return ke.fromWorkingColorSpace(pt.copy(this),e),Math.round(Ie(pt.r*255,0,255))*65536+Math.round(Ie(pt.g*255,0,255))*256+Math.round(Ie(pt.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ke.workingColorSpace){ke.fromWorkingColorSpace(pt.copy(this),t);const n=pt.r,r=pt.g,s=pt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=ke.workingColorSpace){return ke.fromWorkingColorSpace(pt.copy(this),t),e.r=pt.r,e.g=pt.g,e.b
vendor: 3,447 bytes, line 5
5=pt.b,e}getStyle(e=At){ke.fromWorkingColorSpace(pt.copy(this),e);const t=pt.r,n=pt.g,r=pt.b;return e!==At?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(ln),this.setHSL(ln.h+e,ln.s+t,ln.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}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(ln),e.getHSL(Bi);const n=vr(ln.h,Bi.h,t),r=vr(ln.s,Bi.s,t),s=vr(ln.l,Bi.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const pt=new Ye;Ye.NAMES=mo;let Xl=0;class bi extends hi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Xl++}),this.uuid=dn(),this.name="",this.type="Material",this.blending=ti,this.side=pn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Zr,this.blendDst=Kr,this.blendEquation=Rn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=ri,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ia,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Nn,this.stencilZFail=Nn,this.stencilZPass=Nn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 8,832 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ti&&(n.blending=this.blending),this.side!==pn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Zr&&(n.blendSrc=this.blendSrc),this.blendDst!==Kr&&(n.blendDst=this.blendDst),this.blendEquation!==Rn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ri&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ia&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Nn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Nn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Nn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,710 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class _o extends bi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nn,this.combine=ja,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ot=new F,zi=new Be;class zt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Us,this.updateRanges=[],this.gpuType=jt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)zi.fromBufferAttribute(this,t),zi.applyMatrix3(e),this.setXY(t,zi.x,zi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyMatrix3(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyMatrix4(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.applyNormalMatrix(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ot.fromBufferAttribute(this,t),ot.transformDirection(e),this.setXYZ(t,ot.x,ot.y,ot.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Vt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ke(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Vt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Vt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Vt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Vt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),r=Ke(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}
vendor: 7,361 bytes, line 5
5setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),r=Ke(r,this.array),s=Ke(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Us&&(e.usage=this.usage),e}}class go extends zt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vo extends zt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Dn extends zt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ql=0;const Ct=new st,Fr=new St,Xn=new F,Tt=new Ai,gi=new Ai,ut=new F;class _n extends hi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ql++}),this.uuid=dn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(uo(e)?vo:go)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ce().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ct.makeRotationFromQuaternion(e),this.applyMatrix4(Ct),this}rotateX(e){return Ct.makeRotationX(e),this.applyMatrix4(Ct),this}rotateY(e){return Ct.makeRotationY(e),this.applyMatrix4(Ct),this}rotateZ(e){return Ct.makeRotationZ(e),this.applyMatrix4(Ct),this}translate(e,t,n){return Ct.makeTranslation(e,t,n),this.applyMatrix4(Ct),this}scale(e,t,n){return Ct.makeScale(e,t,n),this.applyMatrix4(Ct),this}lookAt(e){return Fr.lookAt(e),Fr.updateMatrix(),this.applyMatrix4(Fr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xn).negate(),this.translate(Xn.x,Xn.y,Xn.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Dn(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Tt.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Tt.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Tt.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Tt.min),this.boundingBox.expandByPoint(Tt.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 ks);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const n=this.boundingSphere.center;if(Tt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];gi.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Tt.min,gi.min),Tt.expandByPoint(ut),ut.addVectors(Tt.max,gi.max),Tt.expandByPoint(ut)):(Tt.expandByPoint(gi.min),Tt.expandByPoint(gi.max))}Tt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ut.fromBufferAttribute(o,c),l&&(Xn.fromBufferAttribute(e,c),ut.add(Xn)),r=Math.max(r,n.distanceToSquared(ut))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new zt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let I=0;I<n.count;I++)o[I]=new F,l[I]=new F;const c=new F,h=new F,d=new F,f=new Be,m=new Be,v=new Be,M=new F,p=new F;function u(I,S,x){c.fromBufferAttribute(n,I),h.fromBufferAttribute(n,S),d.fromBufferAttribute(n,x),f.fromBufferAttribute(s,I),m.fromBufferAttribute(s,S),v.fromBufferAttribute(s,x),h.sub(c),d.sub(c),m.sub(f),v.sub(f);const C=1/(m.x*v.y-v.x*m.y);isFinite(C)&&(M.copy(h).multiplyScalar(v.y).addScaledVector(d,-m.y).multiplyScalar(C),p.copy(d).multiplyScalar(m.x).addScaledVector(h,-v.x).multiplyScalar(C),o[I].add(M),o[S].add(M),o[x].add(M),l[I].add(p),l[S].add(p),l[x].add(p))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let I=0,S=A.length;I<S;++I){const x=A[I],C=x.start,q=x.count;for(let z=C,W=C+q;z<W;z+=3)u(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const T=new F,E=new F,U=new F,R=new F;function w(I){U.fromBufferAttribute(r,I),R.copy(U);const S=o[I];T.copy(S),T.sub(U.multiplyScalar(U.dot(S))).normalize(),E.crossVectors(R,S);const C=E.dot(l[I])<0?-1:1;a.setXYZW(I,T.x,T.y,T.z,C)}for(let I=0,S=A.length;I<S;++I){const x=A[I],C=x.start,q=x.count;for(let z=C,W=C+q;z<W;z+=3)w(e.getX(z+0)),w(e.getX(z+1)),w(e.getX(z+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 zt(new Float32Array(t.count*3),3),this.setAttribute("normal",n
vendor: 6,291 bytes, line 5
5);else for(let f=0,m=n.count;f<m;f++)n.setXYZ(f,0,0,0);const r=new F,s=new F,a=new F,o=new F,l=new F,c=new F,h=new F,d=new F;if(e)for(let f=0,m=e.count;f<m;f+=3){const v=e.getX(f+0),M=e.getX(f+1),p=e.getX(f+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,M),a.fromBufferAttribute(t,p),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,v),l.fromBufferAttribute(n,M),c.fromBufferAttribute(n,p),o.add(h),l.add(h),c.add(h),n.setXYZ(v,o.x,o.y,o.z),n.setXYZ(M,l.x,l.y,l.z),n.setXYZ(p,c.x,c.y,c.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,d=o.normalized,f=new c.constructor(l.length*h);let m=0,v=0;for(let M=0,p=l.length;M<p;M++){o.isInterleavedBufferAttribute?m=l[M]*o.data.stride+o.offset:m=l[M]*h;for(let u=0;u<h;u++)f[v++]=c[m++]}return new zt(f,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new _n,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){const f=c[h],m=e(f,n);l.push(m)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,f=c.length;d<f;d++){const m=c[d];h.push(m.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],d=s[c];for(let f=0,m=d.length;f<m;f++)h.push(d[f].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 d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ga=new st,Sn=new Bl,Hi=new ks,va=new F,Vi=new F,Gi=new F,ki=new F,Or=new F,Wi=new F,xa=new F,Xi=new F;class Qt extends St{constructor(e=new _n,t=new _o){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Wi.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(Or.fromBufferAttribute(d,e),a?Wi.addScaledVector(Or,h):Wi.addScaledVector(Or.sub(t),h))}t.add(Wi)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Hi.copy(n.boundingSphere),Hi.applyMatrix4(s),Sn.copy(e.ray).recast(e.near),!(Hi.containsPoint(Sn.origin)===!1&&(Sn.intersectSphere(Hi,va)===null||Sn.origin.distanceToSquared(va)>(e.far-e.near)**2))&&(ga.copy(s).invert(),Sn.copy(e.ray).applyMatrix4(ga),!(n.boundingBox!==null&&Sn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Sn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,f=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,M=f.length;v<M;v++){const p=f[v],u=a[p.materialIndex],A=Math.max(p.start,m.start),T=Math.min(o.count,Math.min(p.start+p.count,m.start+m.count));for(let E=A,U=T;E<U;E+=3){const R=o.getX(E),w=o.getX(E+1),I=o.getX(E+2);r=qi(this,u,e,n,c,h,d,R,w,I),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),M=Math.min(o.count,m.start+m.count);for(let p=v,u=M;p<u;p+=3){const A=o.getX(p),T=o.getX(p+1),E=o.getX(p+2);r=qi(this,a,e,n,c,h,d,A,T,E),r&&(r.faceIndex=Math.floor(p/3),t.pu
vendor: 7,029 bytes, lines 5-9
5sh(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,M=f.length;v<M;v++){const p=f[v],u=a[p.materialIndex],A=Math.max(p.start,m.start),T=Math.min(l.count,Math.min(p.start+p.count,m.start+m.count));for(let E=A,U=T;E<U;E+=3){const R=E,w=E+1,I=E+2;r=qi(this,u,e,n,c,h,d,R,w,I),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{const v=Math.max(0,m.start),M=Math.min(l.count,m.start+m.count);for(let p=v,u=M;p<u;p+=3){const A=p,T=p+1,E=p+2;r=qi(this,a,e,n,c,h,d,A,T,E),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}}}function Yl(i,e,t,n,r,s,a,o){let l;if(e.side===Mt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===pn,o),l===null)return null;Xi.copy(o),Xi.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Xi);return c<t.near||c>t.far?null:{distance:c,point:Xi.clone(),object:i}}function qi(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Vi),i.getVertexPosition(l,Gi),i.getVertexPosition(c,ki);const h=Yl(i,e,t,n,Vi,Gi,ki,xa);if(h){const d=new F;Dt.getBarycoord(xa,Vi,Gi,ki,d),r&&(h.uv=Dt.getInterpolatedAttribute(r,o,l,c,d,new Be)),s&&(h.uv1=Dt.getInterpolatedAttribute(s,o,l,c,d,new Be)),a&&(h.normal=Dt.getInterpolatedAttribute(a,o,l,c,d,new F),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new F,materialIndex:0};Dt.getNormal(Vi,Gi,ki,f.normal),h.face=f,h.barycoord=d}return h}class Ri extends _n{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],d=[];let f=0,m=0;v("z","y","x",-1,-1,n,t,e,a,s,0),v("z","y","x",1,-1,n,t,-e,a,s,1),v("x","z","y",1,1,e,n,t,r,a,2),v("x","z","y",1,-1,e,n,-t,r,a,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Dn(c,3)),this.setAttribute("normal",new Dn(h,3)),this.setAttribute("uv",new Dn(d,2));function v(M,p,u,A,T,E,U,R,w,I,S){const x=E/w,C=U/I,q=E/2,z=U/2,W=R/2,$=w+1,G=I+1;let Q=0,V=0;const re=new F;for(let ue=0;ue<G;ue++){const ge=ue*C-z;for(let Le=0;Le<$;Le++){const $e=Le*x-q;re[M]=$e*A,re[p]=ge*T,re[u]=W,c.push(re.x,re.y,re.z),re[M]=0,re[p]=0,re[u]=R>0?1:-1,h.push(re.x,re.y,re.z),d.push(Le/w),d.push(1-ue/I),Q+=1}}for(let ue=0;ue<I;ue++)for(let ge=0;ge<w;ge++){const Le=f+ge+$*ue,$e=f+ge+$*(ue+1),X=f+(ge+1)+$*(ue+1),ee=f+(ge+1)+$*ue;l.push(Le,$e,ee),l.push($e,X,ee),V+=6}o.addGroup(m,V,S),m+=V,f+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ri(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ui(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function gt(i){const e={};for(let t=0;t<i.length;t++){const n=ui(i[t]);for(const r in n)e[r]=n[r]}return e}function Zl(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function xo(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ke.workingColorSpace}const Kl={clone:ui,merge:gt};var $l=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,jl=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class mn extends bi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$l,this.fragmentShader=jl,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ui(e.uniforms),this.uniformsGroups=Zl(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Mo extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new st,this.projectionMatrix=new st,this.projectionMatrixInverse=new st,this.coordinateSystem=Jt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const cn=new F,Ma=new Be,Sa=new Be;class Pt extends Mo{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Is*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(gr*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,387 bytes, line 9
9getEffectiveFOV(){return Is*2*Math.atan(Math.tan(gr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){cn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(cn.x,cn.y).multiplyScalar(-e/cn.z),cn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(cn.x,cn.y).multiplyScalar(-e/cn.z)}getViewSize(e,t){return this.getViewBounds(e,Ma,Sa),t.subVectors(Sa,Ma)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(gr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const qn=-90,Yn=1;class Jl extends St{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Pt(qn,Yn,e,t);r.layers=this.layers,this.add(r);const s=new Pt(qn,Yn,e,t);s.layers=this.layers,this.add(s);const a=new Pt(qn,Yn,e,t);a.layers=this.layers,this.add(a);const o=new Pt(qn,Yn,e,t);o.layers=this.layers,this.add(o);const l=new Pt(qn,Yn,e,t);l.layers=this.layers,this.add(l);const c=new Pt(qn,Yn,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Jt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,d=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(d,f,m),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}}class So extends vt{constructor(e,t,n,r,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:si,super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ql extends Un{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new So(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Gt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 4,382 bytes, lines 9-44
9=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},r=new Ri(5,5,5),s=new mn({name:"CubemapFromEquirect",uniforms:ui(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Mt,blending:hn});s.uniforms.tEquirect.value=t;const a=new Qt(r,s),o=t.minFilter;return t.minFilter===Pn&&(t.minFilter=Gt),new Jl(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class ec extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new nn,this.environmentIntensity=1,this.environmentRotation=new nn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class tc{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Us,this.updateRanges=[],this.version=0,this.uuid=dn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.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 r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=dn()),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 this.constructor(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=dn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const _t=new F;class ur{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}
vendor: 12,356 bytes, line 44
44get 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++)_t.fromBufferAttribute(this,t),_t.applyMatrix4(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.applyNormalMatrix(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.transformDirection(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Vt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ke(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Vt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Vt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Vt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Vt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),r=Ke(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),r=Ke(r,this.array),s=Ke(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new zt(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 ur(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+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}}}class Eo extends bi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Zn;const vi=new F,Kn=new F,$n=new F,jn=new Be,xi=new Be,yo=new st,Yi=new F,Mi=new F,Zi=new F,Ea=new Be,Br=new Be,ya=new Be;class nc extends St{constructor(e=new Eo){if(super(),this.isSprite=!0,this.type="Sprite",Zn===void 0){Zn=new _n;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 tc(t,5);Zn.setIndex([0,1,2,0,2,3]),Zn.setAttribute("position",new ur(n,3,0,!1)),Zn.setAttribute("uv",new ur(n,2,3,!1))}this.geometry=Zn,this.material=e,this.center=new Be(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Kn.setFromMatrixScale(this.matrixWorld),yo.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),$n.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Kn.multiplyScalar(-$n.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;Ki(Yi.set(-.5,-.5,0),$n,a,Kn,r,s),Ki(Mi.set(.5,-.5,0),$n,a,Kn,r,s),Ki(Zi.set(.5,.5,0),$n,a,Kn,r,s),Ea.set(0,0),Br.set(1,0),ya.set(1,1);let o=e.ray.intersectTriangle(Yi,Mi,Zi,!1,vi);if(o===null&&(Ki(Mi.set(-.5,.5,0),$n,a,Kn,r,s),Br.set(0,1),o=e.ray.intersectTriangle(Yi,Zi,Mi,!1,vi),o===null))return;const l=e.ray.origin.distanceTo(vi);l<e.near||l>e.far||t.push({distance:l,point:vi.clone(),uv:Dt.getInterpolation(vi,Yi,Mi,Zi,Ea,Br,ya,new Be),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ki(i,e,t,n,r,s){jn.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(xi.x=s*jn.x-r*jn.y,xi.y=r*jn.x+s*jn.y):xi.copy(jn),i.copy(e),i.x+=xi.x,i.y+=xi.y,i.applyMatrix4(yo)}const zr=new F,ic=new F,rc=new Ce;class An{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=zr.subVectors(n,t).cross(ic.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(zr),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||rc.getNormalMatrix(e),r=this.coplanarPoint(zr).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const En=new ks,$i=new F;class To{constructor(e=new An,t=new An,n=new An,r=new An,s=new An,a=new An){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Jt){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],d=r[6],f=r[7],m=r[8],v=r[9],M=r[10],p=r[11],u=r[12],A=r[13],T=r[14],E=r[15];if(n[0].setComponents(l-s,f-c,p-m,E-u).normalize(),n[1].setComponents(l+s,f+c,p+m,E+u).normalize(),n[2].setComponents(l+a,f+h,p+v,E+A).normalize(),n[3].setComponents(l-a,f-h,p-v,E-A).normalize(),n[4].setComponents(l-o,f-d,p-M,E-T).normalize(),t===Jt)n[5].setComponents(l+o,f+d,p+M,E+T).normalize();else if(t===lr)n[5].setComponents(o,d,M,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),En.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),En.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(En)}intersectsSprite(e){return En.center.set(0,0,0),En.radius=.7071067811865476,En.applyMatrix4(e.matrixWorld),this.intersectsSphere(En)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if($i.x=r.normal.x>0?e.max.x:e.min.x,$i.y=r.normal.y>0?e.max.y:e.min.y,$i.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint($i)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ji extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}class sc extends vt{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ao extends vt{constructor(e,t,n,r,s,a,o,l,c,h=ni){if(h!==ni&&h!==li)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===ni&&(n=Ln),n===void 0&&h===li&&(n=oi),super(null,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Bt,this.minFilter=l!==void 0?l:Bt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class fr extends _n{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,d=e/o,f=t/l,m=[],v=[],M=[],p=[];for(let u=0;u<h;u++){const A=u*f-a;for(let T=0;T<c;T++){const E=T*d-s;v.push(E,-A,0),M.push(0,0,1),p.push(T/o),p.push(1-u/l)}}for(let u=0;u<l;u++)for(let A=0;A<o;A++){const T=A+c*u,E=A+c*(u+1),U=A+1+c*(u+1),R=A+1+c*u;m.push(T,E,R),m.push(E,U,R)}this.setIndex(m),this.setAttribute("position",new Dn(v,3)),this.setAttribute("normal",new Dn(M,3)),this.setAttribute("uv",new Dn(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fr(e.width,e.height,e.widthSegments,e.heightSegments)}}class ac extends bi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ml,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class oc extends bi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class lc extends Mo{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
vendor: 8,650 bytes, lines 44-107
44phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,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.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class cc extends Pt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}function Ta(i,e,t,n){const r=uc(n);switch(t){case no:return i*e;case ro:return i*e;case so:return i*e*2;case ao:return i*e/r.components*r.byteLength;case Hs:return i*e/r.components*r.byteLength;case oo:return i*e*2/r.components*r.byteLength;case Vs:return i*e*2/r.components*r.byteLength;case io:return i*e*3/r.components*r.byteLength;case Ot:return i*e*4/r.components*r.byteLength;case Gs:return i*e*4/r.components*r.byteLength;case tr:case nr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ir:case rr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ls:case us:return Math.max(i,16)*Math.max(e,8)/4;case os:case cs:return Math.max(i,8)*Math.max(e,8)/2;case hs:case fs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ds:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ps:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ms:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case _s:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case gs:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case vs:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case xs:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Ms:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Ss:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Es:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case ys:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Ts:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case As:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bs:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Rs:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case sr:case ws:case Cs:return Math.ceil(i/4)*Math.ceil(e/4)*16;case lo:case Ps:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ds:case Ls:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function uc(i){switch(i){case tn:case Qa:return{byteLength:1,components:1};case Ei:case eo:case yi:return{byteLength:2,components:1};case Bs:case zs:return{byteLength:2,components:4};case Ln:case Os:case jt:return{byteLength:4,components:1};case to:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Fs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Fs);/** 45 * @license 46 * Copyright 2010-2024 Three.js Authors 47 * SPDX-License-Identifier: MIT 48 */function bo(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function hc(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,f=i.createBuffer();i.bindBuffer(l,f),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l.updateRanges;if(i.bindBuffer(c,o),d.length===0)i.bufferSubData(c,0,h);else{d.sort((m,v)=>m.start-v.start);let f=0;for(let m=1;m<d.length;m++){const v=d[f],M=d[m];M.start<=v.start+v.count+1?v.count=Math.max(v.count,M.start+M.count-v.start):(++f,d[f]=M)}d.length=f+1;for(let m=0,v=d.length;m<v;m++){const M=d[m];i.bufferSubData(c,M.start*h.BYTES_PER_ELEMENT,h,M.start,M.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var fc=`#ifdef USE_ALPHAHASH 49 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 50#endif`,dc=`#ifdef USE_ALPHAHASH 51 const float ALPHA_HASH_SCALE = 0.05; 52 float hash2D( vec2 value ) { 53 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 54 } 55 float hash3D( vec3 value ) { 56 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 57 } 58 float getAlphaHashThreshold( vec3 position ) { 59 float maxDeriv = max( 60 length( dFdx( position.xyz ) ), 61 length( dFdy( position.xyz ) ) 62 ); 63 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 64 vec2 pixScales = vec2( 65 exp2( floor( log2( pixScale ) ) ), 66 exp2( ceil( log2( pixScale ) ) ) 67 ); 68 vec2 alpha = vec2( 69 hash3D( floor( pixScales.x * position.xyz ) ), 70 hash3D( floor( pixScales.y * position.xyz ) ) 71 ); 72 float lerpFactor = fract( log2( pixScale ) ); 73 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 74 float a = min( lerpFactor, 1.0 - lerpFactor ); 75 vec3 cases = vec3( 76 x * x / ( 2.0 * a * ( 1.0 - a ) ), 77 ( x - 0.5 * a ) / ( 1.0 - a ), 78 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 79 ); 80 float threshold = ( x < ( 1.0 - a ) ) 81 ? ( ( x < a ) ? cases.x : cases.y ) 82 : cases.z; 83 return clamp( threshold , 1.0e-6, 1.0 ); 84 } 85#endif`,pc=`#ifdef USE_ALPHAMAP 86 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 87#endif`,mc=`#ifdef USE_ALPHAMAP 88 uniform sampler2D alphaMap; 89#endif`,_c=`#ifdef USE_ALPHATEST 90 #ifdef ALPHA_TO_COVERAGE 91 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 92 if ( diffuseColor.a == 0.0 ) discard; 93 #else 94 if ( diffuseColor.a < alphaTest ) discard; 95 #endif 96#endif`,gc=`#ifdef USE_ALPHATEST 97 uniform float alphaTest; 98#endif`,vc=`#ifdef USE_AOMAP 99 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 100 reflectedLight.indirectDiffuse *= ambientOcclusion; 101 #if defined( USE_CLEARCOAT ) 102 clearcoatSpecularIndirect *= ambientOcclusion; 103 #endif 104 #if defined( USE_SHEEN ) 105 sheenSpecularIndirect *= ambientOcclusion; 106 #endif 107 #if defined( USE_ENVMAP ) && defined( STANDARD )
108 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 109 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 110 #endif 111#endif`,xc=`#ifdef USE_AOMAP 112 uniform sampler2D aoMap; 113 uniform float aoMapIntensity; 114#endif`,Mc=`#ifdef USE_BATCHING 115 #if ! defined( GL_ANGLE_multi_draw ) 116 #define gl_DrawID _gl_DrawID 117 uniform int _gl_DrawID; 118 #endif 119 uniform highp sampler2D batchingTexture; 120 uniform highp usampler2D batchingIdTexture; 121 mat4 getBatchingMatrix( const in float i ) { 122 int size = textureSize( batchingTexture, 0 ).x; 123 int j = int( i ) * 4; 124 int x = j % size; 125 int y = j / size; 126 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 127 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 128 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 129 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 130 return mat4( v1, v2, v3, v4 ); 131 } 132 float getIndirectIndex( const in int i ) { 133 int size = textureSize( batchingIdTexture, 0 ).x; 134 int x = i % size; 135 int y = i / size; 136 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 137 } 138#endif 139#ifdef USE_BATCHING_COLOR 140 uniform sampler2D batchingColorTexture; 141 vec3 getBatchingColor( const in float i ) { 142 int size = textureSize( batchingColorTexture, 0 ).x; 143 int j = int( i ); 144 int x = j % size; 145 int y = j / size; 146 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 147 } 148#endif`,Sc=`#ifdef USE_BATCHING 149 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 150#endif`,Ec=`vec3 transformed = vec3( position ); 151#ifdef USE_ALPHAHASH 152 vPosition = vec3( position ); 153#endif`,yc=`vec3 objectNormal = vec3( normal ); 154#ifdef USE_TANGENT 155 vec3 objectTangent = vec3( tangent.xyz ); 156#endif`,Tc=`float G_BlinnPhong_Implicit( ) { 157 return 0.25; 158} 159float D_BlinnPhong( const in float shininess, const in float dotNH ) { 160 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 161} 162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 163 vec3 halfDir = normalize( lightDir + viewDir ); 164 float dotNH = saturate( dot( normal, halfDir ) ); 165 float dotVH = saturate( dot( viewDir, halfDir ) ); 166 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 167 float G = G_BlinnPhong_Implicit( ); 168 float D = D_BlinnPhong( shininess, dotNH ); 169 return F * ( G * D ); 170} // validated`,Ac=`#ifdef USE_IRIDESCENCE 171 const mat3 XYZ_TO_REC709 = mat3( 172 3.2404542, -0.9692660, 0.0556434, 173 -1.5371385, 1.8760108, -0.2040259, 174 -0.4985314, 0.0415560, 1.0572252 175 ); 176 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 177 vec3 sqrtF0 = sqrt( fresnel0 ); 178 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 179 } 180 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 181 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 182 } 183 float IorToFresnel0( float transmittedIor, float incidentIor ) { 184 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 185 } 186 vec3 evalSensitivity( float OPD, vec3 shift ) { 187 float phase = 2.0 * PI * OPD * 1.0e-9; 188 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 189 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 190 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 191 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 192 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 193 xyz /= 1.0685e-7; 194 vec3 rgb = XYZ_TO_REC709 * xyz; 195 return rgb; 196 } 197 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 198 vec3 I; 199 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 200 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 201 float cosTheta2Sq = 1.0 - sinTheta2Sq; 202 if ( cosTheta2Sq < 0.0 ) { 203 return vec3( 1.0 ); 204 } 205 float cosTheta2 = sqrt( cosTheta2Sq ); 206 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 208 float T121 = 1.0 - R12; 209 float phi12 = 0.0; 210 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 211 float phi21 = PI - phi12; 212 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 213 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 214 vec3 phi23 = vec3( 0.0 ); 215 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 216 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 217 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 218 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 219 vec3 phi = vec3( phi21 ) + phi23; 220 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 221 vec3 r123 = sqrt( R123 ); 222 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 223 vec3 C0 = R12 + Rs; 224 I = C0; 225 vec3 Cm = Rs - T121; 226 for ( int m = 1; m <= 2; ++ m ) { 227 Cm *= r123; 228 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 229 I += Cm * Sm; 230 } 231 return max( I, vec3( 0.0 ) ); 232 } 233#endif`,bc=`#ifdef USE_BUMPMAP 234 uniform sampler2D bumpMap; 235 uniform float bumpScale; 236 vec2 dHdxy_fwd() { 237 vec2 dSTdx = dFdx( vBumpMapUv ); 238 vec2 dSTdy = dFdy( vBumpMapUv ); 239 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 240 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 241 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 242 return vec2( dBx, dBy ); 243 } 244 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 245 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 246 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 247 vec3 vN = surf_norm; 248 vec3 R1 = cross( vSigmaY, vN ); 249 vec3 R2 = cross( vN, vSigmaX ); 250 float fDet = dot( vSigmaX, R1 ) * faceDirection; 251 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 252 return normalize( abs( fDet ) * surf_norm - vGrad ); 253 } 254#endif`,Rc=`#if NUM_CLIPPING_PLANES > 0 255 vec4 plane; 256 #ifdef ALPHA_TO_COVERAGE 257 float distanceToPlane, distanceGradient; 258 float clipOpacity = 1.0; 259 #pragma unroll_loop_start 260 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 261 plane = clippingPlanes[ i ]; 262 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 263 distanceGradient = fwidth( distanceToPlane ) / 2.0; 264 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 265 if ( clipOpacity == 0.0 ) discard; 266 } 267 #pragma unroll_loop_end 268 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 269 float unionClipOpacity = 1.0; 270 #pragma unroll_loop_start 271 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 272 plane = clippingPlanes[ i ]; 273 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 274 distanceGradient = fwidth( distanceToPlane ) / 2.0; 275 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 276 } 277 #pragma unroll_loop_end 278 clipOpacity *= 1.0 - unionClipOpacity; 279 #endif 280 diffuseColor.a *= clipOpacity; 281 if ( diffuseColor.a == 0.0 ) discard; 282 #else 283 #pragma unroll_loop_start 284 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 287 } 288 #pragma unroll_loop_end 289 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 290 bool clipped = true; 291 #pragma unroll_loop_start 292 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 293 plane = clippingPlanes[ i ]; 294 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 295 } 296 #pragma unroll_loop_end 297 if ( clipped ) discard; 298 #endif 299 #endif 300#endif`,wc=`#if NUM_CLIPPING_PLANES > 0 301 varying vec3 vClipPosition; 302 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 303#endif`,Cc=`#if NUM_CLIPPING_PLANES > 0 304 varying vec3 vClipPosition; 305#endif`,Pc=`#if NUM_CLIPPING_PLANES > 0 306 vClipPosition = - mvPosition.xyz; 307#endif`,Dc=`#if defined( USE_COLOR_ALPHA ) 308 diffuseColor *= vColor; 309#elif defined( USE_COLOR ) 310 diffuseColor.rgb *= vColor; 311#endif`,Lc=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) 314 varying vec3 vColor; 315#endif`,Uc=`#if defined( USE_COLOR_ALPHA ) 316 varying vec4 vColor; 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 varying vec3 vColor; 319#endif`,Ic=`#if defined( USE_COLOR_ALPHA ) 320 vColor = vec4( 1.0 ); 321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 322 vColor = vec3( 1.0 ); 323#endif 324#ifdef USE_COLOR 325 vColor *= color; 326#endif 327#ifdef USE_INSTANCING_COLOR 328 vColor.xyz *= instanceColor.xyz; 329#endif 330#ifdef USE_BATCHING_COLOR 331 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 332 vColor.xyz *= batchingColor.xyz; 333#endif`,Nc=`#define PI 3.141592653589793 334#define PI2 6.283185307179586 335#define PI_HALF 1.5707963267948966 336#define RECIPROCAL_PI 0.3183098861837907 337#define RECIPROCAL_PI2 0.15915494309189535 338#define EPSILON 1e-6 339#ifndef saturate 340#define saturate( a ) clamp( a, 0.0, 1.0 ) 341#endif 342#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 343float pow2( const in float x ) { return x*x; } 344vec3 pow2( const in vec3 x ) { return x*x; } 345float pow3( const in float x ) { return x*x*x; } 346float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 349highp float rand( const in vec2 uv ) { 350 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 351 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 352 return fract( sin( sn ) * c ); 353} 354#ifdef HIGH_PRECISION 355 float precisionSafeLength( vec3 v ) { return length( v ); } 356#else 357 float precisionSafeLength( vec3 v ) { 358 float maxComponent = max3( abs( v ) ); 359 return length( v / maxComponent ) * maxComponent; 360 } 361#endif 362struct IncidentLight { 363 vec3 color; 364 vec3 direction; 365 bool visible; 366}; 367struct ReflectedLight { 368 vec3 directDiffuse; 369 vec3 directSpecular; 370 vec3 indirectDiffuse; 371 vec3 indirectSpecular; 372}; 373#ifdef USE_ALPHAHASH 374 varying vec3 vPosition; 375#endif 376vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 377 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 378} 379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 381} 382mat3 transposeMat3( const in mat3 m ) { 383 mat3 tmp; 384 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 385 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 386 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 387 return tmp; 388} 389bool isPerspectiveMatrix( mat4 m ) { 390 return m[ 2 ][ 3 ] == - 1.0; 391} 392vec2 equirectUv( in vec3 dir ) { 393 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 394 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 395 return vec2( u, v ); 396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 398 return RECIPROCAL_PI * diffuseColor; 399} 400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} 404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 405 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 406 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 407} // validated`,Fc=`#ifdef ENVMAP_TYPE_CUBE_UV 408 #define cubeUV_minMipLevel 4.0 409 #define cubeUV_minTileSize 16.0 410 float getFace( vec3 direction ) { 411 vec3 absDirection = abs( direction ); 412 float face = - 1.0; 413 if ( absDirection.x > absDirection.z ) { 414 if ( absDirection.x > absDirection.y ) 415 face = direction.x > 0.0 ? 0.0 : 3.0; 416 else 417 face = direction.y > 0.0 ? 1.0 : 4.0; 418 } else { 419 if ( absDirection.z > absDirection.y ) 420 face = direction.z > 0.0 ? 2.0 : 5.0; 421 else 422 face = direction.y > 0.0 ? 1.0 : 4.0; 423 } 424 return face; 425 } 426 vec2 getUV( vec3 direction, float face ) { 427 vec2 uv; 428 if ( face == 0.0 ) { 429 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 430 } else if ( face == 1.0 ) { 431 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 432 } else if ( face == 2.0 ) { 433 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 434 } else if ( face == 3.0 ) { 435 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 436 } else if ( face == 4.0 ) { 437 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 438 } else { 439 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 440 } 441 return 0.5 * ( uv + 1.0 ); 442 } 443 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 444 float face = getFace( direction ); 445 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 446 mipInt = max( mipInt, cubeUV_minMipLevel ); 447 float faceSize = exp2( mipInt ); 448 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 449 if ( face > 2.0 ) { 450 uv.y += faceSize; 451 face -= 3.0; 452 } 453 uv.x += face * faceSize; 454 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 455 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 456 uv.x *= CUBEUV_TEXEL_WIDTH; 457 uv.y *= CUBEUV_TEXEL_HEIGHT; 458 #ifdef texture2DGradEXT 459 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 460 #else 461 return texture2D( envMap, uv ).rgb; 462 #endif 463 } 464 #define cubeUV_r0 1.0 465 #define cubeUV_m0 - 2.0 466 #define cubeUV_r1 0.8 467 #define cubeUV_m1 - 1.0 468 #define cubeUV_r4 0.4 469 #define cubeUV_m4 2.0 470 #define cubeUV_r5 0.305 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_m6 4.0 474 float roughnessToMip( float roughness ) { 475 float mip = 0.0; 476 if ( roughness >= cubeUV_r1 ) { 477 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 478 } else if ( roughness >= cubeUV_r4 ) { 479 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 480 } else if ( roughness >= cubeUV_r5 ) { 481 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 482 } else if ( roughness >= cubeUV_r6 ) { 483 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 484 } else { 485 mip = - 2.0 * log2( 1.16 * roughness ); } 486 return mip; 487 } 488 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 489 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 490 float mipF = fract( mip ); 491 float mipInt = floor( mip ); 492 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 493 if ( mipF == 0.0 ) { 494 return vec4( color0, 1.0 ); 495 } else { 496 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 497 return vec4( mix( color0, color1, mipF ), 1.0 ); 498 } 499 } 500#endif`,Oc=`vec3 transformedNormal = objectNormal; 501#ifdef USE_TANGENT 502 vec3 transformedTangent = objectTangent; 503#endif 504#ifdef USE_BATCHING 505 mat3 bm = mat3( batchingMatrix ); 506 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 507 transformedNormal = bm * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = bm * transformedTangent; 510 #endif 511#endif 512#ifdef USE_INSTANCING 513 mat3 im = mat3( instanceMatrix ); 514 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 515 transformedNormal = im * transformedNormal; 516 #ifdef USE_TANGENT 517 transformedTangent = im * transformedTangent; 518 #endif 519#endif 520transformedNormal = normalMatrix * transformedNormal; 521#ifdef FLIP_SIDED 522 transformedNormal = - transformedNormal; 523#endif 524#ifdef USE_TANGENT 525 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 526 #ifdef FLIP_SIDED 527 transformedTangent = - transformedTangent; 528 #endif 529#endif`,Bc=`#ifdef USE_DISPLACEMENTMAP 530 uniform sampler2D displacementMap; 531 uniform float displacementScale; 532 uniform float displacementBias; 533#endif`,zc=`#ifdef USE_DISPLACEMENTMAP 534 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias ); 535#endif`,Hc=`#ifdef USE_EMISSIVEMAP 536 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 537 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 538 emissiveColor = sRGBTransferEOTF( emissiveColor ); 539 #endif 540 totalEmissiveRadiance *= emissiveColor.rgb; 541#endif`,Vc=`#ifdef USE_EMISSIVEMAP 542 uniform sampler2D emissiveMap; 543#endif`,Gc="gl_FragColor = linearToOutputTexel( gl_FragColor );",kc=`vec4 LinearTransferOETF( in vec4 value ) { 544 return value; 545} 546vec4 sRGBTransferEOTF( in vec4 value ) { 547 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 548} 549vec4 sRGBTransferOETF( in vec4 value ) { 550 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 551}`,Wc=`#ifdef USE_ENVMAP 552 #ifdef ENV_WORLDPOS 553 vec3 cameraToFrag; 554 if ( isOrthographic ) { 555 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 556 } else { 557 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 558 } 559 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 560 #ifdef ENVMAP_MODE_REFLECTION 561 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 562 #else 563 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 564 #endif 565 #else 566 vec3 reflectVec = vReflect; 567 #endif 568 #ifdef ENVMAP_TYPE_CUBE 569 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 570 #else 571 vec4 envColor = vec4( 0.0 ); 572 #endif 573 #ifdef ENVMAP_BLENDING_MULTIPLY 574 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 575 #elif defined( ENVMAP_BLENDING_MIX ) 576 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 577 #elif defined( ENVMAP_BLENDING_ADD ) 578 outgoingLight += envColor.xyz * specularStrength * reflectivity; 579 #endif 580#endif`,Xc=`#ifdef USE_ENVMAP 581 uniform float envMapIntensity; 582 uniform float flipEnvMap; 583 uniform mat3 envMapRotation; 584 #ifdef ENVMAP_TYPE_CUBE 585 uniform samplerCube envMap; 586 #else 587 uniform sampler2D envMap; 588 #endif 589 590#endif`,qc=`#ifdef USE_ENVMAP 591 uniform float reflectivity; 592 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 593 #define ENV_WORLDPOS 594 #endif 595 #ifdef ENV_WORLDPOS 596 varying vec3 vWorldPosition; 597 uniform float refractionRatio; 598 #else 599 varying vec3 vReflect; 600 #endif 601#endif`,Yc=`#ifdef USE_ENVMAP 602 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 603 #define ENV_WORLDPOS 604 #endif 605 #ifdef ENV_WORLDPOS 606 607 varying vec3 vWorldPosition; 608 #else 609 varying vec3 vReflect; 610 uniform float refractionRatio; 611 #endif 612#endif`,Zc=`#ifdef USE_ENVMAP 613 #ifdef ENV_WORLDPOS 614 vWorldPosition = worldPosition.xyz; 615 #else 616 vec3 cameraToVertex; 617 if ( isOrthographic ) { 618 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 619 } else {
620 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 621 } 622 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 623 #ifdef ENVMAP_MODE_REFLECTION 624 vReflect = reflect( cameraToVertex, worldNormal ); 625 #else 626 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 627 #endif 628 #endif 629#endif`,Kc=`#ifdef USE_FOG 630 vFogDepth = - mvPosition.z; 631#endif`,$c=`#ifdef USE_FOG 632 varying float vFogDepth; 633#endif`,jc=`#ifdef USE_FOG 634 #ifdef FOG_EXP2 635 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 636 #else 637 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 638 #endif 639 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 640#endif`,Jc=`#ifdef USE_FOG 641 uniform vec3 fogColor; 642 varying float vFogDepth; 643 #ifdef FOG_EXP2 644 uniform float fogDensity; 645 #else 646 uniform float fogNear; 647 uniform float fogFar; 648 #endif 649#endif`,Qc=`#ifdef USE_GRADIENTMAP 650 uniform sampler2D gradientMap; 651#endif 652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 653 float dotNL = dot( normal, lightDirection ); 654 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 655 #ifdef USE_GRADIENTMAP 656 return vec3( texture2D( gradientMap, coord ).r ); 657 #else 658 vec2 fw = fwidth( coord ) * 0.5; 659 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 660 #endif 661}`,eu=`#ifdef USE_LIGHTMAP 662 uniform sampler2D lightMap; 663 uniform float lightMapIntensity; 664#endif`,tu=`LambertMaterial material; 665material.diffuseColor = diffuseColor.rgb; 666material.specularStrength = specularStrength;`,nu=`varying vec3 vViewPosition; 667struct LambertMaterial { 668 vec3 diffuseColor; 669 float specularStrength; 670}; 671void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 672 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 673 vec3 irradiance = dotNL * directLight.color; 674 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 675} 676void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 677 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 678} 679#define RE_Direct RE_Direct_Lambert 680#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,iu=`uniform bool receiveShadow; 681uniform vec3 ambientLightColor; 682#if defined( USE_LIGHT_PROBES ) 683 uniform vec3 lightProbe[ 9 ]; 684#endif 685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 686 float x = normal.x, y = normal.y, z = normal.z; 687 vec3 result = shCoefficients[ 0 ] * 0.886227; 688 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 689 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 690 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 691 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 692 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 693 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 694 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 695 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 696 return result; 697} 698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 699 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 700 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 701 return irradiance; 702} 703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 704 vec3 irradiance = ambientLightColor; 705 return irradiance; 706} 707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 708 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 709 if ( cutoffDistance > 0.0 ) { 710 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 711 } 712 return distanceFalloff; 713} 714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 715 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 716} 717#if NUM_DIR_LIGHTS > 0 718 struct DirectionalLight { 719 vec3 direction; 720 vec3 color; 721 }; 722 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 723 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 724 light.color = directionalLight.color; 725 light.direction = directionalLight.direction; 726 light.visible = true; 727 } 728#endif 729#if NUM_POINT_LIGHTS > 0 730 struct PointLight { 731 vec3 position; 732 vec3 color; 733 float distance; 734 float decay; 735 }; 736 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 737 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 738 vec3 lVector = pointLight.position - geometryPosition; 739 light.direction = normalize( lVector ); 740 float lightDistance = length( lVector ); 741 light.color = pointLight.color; 742 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 743 light.visible = ( light.color != vec3( 0.0 ) ); 744 } 745#endif
746#if NUM_SPOT_LIGHTS > 0 747 struct SpotLight { 748 vec3 position; 749 vec3 direction; 750 vec3 color; 751 float distance; 752 float decay; 753 float coneCos; 754 float penumbraCos; 755 }; 756 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 757 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 758 vec3 lVector = spotLight.position - geometryPosition; 759 light.direction = normalize( lVector ); 760 float angleCos = dot( light.direction, spotLight.direction ); 761 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 762 if ( spotAttenuation > 0.0 ) { 763 float lightDistance = length( lVector ); 764 light.color = spotLight.color * spotAttenuation; 765 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 766 light.visible = ( light.color != vec3( 0.0 ) ); 767 } else { 768 light.color = vec3( 0.0 ); 769 light.visible = false; 770 } 771 } 772#endif 773#if NUM_RECT_AREA_LIGHTS > 0 774 struct RectAreaLight { 775 vec3 color; 776 vec3 position; 777 vec3 halfWidth; 778 vec3 halfHeight; 779 }; 780 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 781 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 782#endif 783#if NUM_HEMI_LIGHTS > 0 784 struct HemisphereLight { 785 vec3 direction; 786 vec3 skyColor; 787 vec3 groundColor; 788 }; 789 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 790 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 791 float dotNL = dot( normal, hemiLight.direction ); 792 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 793 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 794 return irradiance; 795 } 796#endif`,ru=`#ifdef USE_ENVMAP 797 vec3 getIBLIrradiance( const in vec3 normal ) { 798 #ifdef ENVMAP_TYPE_CUBE_UV 799 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 800 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 801 return PI * envMapColor.rgb * envMapIntensity; 802 #else 803 return vec3( 0.0 ); 804 #endif 805 } 806 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 807 #ifdef ENVMAP_TYPE_CUBE_UV 808 vec3 reflectVec = reflect( - viewDir, normal ); 809 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 810 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 811 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 812 return envMapColor.rgb * envMapIntensity; 813 #else 814 return vec3( 0.0 ); 815 #endif 816 } 817 #ifdef USE_ANISOTROPY 818 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 819 #ifdef ENVMAP_TYPE_CUBE_UV 820 vec3 bentNormal = cross( bitangent, viewDir ); 821 bentNormal = normalize( cross( bentNormal, bitangent ) ); 822 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 823 return getIBLRadiance( viewDir, bentNormal, roughness ); 824 #else 825 return vec3( 0.0 ); 826 #endif 827 } 828 #endif 829#endif`,su=`ToonMaterial material; 830material.diffuseColor = diffuseColor.rgb;`,au=`varying vec3 vViewPosition; 831struct ToonMaterial { 832 vec3 diffuseColor; 833}; 834void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 835 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 836 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 837} 838void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 839 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 840} 841#define RE_Direct RE_Direct_Toon 842#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ou=`BlinnPhongMaterial material; 843material.diffuseColor = diffuseColor.rgb; 844material.specularColor = specular; 845material.specularShininess = shininess; 846material.specularStrength = specularStrength;`,lu=`varying vec3 vViewPosition; 847struct BlinnPhongMaterial { 848 vec3 diffuseColor; 849 vec3 specularColor; 850 float specularShininess; 851 float specularStrength; 852}; 853void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
854 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 855 vec3 irradiance = dotNL * directLight.color; 856 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 858} 859void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 860 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 861} 862#define RE_Direct RE_Direct_BlinnPhong 863#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,cu=`PhysicalMaterial material; 864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 868material.roughness = min( material.roughness, 1.0 ); 869#ifdef IOR 870 material.ior = ior; 871 #ifdef USE_SPECULAR 872 float specularIntensityFactor = specularIntensity; 873 vec3 specularColorFactor = specularColor; 874 #ifdef USE_SPECULAR_COLORMAP 875 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 876 #endif 877 #ifdef USE_SPECULAR_INTENSITYMAP 878 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 879 #endif 880 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 881 #else 882 float specularIntensityFactor = 1.0; 883 vec3 specularColorFactor = vec3( 1.0 ); 884 material.specularF90 = 1.0; 885 #endif 886 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 887#else 888 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 889 material.specularF90 = 1.0; 890#endif 891#ifdef USE_CLEARCOAT 892 material.clearcoat = clearcoat; 893 material.clearcoatRoughness = clearcoatRoughness; 894 material.clearcoatF0 = vec3( 0.04 ); 895 material.clearcoatF90 = 1.0; 896 #ifdef USE_CLEARCOATMAP 897 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 898 #endif 899 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 900 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 901 #endif 902 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 903 material.clearcoatRoughness += geometryRoughness; 904 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 905#endif 906#ifdef USE_DISPERSION 907 material.dispersion = dispersion; 908#endif 909#ifdef USE_IRIDESCENCE 910 material.iridescence = iridescence; 911 material.iridescenceIOR = iridescenceIOR; 912 #ifdef USE_IRIDESCENCEMAP 913 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 914 #endif 915 #ifdef USE_IRIDESCENCE_THICKNESSMAP 916 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 917 #else 918 material.iridescenceThickness = iridescenceThicknessMaximum; 919 #endif 920#endif 921#ifdef USE_SHEEN 922 material.sheenColor = sheenColor; 923 #ifdef USE_SHEEN_COLORMAP 924 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 925 #endif 926 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 927 #ifdef USE_SHEEN_ROUGHNESSMAP 928 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 929 #endif 930#endif 931#ifdef USE_ANISOTROPY 932 #ifdef USE_ANISOTROPYMAP 933 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 934 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 935 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 936 #else 937 vec2 anisotropyV = anisotropyVector; 938 #endif 939 material.anisotropy = length( anisotropyV ); 940 if( material.anisotropy == 0.0 ) { 941 anisotropyV = vec2( 1.0, 0.0 ); 942 } else { 943 anisotropyV /= material.anisotropy; 944 material.anisotropy = saturate( material.anisotropy ); 945 } 946 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 948 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 949#endif`,uu
vendor: 14,687 bytes, lines 949-1250
949=`struct PhysicalMaterial { 950 vec3 diffuseColor; 951 float roughness; 952 vec3 specularColor; 953 float specularF90; 954 float dispersion; 955 #ifdef USE_CLEARCOAT 956 float clearcoat; 957 float clearcoatRoughness; 958 vec3 clearcoatF0; 959 float clearcoatF90; 960 #endif 961 #ifdef USE_IRIDESCENCE 962 float iridescence; 963 float iridescenceIOR; 964 float iridescenceThickness; 965 vec3 iridescenceFresnel; 966 vec3 iridescenceF0; 967 #endif 968 #ifdef USE_SHEEN 969 vec3 sheenColor; 970 float sheenRoughness; 971 #endif 972 #ifdef IOR 973 float ior; 974 #endif 975 #ifdef USE_TRANSMISSION 976 float transmission; 977 float transmissionAlpha; 978 float thickness; 979 float attenuationDistance; 980 vec3 attenuationColor; 981 #endif 982 #ifdef USE_ANISOTROPY 983 float anisotropy; 984 float alphaT; 985 vec3 anisotropyT; 986 vec3 anisotropyB; 987 #endif 988}; 989vec3 clearcoatSpecularDirect = vec3( 0.0 ); 990vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 991vec3 sheenSpecularDirect = vec3( 0.0 ); 992vec3 sheenSpecularIndirect = vec3(0.0 ); 993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 994 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 995 float x2 = x * x; 996 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 997 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 998} 999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1000 float a2 = pow2( alpha ); 1001 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1002 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1003 return 0.5 / max( gv + gl, EPSILON ); 1004} 1005float D_GGX( const in float alpha, const in float dotNH ) { 1006 float a2 = pow2( alpha ); 1007 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1008 return RECIPROCAL_PI * a2 / pow2( denom ); 1009} 1010#ifdef USE_ANISOTROPY 1011 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1012 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1013 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1014 float v = 0.5 / ( gv + gl ); 1015 return saturate(v); 1016 } 1017 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1018 float a2 = alphaT * alphaB; 1019 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1020 highp float v2 = dot( v, v ); 1021 float w2 = a2 / v2; 1022 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1023 } 1024#endif 1025#ifdef USE_CLEARCOAT 1026 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1027 vec3 f0 = material.clearcoatF0; 1028 float f90 = material.clearcoatF90; 1029 float roughness = material.clearcoatRoughness; 1030 float alpha = pow2( roughness ); 1031 vec3 halfDir = normalize( lightDir + viewDir ); 1032 float dotNL = saturate( dot( normal, lightDir ) ); 1033 float dotNV = saturate( dot( normal, viewDir ) ); 1034 float dotNH = saturate( dot( normal, halfDir ) ); 1035 float dotVH = saturate( dot( viewDir, halfDir ) ); 1036 vec3 F = F_Schlick( f0, f90, dotVH ); 1037 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1038 float D = D_GGX( alpha, dotNH ); 1039 return F * ( V * D ); 1040 } 1041#endif 1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1043 vec3 f0 = material.specularColor; 1044 float f90 = material.specularF90; 1045 float roughness = material.roughness; 1046 float alpha = pow2( roughness ); 1047 vec3 halfDir = normalize( lightDir + viewDir ); 1048 float dotNL = saturate( dot( normal, lightDir ) ); 1049 float dotNV = saturate( dot( normal, viewDir ) ); 1050 float dotNH = saturate( dot( normal, halfDir ) ); 1051 float dotVH = saturate( dot( viewDir, halfDir ) ); 1052 vec3 F = F_Schlick( f0, f90, dotVH ); 1053 #ifdef USE_IRIDESCENCE 1054 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1055 #endif 1056 #ifdef USE_ANISOTROPY 1057 float dotTL = dot( material.anisotropyT, lightDir ); 1058 float dotTV = dot( material.anisotropyT, viewDir ); 1059 float dotTH = dot( material.anisotropyT, halfDir ); 1060 float dotBL = dot( material.anisotropyB, lightDir ); 1061 float dotBV = dot( material.anisotropyB, viewDir ); 1062 float dotBH = dot( material.anisotropyB, halfDir ); 1063 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1064 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1065 #else 1066 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1067 float D = D_GGX( alpha, dotNH ); 1068 #endif 1069 return F * ( V * D ); 1070} 1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1072 const float LUT_SIZE = 64.0; 1073 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1074 const float LUT_BIAS = 0.5 / LUT_SIZE; 1075 float dotNV = saturate( dot( N, V ) ); 1076 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1077 uv = uv * LUT_SCALE + LUT_BIAS; 1078 return uv; 1079} 1080float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1081 float l = length( f ); 1082 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1083} 1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1085 float x = dot( v1, v2 ); 1086 float y = abs( x ); 1087 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1088 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1089 float v = a / b; 1090 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1091 return cross( v1, v2 ) * theta_sintheta; 1092} 1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1094 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1095 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1096 vec3 lightNormal = cross( v1, v2 ); 1097 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1098 vec3 T1, T2; 1099 T1 = normalize( V - N * dot( V, N ) ); 1100 T2 = - cross( N, T1 ); 1101 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1102 vec3 coords[ 4 ]; 1103 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1104 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1105 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1106 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1107 coords[ 0 ] = normalize( coords[ 0 ] ); 1108 coords[ 1 ] = normalize( coords[ 1 ] ); 1109 coords[ 2 ] = normalize( coords[ 2 ] ); 1110 coords[ 3 ] = normalize( coords[ 3 ] ); 1111 vec3 vectorFormFactor = vec3( 0.0 ); 1112 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1113 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1114 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1116 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1117 return vec3( result ); 1118} 1119#if defined( USE_SHEEN ) 1120float D_Charlie( float roughness, float dotNH ) { 1121 float alpha = pow2( roughness ); 1122 float invAlpha = 1.0 / alpha; 1123 float cos2h = dotNH * dotNH; 1124 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1125 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1126} 1127float V_Neubelt( float dotNV, float dotNL ) { 1128 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1129} 1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1131 vec3 halfDir = normalize( lightDir + viewDir ); 1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 float dotNH = saturate( dot( normal, halfDir ) ); 1135 float D = D_Charlie( sheenRoughness, dotNH ); 1136 float V = V_Neubelt( dotNV, dotNL ); 1137 return sheenColor * ( D * V ); 1138} 1139#endif 1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 float r2 = roughness * roughness; 1143 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1144 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1145 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1146 return saturate( DG * RECIPROCAL_PI ); 1147} 1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1149 float dotNV = saturate( dot( normal, viewDir ) ); 1150 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1151 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1152 vec4 r = roughness * c0 + c1; 1153 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1154 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1155 return fab; 1156} 1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1158 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1159 return specularColor * fab.x + specularF90 * fab.y; 1160} 1161#ifdef USE_IRIDESCENCE 1162void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1163#else 1164void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1165#endif 1166 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1167 #ifdef USE_IRIDESCENCE 1168 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1169 #else 1170 vec3 Fr = specularColor; 1171 #endif 1172 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1173 float Ess = fab.x + fab.y; 1174 float Ems = 1.0 - Ess; 1175 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1176 singleScatter += FssEss; 1177 multiScatter += Fms * Ems; 1178} 1179#if NUM_RECT_AREA_LIGHTS > 0 1180 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1181 vec3 normal = geometryNormal; 1182 vec3 viewDir = geometryViewDir; 1183 vec3 position = geometryPosition; 1184 vec3 lightPos = rectAreaLight.position; 1185 vec3 halfWidth = rectAreaLight.halfWidth; 1186 vec3 halfHeight = rectAreaLight.halfHeight; 1187 vec3 lightColor = rectAreaLight.color; 1188 float roughness = material.roughness; 1189 vec3 rectCoords[ 4 ]; 1190 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1191 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1192 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1193 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1194 vec4 t1 = texture2D( ltc_1, uv ); 1195 vec4 t2 = texture2D( ltc_2, uv ); 1196 mat3 mInv = mat3( 1197 vec3( t1.x, 0, t1.y ), 1198 vec3( 0, 1, 0 ), 1199 vec3( t1.z, 0, t1.w ) 1200 ); 1201 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1202 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1203 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1204 } 1205#endif 1206void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1207 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1208 vec3 irradiance = dotNL * directLight.color; 1209 #ifdef USE_CLEARCOAT 1210 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1211 vec3 ccIrradiance = dotNLcc * directLight.color; 1212 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1213 #endif 1214 #ifdef USE_SHEEN 1215 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1216 #endif 1217 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1218 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1219} 1220void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1221 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1222} 1223void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1224 #ifdef USE_CLEARCOAT 1225 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1226 #endif 1227 #ifdef USE_SHEEN 1228 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1229 #endif 1230 vec3 singleScattering = vec3( 0.0 ); 1231 vec3 multiScattering = vec3( 0.0 ); 1232 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1233 #ifdef USE_IRIDESCENCE 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1237 #endif 1238 vec3 totalScattering = singleScattering + multiScattering; 1239 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1240 reflectedLight.indirectSpecular += radiance * singleScattering; 1241 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1242 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1243} 1244#define RE_Direct RE_Direct_Physical 1245#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1246#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1247#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1249 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1250}`,
1250hu=` 1251vec3 geometryPosition = - vViewPosition; 1252vec3 geometryNormal = normal; 1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1254vec3 geometryClearcoatNormal = vec3( 0.0 ); 1255#ifdef USE_CLEARCOAT 1256 geometryClearcoatNormal = clearcoatNormal; 1257#endif 1258#ifdef USE_IRIDESCENCE 1259 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1260 if ( material.iridescenceThickness == 0.0 ) { 1261 material.iridescence = 0.0; 1262 } else { 1263 material.iridescence = saturate( material.iridescence ); 1264 } 1265 if ( material.iridescence > 0.0 ) { 1266 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1267 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1268 } 1269#endif 1270IncidentLight directLight; 1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1272 PointLight pointLight; 1273 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1274 PointLightShadow pointLightShadow; 1275 #endif 1276 #pragma unroll_loop_start 1277 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1278 pointLight = pointLights[ i ]; 1279 getPointLightInfo( pointLight, geometryPosition, directLight ); 1280 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1281 pointLightShadow = pointLightShadows[ i ]; 1282 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1283 #endif 1284 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1285 } 1286 #pragma unroll_loop_end 1287#endif 1288#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1289 SpotLight spotLight; 1290 vec4 spotColor; 1291 vec3 spotLightCoord; 1292 bool inSpotLightMap; 1293 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1294 SpotLightShadow spotLightShadow; 1295 #endif 1296 #pragma unroll_loop_start 1297 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1298 spotLight = spotLights[ i ]; 1299 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1300 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1301 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1302 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1303 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1304 #else 1305 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1306 #endif 1307 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1308 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1309 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1310 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1311 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1312 #endif 1313 #undef SPOT_LIGHT_MAP_INDEX 1314 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1315 spotLightShadow = spotLightShadows[ i ]; 1316 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1317 #endif 1318 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1319 } 1320 #pragma unroll_loop_end 1321#endif 1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1323 DirectionalLight directionalLight; 1324 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1325 DirectionalLightShadow directionalLightShadow; 1326 #endif 1327 #pragma unroll_loop_start 1328 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1329 directionalLight = directionalLights[ i ]; 1330 getDirectionalLightInfo( directionalLight, directLight ); 1331 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1332 directionalLightShadow = directionalLightShadows[ i ]; 1333 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1334 #endif 1335 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1336 } 1337 #pragma unroll_loop_end 1338#endif 1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1340 RectAreaLight rectAreaLight; 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1343 rectAreaLight = rectAreaLights[ i ]; 1344 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1345 } 1346 #pragma unroll_loop_end 1347#endif 1348#if defined( RE_IndirectDiffuse ) 1349 vec3 iblIrradiance = vec3( 0.0 ); 1350 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1351 #if defined( USE_LIGHT_PROBES ) 1352 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1353 #endif 1354 #if ( NUM_HEMI_LIGHTS > 0 ) 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1357 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1358 } 1359 #pragma unroll_loop_end 1360 #endif 1361#endif 1362#if defined( RE_IndirectSpecular ) 1363 vec3 radiance = vec3( 0.0 ); 1364 vec3 clearcoatRadiance = vec3( 0.0 ); 1365#endif`,fu=`#if defined( RE_IndirectDiffuse ) 1366 #ifdef USE_LIGHTMAP 1367 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1368 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1369 irradiance += lightMapIrradiance; 1370 #endif 1371 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1372 iblIrradiance += getIBLIrradiance( geometryNormal ); 1373 #endif 1374#endif 1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1376 #ifdef USE_ANISOTROPY 1377 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1378 #else 1379 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1380 #endif 1381 #ifdef USE_CLEARCOAT 1382 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1383 #endif 1384#endif`,du=`#if defined( RE_IndirectDiffuse ) 1385 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1386#endif 1387#if defined( RE_IndirectSpecular ) 1388 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1389#endif`,pu=`#if defined( USE_LOGDEPTHBUF ) 1390 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1391#endif`,mu=`#if defined( USE_LOGDEPTHBUF ) 1392 uniform float logDepthBufFC; 1393 varying float vFragDepth; 1394 varying float vIsPerspective; 1395#endif`,_u=`#ifdef USE_LOGDEPTHBUF 1396 varying float vFragDepth; 1397 varying float vIsPerspective; 1398#endif`,gu=`#ifdef USE_LOGDEPTHBUF 1399 vFragDepth = 1.0 + gl_Position.w; 1400 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1401#endif`,vu=`#ifdef USE_MAP 1402 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1403 #ifdef DECODE_VIDEO_TEXTURE 1404 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1405 #endif 1406 diffuseColor *= sampledDiffuseColor; 1407#endif`,xu=`#ifdef USE_MAP 1408 uniform sampler2D map; 1409#endif`,Mu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1410 #if defined( USE_POINTS_UV ) 1411 vec2 uv = vUv; 1412 #else 1413 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1414 #endif 1415#endif 1416#ifdef USE_MAP 1417 diffuseColor *= texture2D( map, uv ); 1418#endif 1419#ifdef USE_ALPHAMAP 1420 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1421#endif`,Su=`#if defined( USE_POINTS_UV ) 1422 varying vec2 vUv; 1423#else 1424 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1425 uniform mat3 uvTransform; 1426 #endif 1427#endif 1428#ifdef USE_MAP 1429 uniform sampler2D map; 1430#endif 1431#ifdef USE_ALPHAMAP 1432 uniform sampler2D alphaMap; 1433#endif`,Eu=`float metalnessFactor = metalness; 1434#ifdef USE_METALNESSMAP 1435 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1436 metalnessFactor *= texelMetalness.b; 1437#endif`,yu=`#ifdef USE_METALNESSMAP 1438 uniform sampler2D metalnessMap; 1439#endif`,Tu=`#ifdef USE_INSTANCING_MORPH 1440 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1441 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1442 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1443 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1444 } 1445#endif`,Au=`#if defined( USE_MORPHCOLORS ) 1446 vColor *= morphTargetBaseInfluence; 1447 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1448 #if defined( USE_COLOR_ALPHA ) 1449 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1450 #elif defined( USE_COLOR ) 1451 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1452 #endif 1453 } 1454#endif`,bu=`#ifdef USE_MORPHNORMALS 1455 objectNormal *= morphTargetBaseInfluence; 1456 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1457 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1458 } 1459#endif`,Ru=`#ifdef USE_MORPHTARGETS 1460 #ifndef USE_INSTANCING_MORPH 1461 uniform float morphTargetBaseInfluence; 1462 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1463 #endif 1464 uniform sampler2DArray morphTargetsTexture; 1465 uniform ivec2 morphTargetsTextureSize; 1466 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1467 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1468 int y = texelIndex / morphTargetsTextureSize.x; 1469 int x = texelIndex - y * morphTargetsTextureSize.x; 1470 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1471 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1472 } 1473#endif`,wu=`#ifdef USE_MORPHTARGETS 1474 transformed *= morphTargetBaseInfluence; 1475 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1476 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1477 } 1478#endif`,Cu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1479#ifdef FLAT_SHADED 1480 vec3 fdx = dFdx( vViewPosition ); 1481 vec3 fdy = dFdy( vViewPosition ); 1482 vec3 normal = normalize( cross( fdx, fdy ) ); 1483#else 1484 vec3 normal = normalize( vNormal ); 1485 #ifdef DOUBLE_SIDED 1486 normal *= faceDirection; 1487 #endif 1488#endif 1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1490 #ifdef USE_TANGENT 1491 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1492 #else 1493 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1494 #if defined( USE_NORMALMAP ) 1495 vNormalMapUv 1496 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1497 vClearcoatNormalMapUv 1498 #else 1499 vUv 1500 #endif 1501 ); 1502 #endif 1503 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1504 tbn[0] *= faceDirection; 1505 tbn[1] *= faceDirection; 1506 #endif 1507#endif 1508#ifdef USE_CLEARCOAT_NORMALMAP 1509 #ifdef USE_TANGENT 1510 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1511 #else 1512 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1513 #endif 1514 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1515 tbn2[0] *= faceDirection; 1516 tbn2[1] *= faceDirection; 1517 #endif 1518#endif 1519vec3 nonPerturbedNormal = normal;`,Pu=`#ifdef USE_NORMALMAP_OBJECTSPACE 1520 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1521 #ifdef FLIP_SIDED 1522 normal = - normal; 1523 #endif 1524 #ifdef DOUBLE_SIDED 1525 normal = normal * faceDirection; 1526 #endif 1527 normal = normalize( normalMatrix * normal ); 1528#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1529 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1530 mapN.xy *= normalScale; 1531 normal = normalize( tbn * mapN ); 1532#elif defined( USE_BUMPMAP )
1533 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1534#endif`,Du=`#ifndef FLAT_SHADED 1535 varying vec3 vNormal; 1536 #ifdef USE_TANGENT 1537 varying vec3 vTangent; 1538 varying vec3 vBitangent; 1539 #endif 1540#endif`,Lu=`#ifndef FLAT_SHADED 1541 varying vec3 vNormal; 1542 #ifdef USE_TANGENT 1543 varying vec3 vTangent; 1544 varying vec3 vBitangent; 1545 #endif 1546#endif`,Uu=`#ifndef FLAT_SHADED 1547 vNormal = normalize( transformedNormal ); 1548 #ifdef USE_TANGENT 1549 vTangent = normalize( transformedTangent ); 1550 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1551 #endif 1552#endif`,Iu=`#ifdef USE_NORMALMAP 1553 uniform sampler2D normalMap; 1554 uniform vec2 normalScale; 1555#endif 1556#ifdef USE_NORMALMAP_OBJECTSPACE 1557 uniform mat3 normalMatrix; 1558#endif 1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1560 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1561 vec3 q0 = dFdx( eye_pos.xyz ); 1562 vec3 q1 = dFdy( eye_pos.xyz ); 1563 vec2 st0 = dFdx( uv.st ); 1564 vec2 st1 = dFdy( uv.st ); 1565 vec3 N = surf_norm; 1566 vec3 q1perp = cross( q1, N ); 1567 vec3 q0perp = cross( N, q0 ); 1568 vec3 T = q1perp * st0.x + q0perp * st1.x; 1569 vec3 B = q1perp * st0.y + q0perp * st1.y; 1570 float det = max( dot( T, T ), dot( B, B ) ); 1571 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1572 return mat3( T * scale, B * scale, N ); 1573 } 1574#endif`,Nu=`#ifdef USE_CLEARCOAT 1575 vec3 clearcoatNormal = nonPerturbedNormal; 1576#endif`,Fu=`#ifdef USE_CLEARCOAT_NORMALMAP 1577 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1578 clearcoatMapN.xy *= clearcoatNormalScale; 1579 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1580#endif`,Ou=`#ifdef USE_CLEARCOATMAP 1581 uniform sampler2D clearcoatMap; 1582#endif 1583#ifdef USE_CLEARCOAT_NORMALMAP 1584 uniform sampler2D clearcoatNormalMap; 1585 uniform vec2 clearcoatNormalScale; 1586#endif 1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1588 uniform sampler2D clearcoatRoughnessMap; 1589#endif`,Bu=`#ifdef USE_IRIDESCENCEMAP 1590 uniform sampler2D iridescenceMap; 1591#endif 1592#ifdef USE_IRIDESCENCE_THICKNESSMAP 1593 uniform sampler2D iridescenceThicknessMap; 1594#endif`,zu=`#ifdef OPAQUE 1595diffuseColor.a = 1.0; 1596#endif 1597#ifdef USE_TRANSMISSION 1598diffuseColor.a *= material.transmissionAlpha; 1599#endif 1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Hu=`vec3 packNormalToRGB( const in vec3 normal ) { 1601 return normalize( normal ) * 0.5 + 0.5; 1602} 1603vec3 unpackRGBToNormal( const in vec3 rgb ) { 1604 return 2.0 * rgb.xyz - 1.0; 1605} 1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1607const float Inv255 = 1. / 255.; 1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1612vec4 packDepthToRGBA( const in float v ) { 1613 if( v <= 0.0 ) 1614 return vec4( 0., 0., 0., 0. ); 1615 if( v >= 1.0 ) 1616 return vec4( 1., 1., 1., 1. ); 1617 float vuf; 1618 float af = modf( v * PackFactors.a, vuf ); 1619 float bf = modf( vuf * ShiftRight8, vuf ); 1620 float gf = modf( vuf * ShiftRight8, vuf ); 1621 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1622} 1623vec3 packDepthToRGB( const in float v ) { 1624 if( v <= 0.0 ) 1625 return vec3( 0., 0., 0. ); 1626 if( v >= 1.0 ) 1627 return vec3( 1., 1., 1. ); 1628 float vuf; 1629 float bf = modf( v * PackFactors.b, vuf ); 1630 float gf = modf( vuf * ShiftRight8, vuf ); 1631 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1632} 1633vec2 packDepthToRG( const in float v ) { 1634 if( v <= 0.0 ) 1635 return vec2( 0., 0. ); 1636 if( v >= 1.0 ) 1637 return vec2( 1., 1. ); 1638 float vuf; 1639 float gf = modf( v * 256., vuf ); 1640 return vec2( vuf * Inv255, gf ); 1641} 1642float unpackRGBAToDepth( const in vec4 v ) { 1643 return dot( v, UnpackFactors4 ); 1644} 1645float unpackRGBToDepth( const in vec3 v ) { 1646 return dot( v, UnpackFactors3 ); 1647} 1648float unpackRGToDepth( const in vec2 v ) { 1649 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1650} 1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1653 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1654} 1655vec2 unpackRGBATo2Half( const in vec4 v ) { 1656 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1657} 1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1659 return ( viewZ + near ) / ( near - far ); 1660} 1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1662 return depth * ( near - far ) - near; 1663} 1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1665 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1666} 1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1668 return ( near * far ) / ( ( far - near ) * depth - far ); 1669}`,Vu=`#ifdef PREMULTIPLIED_ALPHA 1670 gl_FragColor.rgb *= gl_FragColor.a; 1671#endif`,Gu=`vec4 mvPosition = vec4( transformed, 1.0 ); 1672#ifdef USE_BATCHING 1673 mvPosition = batchingMatrix * mvPosition; 1674#endif 1675#ifdef USE_INSTANCING 1676 mvPosition = instanceMatrix * mvPosition; 1677#endif 1678mvPosition = modelViewMatrix * mvPosition; 1679gl_Position = projectionMatrix * mvPosition;`,ku=`#ifdef DITHERING 1680 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1681#endif`,Wu=`#ifdef DITHERING 1682 vec3 dithering( vec3 color ) { 1683 float grid_position = rand( gl_FragCoord.xy ); 1684 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1685 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1686 return color + dither_shift_RGB; 1687 } 1688#endif`,Xu=`float roughnessFactor = roughness; 1689#ifdef USE_ROUGHNESSMAP 1690 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1691 roughnessFactor *= texelRoughness.g; 1692#endif`,qu=`#ifdef USE_ROUGHNESSMAP 1693 uniform sampler2D roughnessMap; 1694#endif`,Yu=
vendor: 8,887 bytes, lines 1694-1880
1694`#if NUM_SPOT_LIGHT_COORDS > 0 1695 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1696#endif 1697#if NUM_SPOT_LIGHT_MAPS > 0 1698 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1699#endif 1700#ifdef USE_SHADOWMAP 1701 #if NUM_DIR_LIGHT_SHADOWS > 0 1702 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1703 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1704 struct DirectionalLightShadow { 1705 float shadowIntensity; 1706 float shadowBias; 1707 float shadowNormalBias; 1708 float shadowRadius; 1709 vec2 shadowMapSize; 1710 }; 1711 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1712 #endif 1713 #if NUM_SPOT_LIGHT_SHADOWS > 0 1714 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1715 struct SpotLightShadow { 1716 float shadowIntensity; 1717 float shadowBias; 1718 float shadowNormalBias; 1719 float shadowRadius; 1720 vec2 shadowMapSize; 1721 }; 1722 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 #endif 1724 #if NUM_POINT_LIGHT_SHADOWS > 0 1725 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1726 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1727 struct PointLightShadow { 1728 float shadowIntensity; 1729 float shadowBias; 1730 float shadowNormalBias; 1731 float shadowRadius; 1732 vec2 shadowMapSize; 1733 float shadowCameraNear; 1734 float shadowCameraFar; 1735 }; 1736 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1737 #endif 1738 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1739 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1740 } 1741 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1742 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1743 } 1744 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1745 float occlusion = 1.0; 1746 vec2 distribution = texture2DDistribution( shadow, uv ); 1747 float hard_shadow = step( compare , distribution.x ); 1748 if (hard_shadow != 1.0 ) { 1749 float distance = compare - distribution.x ; 1750 float variance = max( 0.00000, distribution.y * distribution.y ); 1751 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 ); 1752 } 1753 return occlusion; 1754 } 1755 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1756 float shadow = 1.0; 1757 shadowCoord.xyz /= shadowCoord.w; 1758 shadowCoord.z += shadowBias; 1759 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1760 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1761 if ( frustumTest ) { 1762 #if defined( SHADOWMAP_TYPE_PCF ) 1763 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1764 float dx0 = - texelSize.x * shadowRadius; 1765 float dy0 = - texelSize.y * shadowRadius; 1766 float dx1 = + texelSize.x * shadowRadius; 1767 float dy1 = + texelSize.y * shadowRadius; 1768 float dx2 = dx0 / 2.0; 1769 float dy2 = dy0 / 2.0; 1770 float dx3 = dx1 / 2.0; 1771 float dy3 = dy1 / 2.0; 1772 shadow = ( 1773 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1790 ) * ( 1.0 / 17.0 ); 1791 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1792 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1793 float dx = texelSize.x; 1794 float dy = texelSize.y; 1795 vec2 uv = shadowCoord.xy; 1796 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1797 uv -= f * texelSize; 1798 shadow = ( 1799 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1800 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1801 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1802 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1803 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1804 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1805 f.x ) + 1806 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1807 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1808 f.x ) + 1809 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1810 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1811 f.y ) + 1812 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1813 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1814 f.y ) + 1815 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1816 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1817 f.x ), 1818 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1819 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1820 f.x ), 1821 f.y ) 1822 ) * ( 1.0 / 9.0 ); 1823 #elif defined( SHADOWMAP_TYPE_VSM ) 1824 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1825 #else 1826 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1827 #endif 1828 } 1829 return mix( 1.0, shadow, shadowIntensity ); 1830 } 1831 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1832 vec3 absV = abs( v ); 1833 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1834 absV *= scaleToCube; 1835 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1836 vec2 planar = v.xy; 1837 float almostATexel = 1.5 * texelSizeY; 1838 float almostOne = 1.0 - almostATexel; 1839 if ( absV.z >= almostOne ) { 1840 if ( v.z > 0.0 ) 1841 planar.x = 4.0 - v.x; 1842 } else if ( absV.x >= almostOne ) { 1843 float signX = sign( v.x ); 1844 planar.x = v.z * signX + 2.0 * signX; 1845 } else if ( absV.y >= almostOne ) { 1846 float signY = sign( v.y ); 1847 planar.x = v.x + 2.0 * signY + 2.0; 1848 planar.y = v.z * signY - 2.0; 1849 } 1850 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1851 } 1852 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1853 float shadow = 1.0; 1854 vec3 lightToPosition = shadowCoord.xyz; 1855 1856 float lightToPositionLength = length( lightToPosition ); 1857 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1858 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1859 vec3 bd3D = normalize( lightToPosition ); 1860 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1861 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1862 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1863 shadow = ( 1864 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1869 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1870 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1871 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1873 ) * ( 1.0 / 9.0 ); 1874 #else 1875 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1876 #endif 1877 } 1878 return mix( 1.0, shadow, shadowIntensity ); 1879 } 1880#endif`,
1880Zu=`#if NUM_SPOT_LIGHT_COORDS > 0 1881 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1882 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1883#endif 1884#ifdef USE_SHADOWMAP 1885 #if NUM_DIR_LIGHT_SHADOWS > 0 1886 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1887 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1888 struct DirectionalLightShadow { 1889 float shadowIntensity; 1890 float shadowBias; 1891 float shadowNormalBias; 1892 float shadowRadius; 1893 vec2 shadowMapSize; 1894 }; 1895 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1896 #endif 1897 #if NUM_SPOT_LIGHT_SHADOWS > 0 1898 struct SpotLightShadow { 1899 float shadowIntensity; 1900 float shadowBias; 1901 float shadowNormalBias; 1902 float shadowRadius; 1903 vec2 shadowMapSize; 1904 }; 1905 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1906 #endif 1907 #if NUM_POINT_LIGHT_SHADOWS > 0 1908 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1909 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1910 struct PointLightShadow { 1911 float shadowIntensity; 1912 float shadowBias; 1913 float shadowNormalBias; 1914 float shadowRadius; 1915 vec2 shadowMapSize; 1916 float shadowCameraNear; 1917 float shadowCameraFar; 1918 }; 1919 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1920 #endif 1921#endif`,Ku=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1922 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1923 vec4 shadowWorldPosition; 1924#endif 1925#if defined( USE_SHADOWMAP ) 1926 #if NUM_DIR_LIGHT_SHADOWS > 0 1927 #pragma unroll_loop_start 1928 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1929 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1930 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1931 } 1932 #pragma unroll_loop_end 1933 #endif 1934 #if NUM_POINT_LIGHT_SHADOWS > 0 1935 #pragma unroll_loop_start 1936 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1937 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1938 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1939 } 1940 #pragma unroll_loop_end 1941 #endif 1942#endif 1943#if NUM_SPOT_LIGHT_COORDS > 0 1944 #pragma unroll_loop_start 1945 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1946 shadowWorldPosition = worldPosition; 1947 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1948 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1949 #endif 1950 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1951 } 1952 #pragma unroll_loop_end 1953#endif`,$u=`float getShadowMask() { 1954 float shadow = 1.0; 1955 #ifdef USE_SHADOWMAP 1956 #if NUM_DIR_LIGHT_SHADOWS > 0 1957 DirectionalLightShadow directionalLight; 1958 #pragma unroll_loop_start 1959 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1960 directionalLight = directionalLightShadows[ i ]; 1961 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1962 } 1963 #pragma unroll_loop_end 1964 #endif 1965 #if NUM_SPOT_LIGHT_SHADOWS > 0 1966 SpotLightShadow spotLight; 1967 #pragma unroll_loop_start 1968 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1969 spotLight = spotLightShadows[ i ]; 1970 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1971 } 1972 #pragma unroll_loop_end 1973 #endif 1974 #if NUM_POINT_LIGHT_SHADOWS > 0 1975 PointLightShadow pointLight; 1976 #pragma unroll_loop_start 1977 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1978 pointLight = pointLightShadows[ i ]; 1979 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1980 } 1981 #pragma unroll_loop_end 1982 #endif 1983 #endif 1984 return shadow; 1985}`,ju=`#ifdef USE_SKINNING 1986 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1987 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1988 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1989 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1990#endif`,Ju=`#ifdef USE_SKINNING 1991 uniform mat4 bindMatrix; 1992 uniform mat4 bindMatrixInverse; 1993 uniform highp sampler2D boneTexture; 1994 mat4 getBoneMatrix( const in float i ) { 1995 int size = textureSize( boneTexture, 0 ).x; 1996 int j = int( i ) * 4; 1997 int x = j % size; 1998 int y = j / size; 1999 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2000 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2001 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2002 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2003 return mat4( v1, v2, v3, v4 ); 2004 } 2005#endif`,Qu=`#ifdef USE_SKINNING 2006 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2007 vec4 skinned = vec4( 0.0 ); 2008 skinned += boneMatX * skinVertex * skinWeight.x; 2009 skinned += boneMatY * skinVertex * skinWeight.y; 2010 skinned += boneMatZ * skinVertex * skinWeight.z; 2011 skinned += boneMatW * skinVertex * skinWeight.w; 2012 transformed = ( bindMatrixInverse * skinned ).xyz; 2013#endif`,eh=`#ifdef USE_SKINNING 2014 mat4 skinMatrix = mat4( 0.0 ); 2015 skinMatrix += skinWeight.x * boneMatX; 2016 skinMatrix += skinWeight.y * boneMatY; 2017 skinMatrix += skinWeight.z * boneMatZ; 2018 skinMatrix += skinWeight.w * boneMatW; 2019 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2020 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2021 #ifdef USE_TANGENT 2022 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2023 #endif 2024#endif`,th=`float specularStrength; 2025#ifdef USE_SPECULARMAP 2026 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2027 specularStrength = texelSpecular.r; 2028#else 2029 specularStrength = 1.0; 2030#endif`,nh=`#ifdef USE_SPECULARMAP 2031 uniform sampler2D specularMap; 2032#endif`,ih=`#if defined( TONE_MAPPING ) 2033 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2034#endif`,rh=`#ifndef saturate 2035#define saturate( a ) clamp( a, 0.0, 1.0 ) 2036#endif 2037uniform float toneMappingExposure; 2038vec3 LinearToneMapping( vec3 color ) { 2039 return saturate( toneMappingExposure * color ); 2040} 2041vec3 ReinhardToneMapping( vec3 color ) { 2042 color *= toneMappingExposure; 2043 return saturate( color / ( vec3( 1.0 ) + color ) ); 2044} 2045vec3 CineonToneMapping( vec3 color ) { 2046 color *= toneMappingExposure; 2047 color = max( vec3( 0.0 ), color - 0.004 ); 2048 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2049} 2050vec3 RRTAndODTFit( vec3 v ) { 2051 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2052 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2053 return a / b; 2054} 2055vec3 ACESFilmicToneMapping( vec3 color ) { 2056 const mat3 ACESInputMat = mat3( 2057 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2058 vec3( 0.04823, 0.01566, 0.83777 ) 2059 ); 2060 const mat3 ACESOutputMat = mat3( 2061 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2062 vec3( -0.07367, -0.00605, 1.07602 ) 2063 ); 2064 color *= toneMappingExposure / 0.6; 2065 color = ACESInputMat * color; 2066 color = RRTAndODTFit( color ); 2067 color = ACESOutputMat * color; 2068 return saturate( color ); 2069} 2070const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2071 vec3( 1.6605, - 0.1246, - 0.0182 ), 2072 vec3( - 0.5876, 1.1329, - 0.1006 ), 2073 vec3( - 0.0728, - 0.0083, 1.1187 ) 2074); 2075const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2076 vec3( 0.6274, 0.0691, 0.0164 ), 2077 vec3( 0.3293, 0.9195, 0.0880 ), 2078 vec3( 0.0433, 0.0113, 0.8956 ) 2079); 2080vec3 agxDefaultContrastApprox( vec3 x ) { 2081 vec3 x2 = x * x; 2082 vec3 x4 = x2 * x2; 2083 return + 15.5 * x4 * x2 2084 - 40.14 * x4 * x 2085 + 31.96 * x4 2086 - 6.868 * x2 * x 2087 + 0.4298 * x2 2088 + 0.1191 * x 2089 - 0.00232; 2090} 2091vec3 AgXToneMapping( vec3 color ) { 2092 const mat3 AgXInsetMatrix = mat3( 2093 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2094 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2095 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2096 );
2097 const mat3 AgXOutsetMatrix = mat3( 2098 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2099 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2100 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2101 ); 2102 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2103 color *= toneMappingExposure; 2104 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2105 color = AgXInsetMatrix * color; 2106 color = max( color, 1e-10 ); color = log2( color ); 2107 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2108 color = clamp( color, 0.0, 1.0 ); 2109 color = agxDefaultContrastApprox( color ); 2110 color = AgXOutsetMatrix * color; 2111 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2112 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2113 color = clamp( color, 0.0, 1.0 ); 2114 return color; 2115} 2116vec3 NeutralToneMapping( vec3 color ) { 2117 const float StartCompression = 0.8 - 0.04; 2118 const float Desaturation = 0.15; 2119 color *= toneMappingExposure; 2120 float x = min( color.r, min( color.g, color.b ) ); 2121 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2122 color -= offset; 2123 float peak = max( color.r, max( color.g, color.b ) ); 2124 if ( peak < StartCompression ) return color; 2125 float d = 1. - StartCompression; 2126 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2127 color *= newPeak / peak; 2128 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2129 return mix( color, vec3( newPeak ), g ); 2130} 2131vec3 CustomToneMapping( vec3 color ) { return color; }`,sh=`#ifdef USE_TRANSMISSION 2132 material.transmission = transmission; 2133 material.transmissionAlpha = 1.0; 2134 material.thickness = thickness; 2135 material.attenuationDistance = attenuationDistance; 2136 material.attenuationColor = attenuationColor; 2137 #ifdef USE_TRANSMISSIONMAP 2138 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2139 #endif 2140 #ifdef USE_THICKNESSMAP 2141 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2142 #endif 2143 vec3 pos = vWorldPosition; 2144 vec3 v = normalize( cameraPosition - pos ); 2145 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2146 vec4 transmitted = getIBLVolumeRefraction( 2147 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2148 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2149 material.attenuationColor, material.attenuationDistance ); 2150 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2151 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2152#endif`,ah=`#ifdef USE_TRANSMISSION 2153 uniform float transmission; 2154 uniform float thickness; 2155 uniform float attenuationDistance; 2156 uniform vec3 attenuationColor; 2157 #ifdef USE_TRANSMISSIONMAP 2158 uniform sampler2D transmissionMap; 2159 #endif 2160 #ifdef USE_THICKNESSMAP 2161 uniform sampler2D thicknessMap; 2162 #endif 2163 uniform vec2 transmissionSamplerSize; 2164 uniform sampler2D transmissionSamplerMap; 2165 uniform mat4 modelMatrix; 2166 uniform mat4 projectionMatrix; 2167 varying vec3 vWorldPosition; 2168 float w0( float a ) { 2169 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2170 } 2171 float w1( float a ) { 2172 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2173 } 2174 float w2( float a ){ 2175 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2176 } 2177 float w3( float a ) { 2178 return ( 1.0 / 6.0 ) * ( a * a * a ); 2179 } 2180 float g0( float a ) { 2181 return w0( a ) + w1( a ); 2182 } 2183 float g1( float a ) { 2184 return w2( a ) + w3( a ); 2185 } 2186 float h0( float a ) { 2187 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2188 } 2189 float h1( float a ) { 2190 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2191 } 2192 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2193 uv = uv * texelSize.zw + 0.5; 2194 vec2 iuv = floor( uv ); 2195 vec2 fuv = fract( uv ); 2196 float g0x = g0( fuv.x ); 2197 float g1x = g1( fuv.x ); 2198 float h0x = h0( fuv.x ); 2199 float h1x = h1( fuv.x ); 2200 float h0y = h0( fuv.y ); 2201 float h1y = h1( fuv.y ); 2202 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2203 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2204 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2205 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2206 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2207 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2208 } 2209 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2210 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2211 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2212 vec2 fLodSizeInv = 1.0 / fLodSize; 2213 vec2 cLodSizeInv = 1.0 / cLodSize; 2214 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2215 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2216 return mix( fSample, cSample, fract( lod ) ); 2217 } 2218 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2219 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2220 vec3 modelScale; 2221 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2222 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2223 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2224 return normalize( refractionVector ) * thickness * modelScale; 2225 } 2226 float applyIorToRoughness( const in float roughness, const in float ior ) { 2227 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2228 } 2229 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2230 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2231 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2232 } 2233 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2234 if ( isinf( attenuationDistance ) ) { 2235 return vec3( 1.0 ); 2236 } else { 2237 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2238 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2239 } 2240 } 2241 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2242 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2243 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2244 const in vec3 attenuationColor, const in float attenuationDistance ) { 2245 vec4 transmittedLight; 2246 vec3 transmittance; 2247 #ifdef USE_DISPERSION 2248 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2249 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2250 for ( int i = 0; i < 3; i ++ ) { 2251 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2252 vec3 refractedRayExit = position + transmissionRay; 2253 2254 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2255 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2256 refractionCoords += 1.0; 2257 refractionCoords /= 2.0; 2258 2259 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2260 transmittedLight[ i ] = transmissionSample[ i ]; 2261 transmittedLight.a += transmissionSample.a; 2262 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2263 } 2264 transmittedLight.a /= 3.0; 2265 2266 #else 2267 2268 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2269 vec3 refractedRayExit = position + transmissionRay; 2270 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2271 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2272 refractionCoords += 1.0; 2273 refractionCoords /= 2.0; 2274 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2275 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2276 2277 #endif 2278 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2279 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2280 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2281 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2282 } 2283#endif`,oh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2284 varying vec2 vUv; 2285#endif 2286#ifdef USE_MAP 2287 varying vec2 vMapUv; 2288#endif 2289#ifdef USE_ALPHAMAP
2290 varying vec2 vAlphaMapUv; 2291#endif 2292#ifdef USE_LIGHTMAP 2293 varying vec2 vLightMapUv; 2294#endif 2295#ifdef USE_AOMAP 2296 varying vec2 vAoMapUv; 2297#endif 2298#ifdef USE_BUMPMAP 2299 varying vec2 vBumpMapUv; 2300#endif 2301#ifdef USE_NORMALMAP 2302 varying vec2 vNormalMapUv; 2303#endif 2304#ifdef USE_EMISSIVEMAP 2305 varying vec2 vEmissiveMapUv; 2306#endif 2307#ifdef USE_METALNESSMAP 2308 varying vec2 vMetalnessMapUv; 2309#endif 2310#ifdef USE_ROUGHNESSMAP 2311 varying vec2 vRoughnessMapUv; 2312#endif 2313#ifdef USE_ANISOTROPYMAP 2314 varying vec2 vAnisotropyMapUv; 2315#endif 2316#ifdef USE_CLEARCOATMAP 2317 varying vec2 vClearcoatMapUv; 2318#endif 2319#ifdef USE_CLEARCOAT_NORMALMAP 2320 varying vec2 vClearcoatNormalMapUv; 2321#endif 2322#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2323 varying vec2 vClearcoatRoughnessMapUv; 2324#endif 2325#ifdef USE_IRIDESCENCEMAP 2326 varying vec2 vIridescenceMapUv; 2327#endif 2328#ifdef USE_IRIDESCENCE_THICKNESSMAP 2329 varying vec2 vIridescenceThicknessMapUv; 2330#endif 2331#ifdef USE_SHEEN_COLORMAP 2332 varying vec2 vSheenColorMapUv; 2333#endif 2334#ifdef USE_SHEEN_ROUGHNESSMAP 2335 varying vec2 vSheenRoughnessMapUv; 2336#endif 2337#ifdef USE_SPECULARMAP 2338 varying vec2 vSpecularMapUv; 2339#endif 2340#ifdef USE_SPECULAR_COLORMAP 2341 varying vec2 vSpecularColorMapUv; 2342#endif 2343#ifdef USE_SPECULAR_INTENSITYMAP 2344 varying vec2 vSpecularIntensityMapUv; 2345#endif 2346#ifdef USE_TRANSMISSIONMAP 2347 uniform mat3 transmissionMapTransform; 2348 varying vec2 vTransmissionMapUv; 2349#endif 2350#ifdef USE_THICKNESSMAP 2351 uniform mat3 thicknessMapTransform; 2352 varying vec2 vThicknessMapUv; 2353#endif`,lh=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2354 varying vec2 vUv; 2355#endif 2356#ifdef USE_MAP 2357 uniform mat3 mapTransform; 2358 varying vec2 vMapUv; 2359#endif 2360#ifdef USE_ALPHAMAP 2361 uniform mat3 alphaMapTransform; 2362 varying vec2 vAlphaMapUv; 2363#endif 2364#ifdef USE_LIGHTMAP 2365 uniform mat3 lightMapTransform; 2366 varying vec2 vLightMapUv; 2367#endif 2368#ifdef USE_AOMAP 2369 uniform mat3 aoMapTransform; 2370 varying vec2 vAoMapUv; 2371#endif 2372#ifdef USE_BUMPMAP 2373 uniform mat3 bumpMapTransform; 2374 varying vec2 vBumpMapUv; 2375#endif 2376#ifdef USE_NORMALMAP 2377 uniform mat3 normalMapTransform; 2378 varying vec2 vNormalMapUv; 2379#endif 2380#ifdef USE_DISPLACEMENTMAP 2381 uniform mat3 displacementMapTransform; 2382 varying vec2 vDisplacementMapUv; 2383#endif 2384#ifdef USE_EMISSIVEMAP 2385 uniform mat3 emissiveMapTransform; 2386 varying vec2 vEmissiveMapUv; 2387#endif 2388#ifdef USE_METALNESSMAP 2389 uniform mat3 metalnessMapTransform; 2390 varying vec2 vMetalnessMapUv; 2391#endif 2392#ifdef USE_ROUGHNESSMAP 2393 uniform mat3 roughnessMapTransform; 2394 varying vec2 vRoughnessMapUv; 2395#endif 2396#ifdef USE_ANISOTROPYMAP 2397 uniform mat3 anisotropyMapTransform; 2398 varying vec2 vAnisotropyMapUv; 2399#endif 2400#ifdef USE_CLEARCOATMAP 2401 uniform mat3 clearcoatMapTransform; 2402 varying vec2 vClearcoatMapUv; 2403#endif 2404#ifdef USE_CLEARCOAT_NORMALMAP 2405 uniform mat3 clearcoatNormalMapTransform; 2406 varying vec2 vClearcoatNormalMapUv; 2407#endif 2408#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2409 uniform mat3 clearcoatRoughnessMapTransform; 2410 varying vec2 vClearcoatRoughnessMapUv; 2411#endif 2412#ifdef USE_SHEEN_COLORMAP 2413 uniform mat3 sheenColorMapTransform; 2414 varying vec2 vSheenColorMapUv; 2415#endif 2416#ifdef USE_SHEEN_ROUGHNESSMAP 2417 uniform mat3 sheenRoughnessMapTransform; 2418 varying vec2 vSheenRoughnessMapUv; 2419#endif 2420#ifdef USE_IRIDESCENCEMAP 2421 uniform mat3 iridescenceMapTransform; 2422 varying vec2 vIridescenceMapUv; 2423#endif 2424#ifdef USE_IRIDESCENCE_THICKNESSMAP 2425 uniform mat3 iridescenceThicknessMapTransform; 2426 varying vec2 vIridescenceThicknessMapUv; 2427#endif 2428#ifdef USE_SPECULARMAP 2429 uniform mat3 specularMapTransform; 2430 varying vec2 vSpecularMapUv; 2431#endif 2432#ifdef USE_SPECULAR_COLORMAP 2433 uniform mat3 specularColorMapTransform; 2434 varying vec2 vSpecularColorMapUv; 2435#endif 2436#ifdef USE_SPECULAR_INTENSITYMAP 2437 uniform mat3 specularIntensityMapTransform; 2438 varying vec2 vSpecularIntensityMapUv; 2439#endif 2440#ifdef USE_TRANSMISSIONMAP 2441 uniform mat3 transmissionMapTransform; 2442 varying vec2 vTransmissionMapUv; 2443#endif 2444#ifdef USE_THICKNESSMAP 2445 uniform mat3 thicknessMapTransform; 2446 varying vec2 vThicknessMapUv; 2447#endif`,ch=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2448 vUv = vec3( uv, 1 ).xy; 2449#endif 2450#ifdef USE_MAP 2451 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2452#endif 2453#ifdef USE_ALPHAMAP 2454 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2455#endif 2456#ifdef USE_LIGHTMAP 2457 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2458#endif 2459#ifdef USE_AOMAP 2460 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2461#endif 2462#ifdef USE_BUMPMAP 2463 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2464#endif 2465#ifdef USE_NORMALMAP 2466 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2467#endif 2468#ifdef USE_DISPLACEMENTMAP 2469 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2470#endif 2471#ifdef USE_EMISSIVEMAP 2472 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2473#endif 2474#ifdef USE_METALNESSMAP 2475 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2476#endif 2477#ifdef USE_ROUGHNESSMAP 2478 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2479#endif 2480#ifdef USE_ANISOTROPYMAP 2481 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2482#endif 2483#ifdef USE_CLEARCOATMAP 2484 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2485#endif 2486#ifdef USE_CLEARCOAT_NORMALMAP 2487 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2488#endif 2489#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2490 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2491#endif
2492#ifdef USE_IRIDESCENCEMAP 2493 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2494#endif 2495#ifdef USE_IRIDESCENCE_THICKNESSMAP 2496 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2497#endif 2498#ifdef USE_SHEEN_COLORMAP 2499 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2500#endif 2501#ifdef USE_SHEEN_ROUGHNESSMAP 2502 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2503#endif 2504#ifdef USE_SPECULARMAP 2505 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2506#endif 2507#ifdef USE_SPECULAR_COLORMAP 2508 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2509#endif 2510#ifdef USE_SPECULAR_INTENSITYMAP 2511 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2512#endif 2513#ifdef USE_TRANSMISSIONMAP 2514 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2515#endif 2516#ifdef USE_THICKNESSMAP 2517 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2518#endif`,uh=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2519 vec4 worldPosition = vec4( transformed, 1.0 ); 2520 #ifdef USE_BATCHING 2521 worldPosition = batchingMatrix * worldPosition; 2522 #endif 2523 #ifdef USE_INSTANCING 2524 worldPosition = instanceMatrix * worldPosition; 2525 #endif 2526 worldPosition = modelMatrix * worldPosition; 2527#endif`;const hh=`varying vec2 vUv; 2528uniform mat3 uvTransform; 2529void main() { 2530 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2531 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2532}`,fh=`uniform sampler2D t2D; 2533uniform float backgroundIntensity; 2534varying vec2 vUv; 2535void main() { 2536 vec4 texColor = texture2D( t2D, vUv ); 2537 #ifdef DECODE_VIDEO_TEXTURE 2538 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2539 #endif 2540 texColor.rgb *= backgroundIntensity; 2541 gl_FragColor = texColor; 2542 #include <tonemapping_fragment> 2543 #include <colorspace_fragment> 2544}`,dh=`varying vec3 vWorldDirection; 2545#include <common> 2546void main() { 2547 vWorldDirection = transformDirection( position, modelMatrix ); 2548 #include <begin_vertex> 2549 #include <project_vertex> 2550 gl_Position.z = gl_Position.w; 2551}`,ph=`#ifdef ENVMAP_TYPE_CUBE 2552 uniform samplerCube envMap; 2553#elif defined( ENVMAP_TYPE_CUBE_UV ) 2554 uniform sampler2D envMap; 2555#endif 2556uniform float flipEnvMap; 2557uniform float backgroundBlurriness; 2558uniform float backgroundIntensity; 2559uniform mat3 backgroundRotation; 2560varying vec3 vWorldDirection; 2561#include <cube_uv_reflection_fragment> 2562void main() { 2563 #ifdef ENVMAP_TYPE_CUBE 2564 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2565 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2566 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2567 #else 2568 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2569 #endif 2570 texColor.rgb *= backgroundIntensity; 2571 gl_FragColor = texColor; 2572 #include <tonemapping_fragment> 2573 #include <colorspace_fragment> 2574}`,mh=`varying vec3 vWorldDirection; 2575#include <common> 2576void main() { 2577 vWorldDirection = transformDirection( position, modelMatrix ); 2578 #include <begin_vertex> 2579 #include <project_vertex> 2580 gl_Position.z = gl_Position.w; 2581}`,_h=`uniform samplerCube tCube; 2582uniform float tFlip; 2583uniform float opacity; 2584varying vec3 vWorldDirection; 2585void main() { 2586 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2587 gl_FragColor = texColor; 2588 gl_FragColor.a *= opacity; 2589 #include <tonemapping_fragment> 2590 #include <colorspace_fragment> 2591}`,gh=`#include <common> 2592#include <batching_pars_vertex> 2593#include <uv_pars_vertex> 2594#include <displacementmap_pars_vertex> 2595#include <morphtarget_pars_vertex> 2596#include <skinning_pars_vertex> 2597#include <logdepthbuf_pars_vertex> 2598#include <clipping_planes_pars_vertex> 2599varying vec2 vHighPrecisionZW; 2600void main() { 2601 #include <uv_vertex> 2602 #include <batching_vertex> 2603 #include <skinbase_vertex> 2604 #include <morphinstance_vertex> 2605 #ifdef USE_DISPLACEMENTMAP 2606 #include <beginnormal_vertex> 2607 #include <morphnormal_vertex> 2608 #include <skinnormal_vertex> 2609 #endif 2610 #include <begin_vertex> 2611 #include <morphtarget_vertex> 2612 #include <skinning_vertex> 2613 #include <displacementmap_vertex> 2614 #include <project_vertex> 2615 #include <logdepthbuf_vertex> 2616 #include <clipping_planes_vertex> 2617 vHighPrecisionZW = gl_Position.zw; 2618}`,vh=`#if DEPTH_PACKING == 3200 2619 uniform float opacity; 2620#endif 2621#include <common> 2622#include <packing> 2623#include <uv_pars_fragment> 2624#include <map_pars_fragment> 2625#include <alphamap_pars_fragment> 2626#include <alphatest_pars_fragment> 2627#include <alphahash_pars_fragment> 2628#include <logdepthbuf_pars_fragment> 2629#include <clipping_planes_pars_fragment> 2630varying vec2 vHighPrecisionZW; 2631void main() { 2632 vec4 diffuseColor = vec4( 1.0 ); 2633 #include <clipping_planes_fragment> 2634 #if DEPTH_PACKING == 3200 2635 diffuseColor.a = opacity; 2636 #endif 2637 #include <map_fragment> 2638 #include <alphamap_fragment> 2639 #include <alphatest_fragment> 2640 #include <alphahash_fragment> 2641 #include <logdepthbuf_fragment> 2642 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2643 #if DEPTH_PACKING == 3200 2644 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2645 #elif DEPTH_PACKING == 3201 2646 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2647 #elif DEPTH_PACKING == 3202 2648 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2649 #elif DEPTH_PACKING == 3203 2650 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2651 #endif 2652}`,xh=`#define DISTANCE 2653varying vec3 vWorldPosition; 2654#include <common> 2655#include <batching_pars_vertex> 2656#include <uv_pars_vertex> 2657#include <displacementmap_pars_vertex> 2658#include <morphtarget_pars_vertex> 2659#include <skinning_pars_vertex> 2660#include <clipping_planes_pars_vertex> 2661void main() { 2662 #include <uv_vertex> 2663 #include <batching_vertex> 2664 #include <skinbase_vertex> 2665 #include <morphinstance_vertex> 2666 #ifdef USE_DISPLACEMENTMAP 2667 #include <beginnormal_vertex> 2668 #include <morphnormal_vertex> 2669 #include <skinnormal_vertex> 2670 #endif 2671 #include <begin_vertex> 2672 #include <morphtarget_vertex> 2673 #include <skinning_vertex> 2674 #include <displacementmap_vertex> 2675 #include <project_vertex> 2676 #include <worldpos_vertex> 2677 #include <clipping_planes_vertex> 2678 vWorldPosition = worldPosition.xyz; 2679}`,Mh=`#define DISTANCE 2680uniform vec3 referencePosition; 2681uniform float nearDistance; 2682uniform float farDistance; 2683varying vec3 vWorldPosition; 2684#include <common> 2685#include <packing> 2686#include <uv_pars_fragment> 2687#include <map_pars_fragment> 2688#include <alphamap_pars_fragment> 2689#include <alphatest_pars_fragment> 2690#include <alphahash_pars_fragment> 2691#include <clipping_planes_pars_fragment> 2692void main () { 2693 vec4 diffuseColor = vec4( 1.0 ); 2694 #include <clipping_planes_fragment> 2695 #include <map_fragment> 2696 #include <alphamap_fragment> 2697 #include <alphatest_fragment> 2698 #include <alphahash_fragment> 2699 float dist = length( vWorldPosition - referencePosition ); 2700 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2701 dist = saturate( dist ); 2702 gl_FragColor = packDepthToRGBA( dist ); 2703}`,Sh=`varying vec3 vWorldDirection; 2704#include <common> 2705void main() { 2706 vWorldDirection = transformDirection( position, modelMatrix ); 2707 #include <begin_vertex> 2708 #include <project_vertex> 2709}`,Eh=`uniform sampler2D tEquirect; 2710varying vec3 vWorldDirection; 2711#include <common> 2712void main() { 2713 vec3 direction = normalize( vWorldDirection ); 2714 vec2 sampleUV = equirectUv( direction ); 2715 gl_FragColor = texture2D( tEquirect, sampleUV ); 2716 #include <tonemapping_fragment> 2717 #include <colorspace_fragment> 2718}`,yh=`uniform float scale; 2719attribute float lineDistance; 2720varying float vLineDistance; 2721#include <common> 2722#include <uv_pars_vertex> 2723#include <color_pars_vertex> 2724#include <fog_pars_vertex> 2725#include <morphtarget_pars_vertex> 2726#include <logdepthbuf_pars_vertex> 2727#include <clipping_planes_pars_vertex> 2728void main() { 2729 vLineDistance = scale * lineDistance; 2730 #include <uv_vertex> 2731 #include <color_vertex> 2732 #include <morphinstance_vertex> 2733 #include <morphcolor_vertex> 2734 #include <begin_vertex> 2735 #include <morphtarget_vertex> 2736 #include <project_vertex> 2737 #include <logdepthbuf_vertex> 2738 #include <clipping_planes_vertex> 2739 #include <fog_vertex> 2740}`,Th=`uniform vec3 diffuse; 2741uniform float opacity; 2742uniform float dashSize; 2743uniform float totalSize; 2744varying float vLineDistance; 2745#include <common> 2746#include <color_pars_fragment> 2747#include <uv_pars_fragment> 2748#include <map_pars_fragment> 2749#include <fog_pars_fragment> 2750#include <logdepthbuf_pars_fragment> 2751#include <clipping_planes_pars_fragment> 2752void main() { 2753 vec4 diffuseColor = vec4( diffuse, opacity ); 2754 #include <clipping_planes_fragment> 2755 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2756 discard; 2757 } 2758 vec3 outgoingLight = vec3( 0.0 ); 2759 #include <logdepthbuf_fragment> 2760 #include <map_fragment> 2761 #include <color_fragment> 2762 outgoingLight = diffuseColor.rgb; 2763 #include <opaque_fragment> 2764 #include <tonemapping_fragment> 2765 #include <colorspace_fragment> 2766 #include <fog_fragment> 2767 #include <premultiplied_alpha_fragment> 2768}`,Ah=`#include <common> 2769#include <batching_pars_vertex> 2770#include <uv_pars_vertex> 2771#include <envmap_pars_vertex> 2772#include <color_pars_vertex> 2773#include <fog_pars_vertex> 2774#include <morphtarget_pars_vertex> 2775#include <skinning_pars_vertex> 2776#include <logdepthbuf_pars_vertex> 2777#include <clipping_planes_pars_vertex> 2778void main() { 2779 #include <uv_vertex> 2780 #include <color_vertex> 2781 #include <morphinstance_vertex> 2782 #include <morphcolor_vertex> 2783 #include <batching_vertex> 2784 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2785 #include <beginnormal_vertex> 2786 #include <morphnormal_vertex> 2787 #include <skinbase_vertex> 2788 #include <skinnormal_vertex> 2789 #include <defaultnormal_vertex> 2790 #endif 2791 #include <begin_vertex> 2792 #include <morphtarget_vertex> 2793 #include <skinning_vertex> 2794 #include <project_vertex> 2795 #include <logdepthbuf_vertex> 2796 #include <clipping_planes_vertex> 2797 #include <worldpos_vertex> 2798 #include <envmap_vertex> 2799 #include <fog_vertex> 2800}`,bh=`uniform vec3 diffuse; 2801uniform float opacity; 2802#ifndef FLAT_SHADED 2803 varying vec3 vNormal; 2804#endif 2805#include <common> 2806#include <dithering_pars_fragment> 2807#include <color_pars_fragment> 2808#include <uv_pars_fragment> 2809#include <map_pars_fragment> 2810#include <alphamap_pars_fragment> 2811#include <alphatest_pars_fragment> 2812#include <alphahash_pars_fragment> 2813#include <aomap_pars_fragment> 2814#include <lightmap_pars_fragment> 2815#include <envmap_common_pars_fragment> 2816#include <envmap_pars_fragment> 2817#include <fog_pars_fragment> 2818#include <specularmap_pars_fragment> 2819#include <logdepthbuf_pars_fragment> 2820#include <clipping_planes_pars_fragment> 2821void main() { 2822 vec4 diffuseColor = vec4( diffuse, opacity ); 2823 #include <clipping_planes_fragment> 2824 #include <logdepthbuf_fragment> 2825 #include <map_fragment> 2826 #include <color_fragment> 2827 #include <alphamap_fragment> 2828 #include <alphatest_fragment> 2829 #include <alphahash_fragment> 2830 #include <specularmap_fragment> 2831 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2832 #ifdef USE_LIGHTMAP 2833 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2834 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2835 #else 2836 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2837 #endif 2838 #include <aomap_fragment> 2839 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2840 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2841 #include <envmap_fragment> 2842 #include <opaque_fragment> 2843 #include <tonemapping_fragment> 2844 #include <colorspace_fragment> 2845 #include <fog_fragment> 2846 #include <premultiplied_alpha_fragment> 2847 #include <dithering_fragment> 2848}`,Rh=`#define LAMBERT 2849varying vec3 vViewPosition; 2850#include <common> 2851#include <batching_pars_vertex> 2852#include <uv_pars_vertex> 2853#include <displacementmap_pars_vertex> 2854#include <envmap_pars_vertex> 2855#include <color_pars_vertex> 2856#include <fog_pars_vertex> 2857#include <normal_pars_vertex> 2858#include <morphtarget_pars_vertex> 2859#include <skinning_pars_vertex> 2860#include <shadowmap_pars_vertex> 2861#include <logdepthbuf_pars_vertex> 2862#include <clipping_planes_pars_vertex> 2863void main() { 2864 #include <uv_vertex> 2865 #include <color_vertex> 2866 #include <morphinstance_vertex> 2867 #include <morphcolor_vertex> 2868 #include <batching_vertex> 2869 #include <beginnormal_vertex> 2870 #include <morphnormal_vertex> 2871 #include <skinbase_vertex> 2872 #include <skinnormal_vertex> 2873 #include <defaultnormal_vertex> 2874 #include <normal_vertex> 2875 #include <begin_vertex> 2876 #include <morphtarget_vertex> 2877 #include <skinning_vertex> 2878 #include <displacementmap_vertex> 2879 #include <project_vertex> 2880 #include <logdepthbuf_vertex> 2881 #include <clipping_planes_vertex> 2882 vViewPosition = - mvPosition.xyz; 2883 #include <worldpos_vertex> 2884 #include <envmap_vertex> 2885 #include <shadowmap_vertex> 2886 #include <fog_vertex> 2887}`,wh=`#define LAMBERT 2888uniform vec3 diffuse; 2889uniform vec3 emissive; 2890uniform float opacity; 2891#include <common> 2892#include <packing> 2893#include <dithering_pars_fragment> 2894#include <color_pars_fragment> 2895#include <uv_pars_fragment> 2896#include <map_pars_fragment> 2897#include <alphamap_pars_fragment> 2898#include <alphatest_pars_fragment> 2899#include <alphahash_pars_fragment> 2900#include <aomap_pars_fragment> 2901#include <lightmap_pars_fragment> 2902#include <emissivemap_pars_fragment> 2903#include <envmap_common_pars_fragment> 2904#include <envmap_pars_fragment> 2905#include <fog_pars_fragment> 2906#include <bsdfs> 2907#include <lights_pars_begin> 2908#include <normal_pars_fragment> 2909#include <lights_lambert_pars_fragment> 2910#include <shadowmap_pars_fragment> 2911#include <bumpmap_pars_fragment> 2912#include <normalmap_pars_fragment> 2913#include <specularmap_pars_fragment> 2914#include <logdepthbuf_pars_fragment> 2915#include <clipping_planes_pars_fragment> 2916void main() { 2917 vec4 diffuseColor = vec4( diffuse, opacity ); 2918 #include <clipping_planes_fragment> 2919 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2920 vec3 totalEmissiveRadiance = emissive; 2921 #include <logdepthbuf_fragment> 2922 #include <map_fragment> 2923 #include <color_fragment> 2924 #include <alphamap_fragment> 2925 #include <alphatest_fragment> 2926 #include <alphahash_fragment> 2927 #include <specularmap_fragment> 2928 #include <normal_fragment_begin> 2929 #include <normal_fragment_maps> 2930 #include <emissivemap_fragment> 2931 #include <lights_lambert_fragment> 2932 #include <lights_fragment_begin> 2933 #include <lights_fragment_maps> 2934 #include <lights_fragment_end> 2935 #include <aomap_fragment> 2936 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2937 #include <envmap_fragment> 2938 #include <opaque_fragment> 2939 #include <tonemapping_fragment> 2940 #include <colorspace_fragment> 2941 #include <fog_fragment> 2942 #include <premultiplied_alpha_fragment> 2943 #include <dithering_fragment> 2944}`,Ch=`#define MATCAP 2945varying vec3 vViewPosition; 2946#include <common> 2947#include <batching_pars_vertex> 2948#include <uv_pars_vertex> 2949#include <color_pars_vertex> 2950#include <displacementmap_pars_vertex> 2951#include <fog_pars_vertex> 2952#include <normal_pars_vertex> 2953#include <morphtarget_pars_vertex> 2954#include <skinning_pars_vertex> 2955#include <logdepthbuf_pars_vertex> 2956#include <clipping_planes_pars_vertex> 2957void main() { 2958 #include <uv_vertex> 2959 #include <color_vertex> 2960 #include <morphinstance_vertex> 2961 #include <morphcolor_vertex> 2962 #include <batching_vertex> 2963 #include <beginnormal_vertex> 2964 #include <morphnormal_vertex> 2965 #include <skinbase_vertex> 2966 #include <skinnormal_vertex> 2967 #include <defaultnormal_vertex> 2968 #include <normal_vertex> 2969 #include <begin_vertex> 2970 #include <morphtarget_vertex> 2971 #include <skinning_vertex> 2972 #include <displacementmap_vertex> 2973 #include <project_vertex> 2974 #include <logdepthbuf_vertex> 2975 #include <clipping_planes_vertex> 2976 #include <fog_vertex> 2977 vViewPosition = - mvPosition.xyz; 2978}`,Ph=`#define MATCAP 2979uniform vec3 diffuse; 2980uniform float opacity; 2981uniform sampler2D matcap; 2982varying vec3 vViewPosition; 2983#include <common> 2984#include <dithering_pars_fragment> 2985#include <color_pars_fragment> 2986#include <uv_pars_fragment> 2987#include <map_pars_fragment> 2988#include <alphamap_pars_fragment> 2989#include <alphatest_pars_fragment> 2990#include <alphahash_pars_fragment> 2991#include <fog_pars_fragment> 2992#include <normal_pars_fragment> 2993#include <bumpmap_pars_fragment> 2994#include <normalmap_pars_fragment> 2995#include <logdepthbuf_pars_fragment> 2996#include <clipping_planes_pars_fragment> 2997void main() { 2998 ve
2998c4 diffuseColor = vec4( diffuse, opacity ); 2999 #include <clipping_planes_fragment> 3000 #include <logdepthbuf_fragment> 3001 #include <map_fragment> 3002 #include <color_fragment> 3003 #include <alphamap_fragment> 3004 #include <alphatest_fragment> 3005 #include <alphahash_fragment> 3006 #include <normal_fragment_begin> 3007 #include <normal_fragment_maps> 3008 vec3 viewDir = normalize( vViewPosition ); 3009 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3010 vec3 y = cross( viewDir, x ); 3011 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3012 #ifdef USE_MATCAP 3013 vec4 matcapColor = texture2D( matcap, uv ); 3014 #else 3015 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3016 #endif 3017 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3018 #include <opaque_fragment> 3019 #include <tonemapping_fragment> 3020 #include <colorspace_fragment> 3021 #include <fog_fragment> 3022 #include <premultiplied_alpha_fragment> 3023 #include <dithering_fragment> 3024}`,Dh=`#define NORMAL 3025#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3026 varying vec3 vViewPosition; 3027#endif 3028#include <common> 3029#include <batching_pars_vertex> 3030#include <uv_pars_vertex> 3031#include <displacementmap_pars_vertex> 3032#include <normal_pars_vertex> 3033#include <morphtarget_pars_vertex> 3034#include <skinning_pars_vertex> 3035#include <logdepthbuf_pars_vertex> 3036#include <clipping_planes_pars_vertex> 3037void main() { 3038 #include <uv_vertex> 3039 #include <batching_vertex> 3040 #include <beginnormal_vertex> 3041 #include <morphinstance_vertex> 3042 #include <morphnormal_vertex> 3043 #include <skinbase_vertex> 3044 #include <skinnormal_vertex> 3045 #include <defaultnormal_vertex> 3046 #include <normal_vertex> 3047 #include <begin_vertex> 3048 #include <morphtarget_vertex> 3049 #include <skinning_vertex> 3050 #include <displacementmap_vertex> 3051 #include <project_vertex> 3052 #include <logdepthbuf_vertex> 3053 #include <clipping_planes_vertex> 3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3055 vViewPosition = - mvPosition.xyz; 3056#endif 3057}`,Lh=`#define NORMAL 3058uniform float opacity; 3059#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3060 varying vec3 vViewPosition; 3061#endif 3062#include <packing> 3063#include <uv_pars_fragment> 3064#include <normal_pars_fragment> 3065#include <bumpmap_pars_fragment> 3066#include <normalmap_pars_fragment> 3067#include <logdepthbuf_pars_fragment> 3068#include <clipping_planes_pars_fragment> 3069void main() { 3070 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3071 #include <clipping_planes_fragment> 3072 #include <logdepthbuf_fragment> 3073 #include <normal_fragment_begin> 3074 #include <normal_fragment_maps> 3075 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3076 #ifdef OPAQUE 3077 gl_FragColor.a = 1.0; 3078 #endif 3079}`,Uh=`#define PHONG 3080varying vec3 vViewPosition; 3081#include <common> 3082#include <batching_pars_vertex> 3083#include <uv_pars_vertex> 3084#include <displacementmap_pars_vertex> 3085#include <envmap_pars_vertex> 3086#include <color_pars_vertex> 3087#include <fog_pars_vertex> 3088#include <normal_pars_vertex> 3089#include <morphtarget_pars_vertex> 3090#include <skinning_pars_vertex> 3091#include <shadowmap_pars_vertex> 3092#include <logdepthbuf_pars_vertex> 3093#include <clipping_planes_pars_vertex> 3094void main() { 3095 #include <uv_vertex> 3096 #include <color_vertex> 3097 #include <morphcolor_vertex> 3098 #include <batching_vertex> 3099 #include <beginnormal_vertex> 3100 #include <morphinstance_vertex> 3101 #include <morphnormal_vertex> 3102 #include <skinbase_vertex> 3103 #include <skinnormal_vertex> 3104 #include <defaultnormal_vertex> 3105 #include <normal_vertex> 3106 #include <begin_vertex> 3107 #include <morphtarget_vertex> 3108 #include <skinning_vertex> 3109 #include <displacementmap_vertex> 3110 #include <project_vertex> 3111 #include <logdepthbuf_vertex> 3112 #include <clipping_planes_vertex> 3113 vViewPosition = - mvPosition.xyz; 3114 #include <worldpos_vertex> 3115 #include <envmap_vertex> 3116 #include <shadowmap_vertex> 3117 #include <fog_vertex> 3118}`,Ih=`#define PHONG 3119uniform vec3 diffuse; 3120uniform vec3 emissive; 3121uniform vec3 specular; 3122uniform float shininess; 3123uniform float opacity; 3124#include <common> 3125#include <packing> 3126#include <dithering_pars_fragment> 3127#include <color_pars_fragment> 3128#include <uv_pars_fragment> 3129#include <map_pars_fragment> 3130#include <alphamap_pars_fragment> 3131#include <alphatest_pars_fragment> 3132#include <alphahash_pars_fragment> 3133#include <aomap_pars_fragment> 3134#include <lightmap_pars_fragment> 3135#include <emissivemap_pars_fragment> 3136#include <envmap_common_pars_fragment> 3137#include <envmap_pars_fragment> 3138#include <fog_pars_fragment> 3139#include <bsdfs> 3140#include <lights_pars_begin> 3141#include <normal_pars_fragment> 3142#include <lights_phong_pars_fragment> 3143#include <shadowmap_pars_fragment> 3144#include <bumpmap_pars_fragment> 3145#include <normalmap_pars_fragment> 3146#include <specularmap_pars_fragment> 3147#include <logdepthbuf_pars_fragment> 3148#include <clipping_planes_pars_fragment> 3149void main() { 3150 vec4 diffuseColor = vec4( diffuse, opacity ); 3151 #include <clipping_planes_fragment> 3152 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3153 vec3 totalEmissiveRadiance = emissive; 3154 #include <logdepthbuf_fragment> 3155 #include <map_fragment> 3156 #include <color_fragment> 3157 #include <alphamap_fragment> 3158 #include <alphatest_fragment> 3159 #include <alphahash_fragment> 3160 #include <specularmap_fragment> 3161 #include <normal_fragment_begin> 3162 #include <normal_fragment_maps> 3163 #include <emissivemap_fragment> 3164 #include <lights_phong_fragment> 3165 #include <lights_fragment_begin> 3166 #include <lights_fragment_maps> 3167 #include <lights_fragment_end> 3168 #include <aomap_fragment> 3169 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3170 #include <envmap_fragment> 3171 #include <opaque_fragment> 3172 #include <tonemapping_fragment> 3173 #include <colorspace_fragment> 3174 #include <fog_fragment> 3175 #include <premultiplied_alpha_fragment> 3176 #include <dithering_fragment> 3177}`,Nh=`#define STANDARD 3178varying vec3 vViewPosition; 3179#ifdef USE_TRANSMISSION 3180 varying vec3 vWorldPosition; 3181#endif 3182#include <common> 3183#include <batching_pars_vertex> 3184#include <uv_pars_vertex> 3185#include <displacementmap_pars_vertex> 3186#include <color_pars_vertex> 3187#include <fog_pars_vertex> 3188#include <normal_pars_vertex> 3189#include <morphtarget_pars_vertex> 3190#include <skinning_pars_vertex> 3191#include <shadowmap_pars_vertex> 3192#include <logdepthbuf_pars_vertex> 3193#include <clipping_planes_pars_vertex> 3194void main() { 3195 #include <uv_vertex> 3196 #include <color_vertex> 3197 #include <morphinstance_vertex> 3198 #include <morphcolor_vertex> 3199 #include <batching_vertex> 3200 #include <beginnormal_vertex> 3201 #include <morphnormal_vertex> 3202 #include <skinbase_vertex> 3203 #include <skinnormal_vertex> 3204 #include <defaultnormal_vertex> 3205 #include <normal_vertex> 3206 #include <begin_vertex> 3207 #include <morphtarget_vertex> 3208 #include <skinning_vertex> 3209 #include <displacementmap_vertex> 3210 #include <project_vertex> 3211 #include <logdepthbuf_vertex> 3212 #include <clipping_planes_vertex> 3213 vViewPosition = - mvPosition.xyz; 3214 #include <worldpos_vertex> 3215 #include <shadowmap_vertex> 3216 #include <fog_vertex> 3217#ifdef USE_TRANSMISSION 3218 vWorldPosition = worldPosition.xyz; 3219#endif 3220}`,Fh=`#define STANDARD 3221#ifdef PHYSICAL 3222 #define IOR 3223 #define USE_SPECULAR 3224#endif 3225uniform vec3 diffuse; 3226uniform vec3 emissive; 3227uniform float roughness; 3228uniform float metalness; 3229uniform float opacity; 3230#ifdef IOR 3231 uniform float ior; 3232#endif 3233#ifdef USE_SPECULAR 3234 uniform float specularIntensity; 3235 uniform vec3 specularColor; 3236 #ifdef USE_SPECULAR_COLORMAP 3237 uniform sampler2D specularColorMap; 3238 #endif 3239 #ifdef USE_SPECULAR_INTENSITYMAP 3240 uniform sampler2D specularIntensityMap; 3241 #endif 3242#endif 3243#ifdef USE_CLEARCOAT 3244 uniform float clearcoat; 3245 uniform float clearcoatRoughness; 3246#endif 3247#ifdef USE_DISPERSION 3248 uniform float dispersion; 3249#endif
3250#ifdef USE_IRIDESCENCE 3251 uniform float iridescence; 3252 uniform float iridescenceIOR; 3253 uniform float iridescenceThicknessMinimum; 3254 uniform float iridescenceThicknessMaximum; 3255#endif 3256#ifdef USE_SHEEN 3257 uniform vec3 sheenColor; 3258 uniform float sheenRoughness; 3259 #ifdef USE_SHEEN_COLORMAP 3260 uniform sampler2D sheenColorMap; 3261 #endif 3262 #ifdef USE_SHEEN_ROUGHNESSMAP 3263 uniform sampler2D sheenRoughnessMap; 3264 #endif 3265#endif 3266#ifdef USE_ANISOTROPY 3267 uniform vec2 anisotropyVector; 3268 #ifdef USE_ANISOTROPYMAP 3269 uniform sampler2D anisotropyMap; 3270 #endif 3271#endif 3272varying vec3 vViewPosition; 3273#include <common> 3274#include <packing> 3275#include <dithering_pars_fragment> 3276#include <color_pars_fragment> 3277#include <uv_pars_fragment> 3278#include <map_pars_fragment> 3279#include <alphamap_pars_fragment> 3280#include <alphatest_pars_fragment> 3281#include <alphahash_pars_fragment> 3282#include <aomap_pars_fragment> 3283#include <lightmap_pars_fragment> 3284#include <emissivemap_pars_fragment> 3285#include <iridescence_fragment> 3286#include <cube_uv_reflection_fragment> 3287#include <envmap_common_pars_fragment> 3288#include <envmap_physical_pars_fragment> 3289#include <fog_pars_fragment> 3290#include <lights_pars_begin> 3291#include <normal_pars_fragment> 3292#include <lights_physical_pars_fragment> 3293#include <transmission_pars_fragment> 3294#include <shadowmap_pars_fragment> 3295#include <bumpmap_pars_fragment> 3296#include <normalmap_pars_fragment> 3297#include <clearcoat_pars_fragment> 3298#include <iridescence_pars_fragment> 3299#include <roughnessmap_pars_fragment> 3300#include <metalnessmap_pars_fragment> 3301#include <logdepthbuf_pars_fragment> 3302#include <clipping_planes_pars_fragment> 3303void main() { 3304 vec4 diffuseColor = vec4( diffuse, opacity ); 3305 #include <clipping_planes_fragment> 3306 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3307 vec3 totalEmissiveRadiance = emissive; 3308 #include <logdepthbuf_fragment> 3309 #include <map_fragment> 3310 #include <color_fragment> 3311 #include <alphamap_fragment> 3312 #include <alphatest_fragment> 3313 #include <alphahash_fragment> 3314 #include <roughnessmap_fragment> 3315 #include <metalnessmap_fragment> 3316 #include <normal_fragment_begin> 3317 #include <normal_fragment_maps> 3318 #include <clearcoat_normal_fragment_begin> 3319 #include <clearcoat_normal_fragment_maps> 3320 #include <emissivemap_fragment> 3321 #include <lights_physical_fragment> 3322 #include <lights_fragment_begin> 3323 #include <lights_fragment_maps> 3324 #include <lights_fragment_end> 3325 #include <aomap_fragment> 3326 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3327 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3328 #include <transmission_fragment> 3329 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3330 #ifdef USE_SHEEN 3331 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3332 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3333 #endif 3334 #ifdef USE_CLEARCOAT 3335 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3336 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3337 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3338 #endif 3339 #include <opaque_fragment> 3340 #include <tonemapping_fragment> 3341 #include <colorspace_fragment> 3342 #include <fog_fragment> 3343 #include <premultiplied_alpha_fragment> 3344 #include <dithering_fragment> 3345}`,Oh=`#define TOON 3346varying vec3 vViewPosition; 3347#include <common> 3348#include <batching_pars_vertex> 3349#include <uv_pars_vertex> 3350#include <displacementmap_pars_vertex> 3351#include <color_pars_vertex> 3352#include <fog_pars_vertex> 3353#include <normal_pars_vertex> 3354#include <morphtarget_pars_vertex> 3355#include <skinning_pars_vertex> 3356#include <shadowmap_pars_vertex> 3357#include <logdepthbuf_pars_vertex> 3358#include <clipping_planes_pars_vertex> 3359void main() { 3360 #include <uv_vertex> 3361 #include <color_vertex> 3362 #include <morphinstance_vertex> 3363 #include <morphcolor_vertex> 3364 #include <batching_vertex> 3365 #include <beginnormal_vertex> 3366 #include <morphnormal_vertex> 3367 #include <skinbase_vertex> 3368 #include <skinnormal_vertex> 3369 #include <defaultnormal_vertex> 3370 #include <normal_vertex> 3371 #include <begin_vertex> 3372 #include <morphtarget_vertex> 3373 #include <skinning_vertex> 3374 #include <displacementmap_vertex> 3375 #include <project_vertex> 3376 #include <logdepthbuf_vertex> 3377 #include <clipping_planes_vertex> 3378 vViewPosition = - mvPosition.xyz; 3379 #include <worldpos_vertex> 3380 #include <shadowmap_vertex> 3381 #include <fog_vertex> 3382}`,Bh=`#define TOON 3383uniform vec3 diffuse; 3384uniform vec3 emissive; 3385uniform float opacity; 3386#include <common> 3387#include <packing> 3388#include <dithering_pars_fragment> 3389#include <color_pars_fragment> 3390#include <uv_pars_fragment> 3391#include <map_pars_fragment> 3392#include <alphamap_pars_fragment> 3393#include <alphatest_pars_fragment> 3394#include <alphahash_pars_fragment> 3395#include <aomap_pars_fragment> 3396#include <lightmap_pars_fragment> 3397#include <emissivemap_pars_fragment> 3398#include <gradientmap_pars_fragment> 3399#include <fog_pars_fragment> 3400#include <bsdfs> 3401#include <lights_pars_begin> 3402#include <normal_pars_fragment> 3403#include <lights_toon_pars_fragment> 3404#include <shadowmap_pars_fragment> 3405#include <bumpmap_pars_fragment> 3406#include <normalmap_pars_fragment> 3407#include <logdepthbuf_pars_fragment> 3408#include <clipping_planes_pars_fragment> 3409void main() { 3410 vec4 diffuseColor = vec4( diffuse, opacity ); 3411 #include <clipping_planes_fragment> 3412 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3413 vec3 totalEmissiveRadiance = emissive; 3414 #include <logdepthbuf_fragment> 3415 #include <map_fragment> 3416 #include <color_fragment> 3417 #include <alphamap_fragment> 3418 #include <alphatest_fragment> 3419 #include <alphahash_fragment> 3420 #include <normal_fragment_begin> 3421 #include <normal_fragment_maps> 3422 #include <emissivemap_fragment> 3423 #include <lights_toon_fragment> 3424 #include <lights_fragment_begin> 3425 #include <lights_fragment_maps> 3426 #include <lights_fragment_end> 3427 #include <aomap_fragment> 3428 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3429 #include <opaque_fragment> 3430 #include <tonemapping_fragment> 3431 #include <colorspace_fragment> 3432 #include <fog_fragment> 3433 #include <premultiplied_alpha_fragment> 3434 #include <dithering_fragment> 3435}`,zh=`uniform float size; 3436uniform float scale; 3437#include <common> 3438#include <color_pars_vertex> 3439#include <fog_pars_vertex> 3440#include <morphtarget_pars_vertex> 3441#include <logdepthbuf_pars_vertex> 3442#include <clipping_planes_pars_vertex> 3443#ifdef USE_POINTS_UV 3444 varying vec2 vUv; 3445 uniform mat3 uvTransform; 3446#endif 3447void main() { 3448 #ifdef USE_POINTS_UV 3449 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3450 #endif 3451 #include <color_vertex> 3452 #include <morphinstance_vertex> 3453 #include <morphcolor_vertex> 3454 #include <begin_vertex> 3455 #include <morphtarget_vertex> 3456 #include <project_vertex> 3457 gl_PointSize = size; 3458 #ifdef USE_SIZEATTENUATION 3459 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3460 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3461 #endif 3462 #include <logdepthbuf_vertex> 3463 #include <clipping_planes_vertex> 3464 #include <worldpos_vertex> 3465 #include <fog_vertex> 3466}`,Hh=`uniform vec3 diffuse; 3467uniform float opacity; 3468#include <common> 3469#include <color_pars_fragment> 3470#include <map_particle_pars_fragment> 3471#include <alphatest_pars_fragment> 3472#include <alphahash_pars_fragment> 3473#include <fog_pars_fragment> 3474#include <logdepthbuf_pars_fragment> 3475#include <clipping_planes_pars_fragment> 3476void main() { 3477 vec4 diffuseColor = vec4( diffuse, opacity ); 3478 #include <clipping_planes_fragment> 3479 vec3 outgoingLight = vec3( 0.0 ); 3480 #include <logdepthbuf_fragment> 3481 #include <map_particle_fragment> 3482 #include <color_fragment> 3483 #include <alphatest_fragment> 3484 #include <alphahash_fragment> 3485 outgoingLight = diffuseColor.rgb; 3486 #include <opaque_fragment> 3487 #include <tonemapping_fragment> 3488 #include <colorspace_fragment> 3489 #include <fog_fragment> 3490 #include <premultiplied_alpha_fragment> 3491}`,Vh=`#include <common> 3492#include <batching_pars_vertex> 3493#include <fog_pars_vertex> 3494#include <morphtarget_pars_vertex> 3495#include <skinning_pars_vertex> 3496#include <logdepthbuf_pars_vertex> 3497#include <shadowmap_pars_vertex> 3498void main() { 3499 #include <batching_vertex> 3500 #include <beginnormal_vertex> 3501 #include <morphinstance_vertex> 3502 #include <morphnormal_vertex> 3503 #include <skinbase_vertex> 3504 #include <skinnormal_vertex> 3505 #include <defaultnormal_vertex> 3506 #include <begin_vertex> 3507 #include <morphtarget_vertex> 3508 #include <skinning_vertex> 3509 #include <project_vertex> 3510 #include <logdepthbuf_vertex> 3511 #include <worldpos_vertex> 3512 #include <shadowmap_vertex> 3513 #include <fog_vertex> 3514}`,Gh=`uniform vec3 color; 3515uniform float opacity; 3516#include <common> 3517#include <packing> 3518#include <fog_pars_fragment> 3519#include <bsdfs> 3520#include <lights_pars_begin> 3521#include <logdepthbuf_pars_fragment> 3522#include <shadowmap_pars_fragment> 3523#include <shadowmask_pars_fragment> 3524void main() { 3525 #include <logdepthbuf_fragment> 3526 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3527 #include <tonemapping_fragment> 3528 #include <colorspace_fragment> 3529 #include <fog_fragment> 3530}`,kh=`uniform float rotation; 3531uniform vec2 center; 3532#include <common> 3533#include <uv_pars_vertex> 3534#include <fog_pars_vertex> 3535#include <logdepthbuf_pars_vertex> 3536#include <clipping_planes_pars_vertex> 3537void main() { 3538 #include <uv_vertex> 3539 vec4 mvPosition = modelViewMatrix[ 3 ]; 3540 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3541 #ifndef USE_SIZEATTENUATION 3542 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3543 if ( isPerspective ) scale *= - mvPosition.z; 3544 #endif 3545 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3546 vec2 rotatedPosition; 3547 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3548 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3549 mvPosition.xy += rotatedPosition; 3550 gl_Position = projectionMatrix * mvPosition; 3551 #include <logdepthbuf_vertex> 3552 #include <clipping_planes_vertex> 3553 #include <fog_vertex> 3554}`,Wh=`uniform vec3 diffuse; 3555uniform float opacity; 3556#include <common> 3557#include <uv_pars_fragment> 3558#include <map_pars_fragment> 3559#include <alphamap_pars_fragment> 3560#include <alphatest_pars_fragment> 3561#include <alphahash_pars_fragment> 3562#include <fog_pars_fragment> 3563#include <logdepthbuf_pars_fragment> 3564#include <clipping_planes_pars_fragment> 3565void main() { 3566 vec4 diffuseColor = vec4( diffuse, opacity ); 3567 #include <clipping_planes_fragment> 3568 vec3 outgoingLight = vec3( 0.0 ); 3569 #include <logdepthbuf_fragment> 3570 #include <map_fragment> 3571 #include <alphamap_fragment> 3572 #include <alphatest_fragment> 3573 #include <alphahash_fragment> 3574 outgoingLight = diffuseColor.rgb; 3575 #include <opaque_fragment> 3576 #include <tonemapping_fragment> 3577 #include <colorspace_fragment> 3578 #include <fog_fragment> 3579}`,De={alphahash_fragment:fc,alphahash_pars_fragment:dc,alphamap_fragment:pc,alphamap_pars_fragment:mc,alphatest_fragment:_c,alphatest_pars_fragment:gc,aomap_fragment:vc,aomap_pars_fragment:xc,batching_pars_vertex:Mc,batching_vertex:Sc,begin_vertex:Ec,beginnormal_vertex:yc,bsdfs:Tc,iridescence_fragment:Ac,bumpmap_pars_fragment:bc,clipping_planes_fragment:Rc,clipping_planes_pars_fragment:wc,clipping_planes_pars_vertex:Cc,clipping_planes_vertex:Pc,color_fragment:Dc,color_pars_fragment:Lc,color_pars_vertex:Uc,color_vertex:Ic,common:Nc,
vendor: 6,868 bytes, line 3579
3579cube_uv_reflection_fragment:Fc,defaultnormal_vertex:Oc,displacementmap_pars_vertex:Bc,displacementmap_vertex:zc,emissivemap_fragment:Hc,emissivemap_pars_fragment:Vc,colorspace_fragment:Gc,colorspace_pars_fragment:kc,envmap_fragment:Wc,envmap_common_pars_fragment:Xc,envmap_pars_fragment:qc,envmap_pars_vertex:Yc,envmap_physical_pars_fragment:ru,envmap_vertex:Zc,fog_vertex:Kc,fog_pars_vertex:$c,fog_fragment:jc,fog_pars_fragment:Jc,gradientmap_pars_fragment:Qc,lightmap_pars_fragment:eu,lights_lambert_fragment:tu,lights_lambert_pars_fragment:nu,lights_pars_begin:iu,lights_toon_fragment:su,lights_toon_pars_fragment:au,lights_phong_fragment:ou,lights_phong_pars_fragment:lu,lights_physical_fragment:cu,lights_physical_pars_fragment:uu,lights_fragment_begin:hu,lights_fragment_maps:fu,lights_fragment_end:du,logdepthbuf_fragment:pu,logdepthbuf_pars_fragment:mu,logdepthbuf_pars_vertex:_u,logdepthbuf_vertex:gu,map_fragment:vu,map_pars_fragment:xu,map_particle_fragment:Mu,map_particle_pars_fragment:Su,metalnessmap_fragment:Eu,metalnessmap_pars_fragment:yu,morphinstance_vertex:Tu,morphcolor_vertex:Au,morphnormal_vertex:bu,morphtarget_pars_vertex:Ru,morphtarget_vertex:wu,normal_fragment_begin:Cu,normal_fragment_maps:Pu,normal_pars_fragment:Du,normal_pars_vertex:Lu,normal_vertex:Uu,normalmap_pars_fragment:Iu,clearcoat_normal_fragment_begin:Nu,clearcoat_normal_fragment_maps:Fu,clearcoat_pars_fragment:Ou,iridescence_pars_fragment:Bu,opaque_fragment:zu,packing:Hu,premultiplied_alpha_fragment:Vu,project_vertex:Gu,dithering_fragment:ku,dithering_pars_fragment:Wu,roughnessmap_fragment:Xu,roughnessmap_pars_fragment:qu,shadowmap_pars_fragment:Yu,shadowmap_pars_vertex:Zu,shadowmap_vertex:Ku,shadowmask_pars_fragment:$u,skinbase_vertex:ju,skinning_pars_vertex:Ju,skinning_vertex:Qu,skinnormal_vertex:eh,specularmap_fragment:th,specularmap_pars_fragment:nh,tonemapping_fragment:ih,tonemapping_pars_fragment:rh,transmission_fragment:sh,transmission_pars_fragment:ah,uv_pars_fragment:oh,uv_pars_vertex:lh,uv_vertex:ch,worldpos_vertex:uh,background_vert:hh,background_frag:fh,backgroundCube_vert:dh,backgroundCube_frag:ph,cube_vert:mh,cube_frag:_h,depth_vert:gh,depth_frag:vh,distanceRGBA_vert:xh,distanceRGBA_frag:Mh,equirect_vert:Sh,equirect_frag:Eh,linedashed_vert:yh,linedashed_frag:Th,meshbasic_vert:Ah,meshbasic_frag:bh,meshlambert_vert:Rh,meshlambert_frag:wh,meshmatcap_vert:Ch,meshmatcap_frag:Ph,meshnormal_vert:Dh,meshnormal_frag:Lh,meshphong_vert:Uh,meshphong_frag:Ih,meshphysical_vert:Nh,meshphysical_frag:Fh,meshtoon_vert:Oh,meshtoon_frag:Bh,points_vert:zh,points_frag:Hh,shadow_vert:Vh,shadow_frag:Gh,sprite_vert:kh,sprite_frag:Wh},te={common:{diffuse:{value:new Ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ce}},envmap:{envMap:{value:null},envMapRotation:{value:new Ce},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ce}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ce}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ce},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ce},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ce},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ce}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ce}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ce}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ye(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0},uvTransform:{value:new Ce}},sprite:{diffuse:{value:new Ye(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}}},Ht={basic:{uniforms:gt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.fog]),vertexShader:De.meshbasic_vert,fragmentShader:De.meshbasic_frag},lambert:{uniforms:gt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.fog,te.lights,{emissive:{value:new Ye(0)}}]),vertexShader:De.meshlambert_vert,fragmentShader:De.meshlambert_frag},phong:{uniforms:gt([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.fog,te.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30}}]),vertexShader:De.meshphong_vert,fragmentShader:De.meshphong_frag},standard:{uniforms:gt([te.common,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.roughnessmap,te.metalnessmap,te.fog,te.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:De.meshphysical_vert,fragmentShader:De.meshphysical_frag},toon:{uniforms:gt([te.common,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.gradientmap,te.fog,te.lights,{emissive:{value:new Ye(0)}}]),vertexShader:De.meshtoon_vert,fragmentShader:De.meshtoon_frag},matcap:{uniforms:gt([te.common,te.bumpmap,te.normalmap,te.displacementmap,te.fog,{matc
vendor: 5,263 bytes, line 3579
3579ap:{value:null}}]),vertexShader:De.meshmatcap_vert,fragmentShader:De.meshmatcap_frag},points:{uniforms:gt([te.points,te.fog]),vertexShader:De.points_vert,fragmentShader:De.points_frag},dashed:{uniforms:gt([te.common,te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:De.linedashed_vert,fragmentShader:De.linedashed_frag},depth:{uniforms:gt([te.common,te.displacementmap]),vertexShader:De.depth_vert,fragmentShader:De.depth_frag},normal:{uniforms:gt([te.common,te.bumpmap,te.normalmap,te.displacementmap,{opacity:{value:1}}]),vertexShader:De.meshnormal_vert,fragmentShader:De.meshnormal_frag},sprite:{uniforms:gt([te.sprite,te.fog]),vertexShader:De.sprite_vert,fragmentShader:De.sprite_frag},background:{uniforms:{uvTransform:{value:new Ce},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:De.background_vert,fragmentShader:De.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ce}},vertexShader:De.backgroundCube_vert,fragmentShader:De.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:De.cube_vert,fragmentShader:De.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:De.equirect_vert,fragmentShader:De.equirect_frag},distanceRGBA:{uniforms:gt([te.common,te.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:De.distanceRGBA_vert,fragmentShader:De.distanceRGBA_frag},shadow:{uniforms:gt([te.lights,te.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:De.shadow_vert,fragmentShader:De.shadow_frag}};Ht.physical={uniforms:gt([Ht.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ce},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ce},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ce},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ce},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ce},sheen:{value:0},sheenColor:{value:new Ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ce},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ce},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ce},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ce},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ce},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ce},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ce}}]),vertexShader:De.meshphysical_vert,fragmentShader:De.meshphysical_frag};const Ji={r:0,b:0,g:0},yn=new nn,Xh=new st;function qh(i,e,t,n,r,s,a){const o=new Ye(0);let l=s===!0?0:1,c,h,d=null,f=0,m=null;function v(T){let E=T.isScene===!0?T.background:null;return E&&E.isTexture&&(E=(T.backgroundBlurriness>0?t:e).get(E)),E}function M(T){let E=!1;const U=v(T);U===null?u(o,l):U&&U.isColor&&(u(U,1),E=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?n.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function p(T,E){const U=v(E);U&&(U.isCubeTexture||U.mapping===hr)?(h===void 0&&(h=new Qt(new Ri(1,1,1),new mn({name:"BackgroundCubeMaterial",uniforms:ui(Ht.backgroundCube.uniforms),vertexShader:Ht.backgroundCube.vertexShader,fragmentShader:Ht.backgroundCube.fragmentShader,side:Mt,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(R,w,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),yn.copy(E.backgroundRotation),yn.x*=-1,yn.y*=-1,yn.z*=-1,U.isCubeTexture&&U.isRenderTargetTexture===!1&&(yn.y*=-1,yn.z*=-1),h.material.uniforms.envMap.value=U,h.material.uniforms.flipEnvMap.value=U.isCubeTexture&&U.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Xh.makeRotationFromEuler(yn)),h.material.toneMapped=ke.getTransfer(U.colorSpace)!==Ze,(d!==U||f!==U.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,d=U,f=U.version,m=i.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):U&&U.isTexture&&(c===void 0&&(c=new Qt(new fr(2,2),new mn({name:"Backgroun
3579dMaterial",uniforms:ui(Ht.background.uniforms),vertexShader:Ht.background.vertexShader,fragmentShader:Ht.background.fragmentShader,side:pn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=U,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=ke.getTransfer(U.colorSpace)!==Ze,U.matrixAutoUpdate===!0&&U.updateMatrix(),c.material.uniforms.uvTransform.value.copy(U.matrix),(d!==U||f!==U.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,d=U,f=U.version,m=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function u(T,E){T.getRGB(Ji,xo(i)),n.buffers.color.setClear(Ji.r,Ji.g,Ji.b,E,a)}function A(){h!==void 0&&(h.geometry.dispose(),h.material.dispose()),c!==void 0&&(c.geometry.dispose(),c.material.dispose())}return{getClearColor:function(){return o},setClearColor:function(T,E=1){o.set(T),l=E,u(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,u(o,l)},render:M,addToRenderList:p,dispose:A}}function Yh(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(x,C,q,z,W){let $=!1;const G=d(z,q,C);s!==G&&(s=G,c(s.object)),$=m(x,z,q,W),$&&v(x,z,q,W),W!==null&&e.update(W,i.ELEMENT_ARRAY_BUFFER),($||a)&&(a=!1,E(x,C,q,z),W!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(W).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function d(x,C,q){const z=q.wireframe===!0;let W=n[x.id];W===void 0&&(W={},n[x.id]=W);let $=W[C.id];$===void 0&&($={},W[C.id]=$);let G=$[z];return G===void 0&&(G=f(l()),$[z]=G),G}function f(x){const C=[],q=[],z=[];for(let W=0;W<t;W++)C[W]=0,q[W]=0,z[W]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:q,attributeDivisors:z,object:x,attributes:{},index:null}}function m(x,C,q,z){const W=s.attributes,$=C.attributes;let G=0;const Q=q.getAttributes();for(const V in Q)if(Q[V].location>=0){const ue=W[V];let ge=$[V];if(ge===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(ge=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(ge=x.instanceColor)),ue===void 0||ue.attribute!==ge||ge&&ue.data!==ge.data)return!0;G++}return s.attributesNum!==G||s.index!==z}function v(x,C,q,z){const W={},$=C.attributes;let G=0;const Q=q.getAttributes();for(const V in Q)if(Q[V].location>=0){let ue=$[V];ue===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(ue=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(ue=x.instanceColor));const ge={};ge.attribute=ue,ue&&ue.data&&(ge.data=ue.data),W[V]=ge,G++}s.attributes=W,s.attributesNum=G,s.index=z}function M(){const x=s.newAttributes;for(let C=0,q=x.length;C<q;C++)x[C]=0}function p(x){u(x,0)}function u(x,C){const q=s.newAttributes,z=s.enabledAttributes,W=s.attributeDivisors;q[x]=1,z[x]===0&&(i.enableVertexAttribArray(x),z[x]=1),W[x]!==C&&(i.vertexAttribDivisor(x,C),W[x]=C)}function A(){const x=s.newAttributes,C=s.enabledAttributes;for(let q=0,z=C.length;q<z;q++)C[q]!==x[q]&&(i.disableVertexAttribArray(q),C[q]=0)}function T(x,C,q,z,W,$,G){G===!0?i.vertexAttribIPointer(x,C,q,W,$):i.vertexAttribPointer(x,C,q,z,W,$)}function E(x,C,q,z){M();const W=z.attributes,$=q.getAttributes(),G=C.defaultAttributeValues;for(const Q in $){const V=$[Q];if(V.location>=0){let re=W[Q];if(re===void 0&&(Q==="instanceMatrix"&&x.instanceMatrix&&(re=x.instanceMatrix),Q==="instanceColor"&&x.instanceColor&&(re=x.instanceColor)),re!==void 0){const ue=re.normalized,ge=re.itemSize,Le=e.get(re);if(Le===void 0)continue;const $e=Le.buffer,X=Le.type,ee=Le.bytesPerElement,me=X===i.INT||X===i.UNSIGNED_INT||re.gpuType===Os;if(re.isInterleavedBufferAttribute){const se=re.data,ye=se.stride,Re=re.offset;if(se.isInstancedInterleavedBuffer){for(let Ue=0;Ue<V.locationSize;Ue++)u(V.location+Ue,se.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Ue=0;Ue<V.locationSize;Ue++)p(V.location+Ue);i.bindBuffer(i.ARRAY_BUFFER,$e);for(let Ue=0;Ue<V.locationSize;Ue++)T(V.location+Ue,ge/V.locationSize,X,ue,ye*ee,(Re+ge/V.locationSize*Ue)*ee,me)}else{if(re.isInstancedBufferAttribute){for(let se=0;se<V.locationSize;se++)u(V.location+se,re.meshPerAttribute);x.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let se=0;se<V.locationSize;se++)p(V.location+se);i.bindBuffer(i.ARRAY_BUFFER,$e);for(let se=0;se<V.locationSize;se++)T(V.location+se,ge/V.locationSize,X,ue,ge*ee,ge/V.locationSize*se*ee,me)}}else if(G!==void 0){const ue=G[Q];if(ue!==void 0)switch(ue.length){case 2:i.vertexAttrib2fv(V.location,ue);break;case 3:i.vertexAttrib3fv(V.location,ue);break;case 4:i.vertexAttrib4fv(V.location,ue);break;default:i.vertexAttrib1fv(V.location,ue)}}}}A()}function U(){I();for(const x in n){const C=n[x];for(const q in C){const z=C[q];for(const W in z)h(z[W].object),delete z[W];delete C[q]}delete n[x]}}function R(x){if(n[x.id]===void 0)return;const C=n[x.id];for(const q in C){const z=C[q];for(const W in z)h(z[W].object),delete z[W];delete C[q]}delete n[x.id]}function w(x){for(const C in n){const q=n[C];if(q[x.id]===void 0)continue;const z=q[x.id];for(const W in z)h(z[W].object),delete z[W];delete q[x.id]}}function I(){S(),a=!0,s!==r&&(s=r,c(s.object))}function S(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:I,resetDefaultState:S,dispose:U,releaseStatesOfGeometry:R,releaseStatesOfProgram:w,initAttributes:M,enableAttribute:p,disableUnusedAttributes:A}}function Zh(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,d){d!==0&&(i.drawArraysInstanced(n,c,h,d),t.update(h,n,d))}function o(c,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,d);let m=0;for(let v=0;v<d;v++)m+=h[v];t.update(m,n,1)}function l(c,h,d,f){if(d===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<c.length;v++)a(c[v],h[v],f[v]);
vendor: 4,683 bytes, line 3579
3579else{m.multiDrawArraysInstancedWEBGL(n,c,0,h,0,f,0,d);let v=0;for(let M=0;M<d;M++)v+=h[M]*f[M];t.update(v,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Kh(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==Ot&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const I=w===yi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==tn&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==jt&&!I)}function l(w){if(w==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const d=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=i.getParameter(i.MAX_TEXTURE_SIZE),p=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),u=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),E=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),U=v>0,R=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:m,maxVertexTextures:v,maxTextureSize:M,maxCubemapSize:p,maxAttributes:u,maxVertexUniforms:A,maxVaryings:T,maxFragmentUniforms:E,vertexTextures:U,maxSamples:R}}function $h(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new An,o=new Ce,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const m=d.length!==0||f||n!==0||r;return r=f,n=d.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,f){t=h(d,f,0)},this.setState=function(d,f,m){const v=d.clippingPlanes,M=d.clipIntersection,p=d.clipShadows,u=i.get(d);if(!r||v===null||v.length===0||s&&!p)s?h(null):c();else{const A=s?0:n,T=A*4;let E=u.clippingState||null;l.value=E,E=h(v,f,T,m);for(let U=0;U!==T;++U)E[U]=t[U];u.clippingState=E,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,f,m,v){const M=d!==null?d.length:0;let p=null;if(M!==0){if(p=l.value,v!==!0||p===null){const u=m+M*4,A=f.matrixWorldInverse;o.getNormalMatrix(A),(p===null||p.length<u)&&(p=new Float32Array(u));for(let T=0,E=m;T!==M;++T,E+=4)a.copy(d[T]).applyMatrix4(A,o),a.normal.toArray(p,E),p[E+3]=a.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,p}}function jh(i){let e=new WeakMap;function t(a,o){return o===is?a.mapping=si:o===rs&&(a.mapping=ai),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===is||o===rs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Ql(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const ei=4,Aa=[.125,.215,.35,.446,.526,.582],wn=20,Hr=new lc,ba=new Ye;let Vr=null,Gr=0,kr=0,Wr=!1;const bn=(1+Math.sqrt(5))/2,Jn=1/bn,Ra=[new F(-bn,Jn,0),new F(bn,Jn,0),new F(-Jn,0,bn),new F(Jn,0,bn),new F(0,bn,-Jn),new F(0,bn,Jn),new F(-1,1,-1),new F(1,1,-1),new F(-1,1,1),new F(1,1,1)];class wa{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){Vr=this._renderer.getRenderTarget(),Gr=this._renderer.getActiveCubeFace(),kr=this._renderer.getActiveMipmapLevel(),Wr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();
vendor: 2,308 bytes, line 3579
3579return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Da(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Pa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Vr,Gr,kr),this._renderer.xr.enabled=Wr,e.scissorTest=!1,Qi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===si||e.mapping===ai?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Vr=this._renderer.getRenderTarget(),Gr=this._renderer.getActiveCubeFace(),kr=this._renderer.getActiveMipmapLevel(),Wr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Gt,minFilter:Gt,generateMipmaps:!1,type:yi,format:Ot,colorSpace:ci,depthBuffer:!1},r=Ca(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ca(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Jh(s)),this._blurMaterial=Qh(s,e,t)}return r}_compileMaterial(e){const t=new Qt(this._lodPlanes[0],e);this._renderer.compile(t,Hr)}_sceneToCubeUV(e,t,n,r){const o=new Pt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(ba),h.toneMapping=fn,h.autoClear=!1;
vendor: 5,418 bytes, lines 3579-3654
3579const m=new _o({name:"PMREM.Background",side:Mt,depthWrite:!1,depthTest:!1}),v=new Qt(new Ri,m);let M=!1;const p=e.background;p?p.isColor&&(m.color.copy(p),e.background=null,M=!0):(m.color.copy(ba),M=!0);for(let u=0;u<6;u++){const A=u%3;A===0?(o.up.set(0,l[u],0),o.lookAt(c[u],0,0)):A===1?(o.up.set(0,0,l[u]),o.lookAt(0,c[u],0)):(o.up.set(0,l[u],0),o.lookAt(0,0,c[u]));const T=this._cubeSize;Qi(r,A*T,u>2?T:0,T,T),h.setRenderTarget(r),M&&h.render(v,o),h.render(e,o)}v.geometry.dispose(),v.material.dispose(),h.toneMapping=f,h.autoClear=d,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===si||e.mapping===ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Da()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Pa());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Qt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Qi(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Hr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Ra[(r-s-1)%Ra.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new Qt(this._lodPlanes[r],c),f=c.uniforms,m=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*wn-1),M=s/v,p=isFinite(s)?1+Math.floor(h*M):wn;p>wn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${wn}`);const u=[];let A=0;for(let w=0;w<wn;++w){const I=w/M,S=Math.exp(-I*I/2);u.push(S),w===0?A+=S:w<p&&(A+=2*S)}for(let w=0;w<u.length;w++)u[w]=u[w]/A;f.envMap.value=e.texture,f.samples.value=p,f.weights.value=u,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:T}=this;f.dTheta.value=v,f.mipInt.value=T-n;const E=this._sizeLods[r],U=3*E*(r>T-ei?r-T+ei:0),R=4*(this._cubeSize-E);Qi(t,U,R,3*E,2*E),l.setRenderTarget(t),l.render(d,Hr)}}function Jh(i){const e=[],t=[],n=[];let r=i;const s=i-ei+1+Aa.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-ei?l=Aa[a-i+ei-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,d=1+c,f=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,v=6,M=3,p=2,u=1,A=new Float32Array(M*v*m),T=new Float32Array(p*v*m),E=new Float32Array(u*v*m);for(let R=0;R<m;R++){const w=R%3*2/3-1,I=R>2?0:-1,S=[w,I,0,w+2/3,I,0,w+2/3,I+1,0,w,I,0,w+2/3,I+1,0,w,I+1,0];A.set(S,M*v*R),T.set(f,p*v*R);const x=[R,R,R,R,R,R];E.set(x,u*v*R)}const U=new _n;U.setAttribute("position",new zt(A,M)),U.setAttribute("uv",new zt(T,p)),U.setAttribute("faceIndex",new zt(E,u)),e.push(U),r>ei&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Ca(i,e,t){const n=new Un(i,e,t);return n.texture.mapping=hr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Qi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Qh(i,e,t){const n=new Float32Array(wn),r=new F(0,1,0);return new mn({name:"SphericalGaussianBlur",defines:{n:wn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ws(),fragmentShader:` 3580 3581 precision mediump float; 3582 precision mediump int; 3583 3584 varying vec3 vOutputDirection; 3585 3586 uniform sampler2D envMap; 3587 uniform int samples; 3588 uniform float weights[ n ]; 3589 uniform bool latitudinal; 3590 uniform float dTheta; 3591 uniform float mipInt; 3592 uniform vec3 poleAxis; 3593 3594 #define ENVMAP_TYPE_CUBE_UV 3595 #include <cube_uv_reflection_fragment> 3596 3597 vec3 getSample( float theta, vec3 axis ) { 3598 3599 float cosTheta = cos( theta ); 3600 // Rodrigues' axis-angle rotation 3601 vec3 sampleDirection = vOutputDirection * cosTheta 3602 + cross( axis, vOutputDirection ) * sin( theta ) 3603 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3604 3605 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3606 3607 } 3608 3609 void main() { 3610 3611 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3612 3613 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3614 3615 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3616 3617 } 3618 3619 axis = normalize( axis ); 3620 3621 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3622 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3623 3624 for ( int i = 1; i < n; i++ ) { 3625 3626 if ( i >= samples ) { 3627 3628 break; 3629 3630 } 3631 3632 float theta = dTheta * float( i ); 3633 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3634 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3635 3636 } 3637 3638 } 3639 `,blending:hn,depthTest:!1,depthWrite:!1})}function Pa(){return new mn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ws(),fragmentShader:` 3640 3641 precision mediump float; 3642 precision mediump int; 3643 3644 varying vec3 vOutputDirection; 3645 3646 uniform sampler2D envMap; 3647 3648 #include <common> 3649 3650 void main() { 3651 3652 vec3 outputDirection = normalize( vOutputDirection ); 3653 vec2 uv = equirectUv( outputDirection ); 3654
3655 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3656 3657 } 3658 `,blending:hn,depthTest:!1,depthWrite:!1})}function Da(){return new mn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ws(),fragmentShader:` 3659 3660 precision mediump float; 3661 precision mediump int; 3662 3663 uniform float flipEnvMap; 3664 3665 varying vec3 vOutputDirection; 3666 3667 uniform samplerCube envMap; 3668 3669 void main() { 3670 3671 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3672 3673 } 3674 `,blending:hn,depthTest:!1,depthWrite:!1})}function Ws(){return` 3675 3676 precision mediump float; 3677 precision mediump int; 3678 3679 attribute float faceIndex; 3680 3681 varying vec3 vOutputDirection; 3682 3683 // RH coordinate system; PMREM face-indexing convention 3684 vec3 getDirection( vec2 uv, float face ) { 3685 3686 uv = 2.0 * uv - 1.0; 3687 3688 vec3 direction = vec3( uv, 1.0 ); 3689 3690 if ( face == 0.0 ) { 3691 3692 direction = direction.zyx; // ( 1, v, u ) pos x 3693 3694 } else if ( face == 1.0 ) { 3695 3696 direction = direction.xzy; 3697 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3698 3699 } else if ( face == 2.0 ) { 3700 3701 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3702 3703 } else if ( face == 3.0 ) { 3704 3705 direction = direction.zyx; 3706 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3707 3708 } else if ( face == 4.0 ) { 3709 3710 direction = direction.xzy; 3711 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3712 3713 } else if ( face == 5.0 ) { 3714 3715 direction.z *= -1.0; // ( u, v, -1 ) neg z 3716 3717 } 3718 3719 return direction; 3720 3721 } 3722 3723 void main() { 3724 3725 vOutputDirection = getDirection( uv, faceIndex ); 3726 gl_Position = vec4( position, 1.0 ); 3727 3728 } 3729 `}function ef(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===is||l===rs,h=l===si||l===ai;if(c||h){let d=e.get(o);const f=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new wa(i)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const m=o.image;return c&&m&&m.height>0||h&&m&&r(m)?(t===null&&(t=new wa(i)),d=c?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function tf(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Qn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function nf(i,e,t,n){const r={},s=new WeakMap;function a(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const v in f.attributes)e.remove(f.attributes[v]);f.removeEventListener("dispose",a),delete r[f.id];const m=s.get(f);m&&(e.remove(m),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(d,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(d){const f=d.attributes;for(const m in f)e.update(f[m],i.ARRAY_BUFFER)}function c(d){const f=[],m=d.index,v=d.attributes.position;let M=0;if(m!==null){const A=m.array;M=m.version;for(let T=0,E=A.length;T<E;T+=3){const U=A[T+0],R=A[T+1],w=A[T+2];f.push(U,R,R,w,w,U)}}else if(v!==void 0){const A=v.array;M=v.version;for(let T=0,E=A.length/3-1;T<E;T+=3){const U=T+0,R=T+1,w=T+2;f.push(U,R,R,w,w,U)}}else return;const p=new(uo(f)?vo:go)(f,1);p.version=M;const u=s.get(d);u&&e.remove(u),s.set(d,p)}function h(d){const f=s.get(d);if(f){const m=d.index;m!==null&&f.version<m.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function rf(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,m){i.drawElements(n,m,s,f*a),t.update(m,n,1)}function c(f,m,v){v!==0&&(i.drawElementsInstanced(n,m,s,f*a,v),t.update(m,n,v))}function h(f,m,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,m,0,s,f,0,v);let p=0;for(let u=0;u<v;u++)p+=m[u];t.update(p,n,1)}function d(f,m,v,M){if(v===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let u=0;u<f.length;u++)c(f[u]/a,m[u],M[u]);
vendor: 17,414 bytes, lines 3729-3764
3729else{p.multiDrawElementsInstancedWEBGL(n,m,0,s,f,0,M,0,v);let u=0;for(let A=0;A<v;A++)u+=m[A]*M[A];t.update(u,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function sf(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function af(i,e,t){const n=new WeakMap,r=new rt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0;let f=n.get(o);if(f===void 0||f.count!==d){let S=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",S)};f!==void 0&&f.texture.dispose();const m=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,M=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],A=o.morphAttributes.color||[];let T=0;m===!0&&(T=1),v===!0&&(T=2),M===!0&&(T=3);let E=o.attributes.position.count*T,U=1;E>e.maxTextureSize&&(U=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const R=new Float32Array(E*U*4*d),w=new fo(R,E,U,d);w.type=jt,w.needsUpdate=!0;const I=T*4;for(let x=0;x<d;x++){const C=p[x],q=u[x],z=A[x],W=E*U*4*x;for(let $=0;$<C.count;$++){const G=$*I;m===!0&&(r.fromBufferAttribute(C,$),R[W+G+0]=r.x,R[W+G+1]=r.y,R[W+G+2]=r.z,R[W+G+3]=0),v===!0&&(r.fromBufferAttribute(q,$),R[W+G+4]=r.x,R[W+G+5]=r.y,R[W+G+6]=r.z,R[W+G+7]=0),M===!0&&(r.fromBufferAttribute(z,$),R[W+G+8]=r.x,R[W+G+9]=r.y,R[W+G+10]=r.z,R[W+G+11]=z.itemSize===4?r.w:1)}}f={count:d,texture:w,size:new Be(E,U)},n.set(o,f),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let m=0;for(let M=0;M<c.length;M++)m+=c[M];const v=o.morphTargetsRelative?1:1-m;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function of(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,d=e.get(l,h);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Ro=new vt,La=new Ao(1,1),wo=new fo,Co=new Fl,Po=new So,Ua=[],Ia=[],Na=new Float32Array(16),Fa=new Float32Array(9),Oa=new Float32Array(4);function fi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Ua[r];if(s===void 0&&(s=new Float32Array(r),Ua[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function lt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ct(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function dr(i,e){let t=Ia[e];t===void 0&&(t=new Int32Array(e),Ia[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function lf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function cf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lt(t,e))return;i.uniform2fv(this.addr,e),ct(t,e)}}function uf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lt(t,e))return;i.uniform3fv(this.addr,e),ct(t,e)}}function hf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lt(t,e))return;i.uniform4fv(this.addr,e),ct(t,e)}}function ff(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;Oa.set(n),i.uniformMatrix2fv(this.addr,!1,Oa),ct(t,n)}}function df(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;Fa.set(n),i.uniformMatrix3fv(this.addr,!1,Fa),ct(t,n)}}function pf(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(lt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ct(t,e)}else{if(lt(t,n))return;Na.set(n),i.uniformMatrix4fv(this.addr,!1,Na),ct(t,n)}}function mf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function _f(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lt(t,e))return;i.uniform2iv(this.addr,e),ct(t,e)}}function gf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lt(t,e))return;i.uniform3iv(this.addr,e),ct(t,e)}}function vf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lt(t,e))return;i.uniform4iv(this.addr,e),ct(t,e)}}function xf(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Mf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lt(t,e))return;i.uniform2uiv(this.addr,e),ct(t,e)}}function Sf(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lt(t,e))return;i.uniform3uiv(this.addr,e),ct(t,e)}}function Ef(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lt(t,e))return;i.uniform4uiv(this.addr,e),ct(t,e)}}function yf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(La.compareFunction=co,s=La):s=Ro,t.setTexture2D(e||s,r)}function Tf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Co,r)}function Af(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Po,r)}function bf(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||wo,r)}function Rf(i){switch(i){case 5126:return lf;case 35664:return cf;case 35665:return uf;case 35666:return hf;case 35674:return ff;case 35675:return df;case 35676:return pf;case 5124:case 35670:return mf;case 35667:case 35671:return _f;case 35668:case 35672:return gf;case 35669:case 35673:return vf;case 5125:return xf;case 36294:return Mf;case 36295:return Sf;case 36296:return Ef;case 35678:case 36198:case 36298:case 36306:case 35682:return yf;case 35679:case 36299:case 36307:return Tf;case 35680:case 36300:case 36308:case 36293:return Af;case 36289:case 36303:case 36311:case 36292:return bf}}function wf(i,e){i.uniform1fv(this.addr,e)}function Cf(i,e){const t=fi(e,this.size,2);i.uniform2fv(this.addr,t)}function Pf(i,e){const t=fi(e,this.size,3);i.uniform3fv(this.addr,t)}function Df(i,e){const t=fi(e,this.size,4);i.uniform4fv(this.addr,t)}function Lf(i,e){const t=fi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Uf(i,e){const t=fi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function If(i,e){const t=fi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Nf(i,e){i.uniform1iv(this.addr,e)}function Ff(i,e){i.uniform2iv(this.addr,e)}function Of(i,e){i.uniform3iv(this.addr,e)}function Bf(i,e){i.uniform4iv(this.addr,e)}function zf(i,e){i.uniform1uiv(this.addr,e)}function Hf(i,e){i.uniform2uiv(this.addr,e)}function Vf(i,e){i.uniform3uiv(this.addr,e)}function Gf(i,e){i.uniform4uiv(this.addr,e)}function kf(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Ro,s[a])}function Wf(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Co,s[a])}function Xf(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Po,s[a])}function qf(i,e,t){const n=this.cache,r=e.length,s=dr(t,r);lt(n,s)||(i.uniform1iv(this.addr,s),ct(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||wo,s[a])}function Yf(i){switch(i){case 5126:return wf;case 35664:return Cf;case 35665:return Pf;case 35666:return Df;case 35674:return Lf;case 35675:return Uf;case 35676:return If;case 5124:case 35670:return Nf;case 35667:case 35671:return Ff;case 35668:case 35672:return Of;case 35669:case 35673:return Bf;case 5125:return zf;case 36294:return Hf;case 36295:return Vf;case 36296:return Gf;case 35678:case 36198:case 36298:case 36306:case 35682:return kf;case 35679:case 36299:case 36307:return Wf;case 35680:case 36300:case 36308:case 36293:return Xf;case 36289:case 36303:case 36311:case 36292:return qf}}class Zf{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Rf(t.type)}}class Kf{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Yf(t.type)}}class $f{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Xr=/(\w+)(\])?(\[|\.)?/g;function Ba(i,e){i.seq.push(e),i.map[e.id]=e}function jf(i,e,t){const n=i.name,r=n.length;for(Xr.lastIndex=0;;){const s=Xr.exec(n),a=Xr.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Ba(t,c===void 0?new Zf(o,i,e):new Kf(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new $f(o),Ba(t,d)),t=d}}}class ar{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);jf(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function za(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Jf=37297;let Qf=0;function ed(i,e){const t=i.split(` 3730`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3731`)}const Ha=new Ce;function td(i){ke._getMatrix(Ha,ke.workingColorSpace,i);const e=`mat3( ${Ha.elements.map(t=>t.toFixed(4))} )`;switch(ke.getTransfer(i)){case or:return[e,"LinearTransferOETF"];case Ze:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function Va(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3732 3733`+r+` 3734 3735`+ed(i.getShaderSource(e),a)}else return r}function nd(i,e){const t=td(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3736`)}function id(i,e){let t;switch(e){case ol:t="Linear";break;case ll:t="Reinhard";break;case cl:t="Cineon";break;case ul:t="ACESFilmic";break;case fl:t="AgX";break;case dl:t="Neutral";break;case hl:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const er=new F;function rd(){ke.getLuminanceCoefficients(er);const i=er.x.toFixed(4),e=er.y.toFixed(4),t=er.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3737`)}function sd(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Si).join(` 3738`)}function ad(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3739`)}function od(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Si(i){return i!==""}function Ga(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ka(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ld=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ns(i){return i.replace(ld,ud)}const cd=new Map;function ud(i,e){let t=De[e];if(t===void 0){const n=cd.get(e);if(n!==void 0)t=De[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ns(t)}const hd=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Wa(i){return i.replace(hd,fd)}function fd(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Xa(i){let e=`precision ${i.precision} float; 3740 precision ${i.precision} int; 3741 precision ${i.precision} sampler2D; 3742 precision ${i.precision} samplerCube; 3743 precision ${i.precision} sampler3D; 3744 precision ${i.precision} sampler2DArray; 3745 precision ${i.precision} sampler2DShadow; 3746 precision ${i.precision} samplerCubeShadow; 3747 precision ${i.precision} sampler2DArrayShadow; 3748 precision ${i.precision} isampler2D; 3749 precision ${i.precision} isampler3D; 3750 precision ${i.precision} isamplerCube; 3751 precision ${i.precision} isampler2DArray; 3752 precision ${i.precision} usampler2D; 3753 precision ${i.precision} usampler3D; 3754 precision ${i.precision} usamplerCube; 3755 precision ${i.precision} usampler2DArray; 3756 `;return i.precision==="highp"?e+=` 3757#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3758#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3759#define LOW_PRECISION`),e}function dd(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===$a?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Ho?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Kt&&(e="SHADOWMAP_TYPE_VSM"),e}function pd(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case si:case ai:e="ENVMAP_TYPE_CUBE";break;case hr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function md(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case ai:e="ENVMAP_MODE_REFRACTION";break}return e}function _d(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case ja:e="ENVMAP_BLENDING_MULTIPLY";break;case sl:e="ENVMAP_BLENDING_MIX";break;case al:e="ENVMAP_BLENDING_ADD";break}return e}function gd(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function vd(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=dd(t),c=pd(t),h=md(t),d=_d(t),f=gd(t),m=sd(t),v=ad(s),M=r.createProgram();let p,u,A=t.glslVersion?"#version "+t.glslVersion+` 3760`:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Si).join(` 3761`),p.length>0&&(p+=` 3762`),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Si).join(` 3763`),u.length>0&&(u+=` 3764`)):(p=[Xa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 5,767 bytes, lines 3764-3766
3764ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3765`].filter(Si).join(` 3766`),u=[Xa(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.max
vendor: 4,100 bytes, lines 3766-3773
3766Mip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==fn?"#define TONE_MAPPING":"",t.toneMapping!==fn?De.tonemapping_pars_fragment:"",t.toneMapping!==fn?id("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",De.colorspace_pars_fragment,nd("linearToOutputTexel",t.outputColorSpace),rd(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3767`].filter(Si).join(` 3768`)),a=Ns(a),a=Ga(a,t),a=ka(a,t),o=Ns(o),o=Ga(o,t),o=ka(o,t),a=Wa(a),o=Wa(o),t.isRawShaderMaterial!==!0&&(A=`#version 300 es 3769`,p=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3770`)+` 3771`+p,u=["#define varying in",t.glslVersion===ra?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ra?"":"#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(` 3772`)+` 3773`+u);const T=A+p+a,E=A+u+o,U=za(r,r.VERTEX_SHADER,T),R=za(r,r.FRAGMENT_SHADER,E);r.attachShader(M,U),r.attachShader(M,R),t.index0AttributeName!==void 0?r.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);function w(C){if(i.debug.checkShaderErrors){const q=r.getProgramInfoLog(M).trim(),z=r.getShaderInfoLog(U).trim(),W=r.getShaderInfoLog(R).trim();let $=!0,G=!0;if(r.getProgramParameter(M,r.LINK_STATUS)===!1)if($=!1,typeof i.debug.onSha
vendor: 4,371 bytes, lines 3773-3780
3773derError=="function")i.debug.onShaderError(r,M,U,R);else{const Q=Va(r,U,"vertex"),V=Va(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(M,r.VALIDATE_STATUS)+` 3774 3775Material Name: `+C.name+` 3776Material Type: `+C.type+` 3777 3778Program Info Log: `+q+` 3779`+Q+` 3780`+V)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(z===""||W==="")&&(G=!1);G&&(C.diagnostics={runnable:$,programLog:q,vertexShader:{log:z,prefix:p},fragmentShader:{log:W,prefix:u}})}r.deleteShader(U),r.deleteShader(R),I=new ar(r,M),S=od(r,M)}let I;this.getUniforms=function(){return I===void 0&&w(this),I};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(M,Jf)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Qf++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=U,this.fragmentShader=R,this}let xd=0;class Md{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Sd(e),t.set(e,n)),n}}class Sd{constructor(e){this.id=xd++,this.code=e,this.usedTimes=0}}function Ed(i,e,t,n,r,s,a){const o=new po,l=new Md,c=new Set,h=[],d=r.logarithmicDepthBuffer,f=r.vertexTextures;let m=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function M(S){return c.add(S),S===0?"uv":`uv${S}`}function p(S,x,C,q,z){const W=q.fog,$=z.geometry,G=S.isMeshStandardMaterial?q.environment:null,Q=(S.isMeshStandardMaterial?t:e).get(S.envMap||G),V=Q&&Q.mapping===hr?Q.image.height:null,re=v[S.type];S.precision!==null&&(m=r.getMaxPrecision(S.precision),m!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const ue=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ge=ue!==void 0?ue.length:0;let Le=0;$.morphAttributes.position!==void 0&&(Le=1),$.morphAttributes.normal!==void 0&&(Le=2),$.morphAttributes.color!==void 0&&(Le=3);let $e,X,ee,me;if(re){const qe=Ht[re];$e=qe.vertexShader,X=qe.fragmentShader}else $e=S.vertexShader,X=S.fragmentShader,l.update(S),ee=l.getVertexShaderID(S),me=l.getFragmentShaderID(S);const se=i.getRenderTarget(),ye=i.state.buffers.depth.getReversed(),Re=z.isInstancedMesh===!0,Ue=z.isBatchedMesh===!0,et=!!S.map,ze=!!S.matcap,it=!!Q,b=!!S.aoMap,bt=!!S.lightMap,Ne=!!S.bumpMap,Fe=!!S.normalMap,ve=!!S.displacementMap,Je=!!S.emissiveMap,xe=!!S.metalnessMap,y=!!S.roughnessMap,_=S.anisotropy>0,N=S.clearcoat>0,Y=S.dispersion>0,K=S.iridescence>0,k=S.sheen>0,_e=S.transmission>0,ae=_&&!!S.anisotropyMap,he=N&&!!S.clearcoatMap,He=N&&!!S.clearcoatNormalMap,J=N&&!!S.clearcoatRoughnessMap,fe=K&&!!S.iridescenceMap,Ee=K&&!!S.iridescenceThicknessMap,Te=k&&!!S.sheenColorMap,de=k&&!!S.sheenRoughnessMap,Oe=!!S.specularMap,Pe=!!S.specularColorMap,je=!!S.specularIntensityMap,P=_e&&!!S.transmissionMap,ne=_e&&!!S.thicknessMap,H=!!S.gradientMap,Z=!!S.alphaMap,le=S.alphaTest>0,oe=!!S.alphaHash,we=!!S.extensions;let tt=fn;S.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(tt=i.toneMapping);
vendor: 27,757 bytes, lines 3780-3808
3780const ft={shaderID:re,shaderType:S.type,shaderName:S.name,vertexShader:$e,fragmentShader:X,defines:S.defines,customVertexShaderID:ee,customFragmentShaderID:me,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:Ue,batchingColor:Ue&&z._colorsTexture!==null,instancing:Re,instancingColor:Re&&z.instanceColor!==null,instancingMorph:Re&&z.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:se===null?i.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:ci,alphaToCoverage:!!S.alphaToCoverage,map:et,matcap:ze,envMap:it,envMapMode:it&&Q.mapping,envMapCubeUVHeight:V,aoMap:b,lightMap:bt,bumpMap:Ne,normalMap:Fe,displacementMap:f&&ve,emissiveMap:Je,normalMapObjectSpace:Fe&&S.normalMapType===vl,normalMapTangentSpace:Fe&&S.normalMapType===gl,metalnessMap:xe,roughnessMap:y,anisotropy:_,anisotropyMap:ae,clearcoat:N,clearcoatMap:he,clearcoatNormalMap:He,clearcoatRoughnessMap:J,dispersion:Y,iridescence:K,iridescenceMap:fe,iridescenceThicknessMap:Ee,sheen:k,sheenColorMap:Te,sheenRoughnessMap:de,specularMap:Oe,specularColorMap:Pe,specularIntensityMap:je,transmission:_e,transmissionMap:P,thicknessMap:ne,gradientMap:H,opaque:S.transparent===!1&&S.blending===ti&&S.alphaToCoverage===!1,alphaMap:Z,alphaTest:le,alphaHash:oe,combine:S.combine,mapUv:et&&M(S.map.channel),aoMapUv:b&&M(S.aoMap.channel),lightMapUv:bt&&M(S.lightMap.channel),bumpMapUv:Ne&&M(S.bumpMap.channel),normalMapUv:Fe&&M(S.normalMap.channel),displacementMapUv:ve&&M(S.displacementMap.channel),emissiveMapUv:Je&&M(S.emissiveMap.channel),metalnessMapUv:xe&&M(S.metalnessMap.channel),roughnessMapUv:y&&M(S.roughnessMap.channel),anisotropyMapUv:ae&&M(S.anisotropyMap.channel),clearcoatMapUv:he&&M(S.clearcoatMap.channel),clearcoatNormalMapUv:He&&M(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&M(S.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&M(S.iridescenceMap.channel),iridescenceThicknessMapUv:Ee&&M(S.iridescenceThicknessMap.channel),sheenColorMapUv:Te&&M(S.sheenColorMap.channel),sheenRoughnessMapUv:de&&M(S.sheenRoughnessMap.channel),specularMapUv:Oe&&M(S.specularMap.channel),specularColorMapUv:Pe&&M(S.specularColorMap.channel),specularIntensityMapUv:je&&M(S.specularIntensityMap.channel),transmissionMapUv:P&&M(S.transmissionMap.channel),thicknessMapUv:ne&&M(S.thicknessMap.channel),alphaMapUv:Z&&M(S.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(Fe||_),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!$.attributes.uv&&(et||Z),fog:!!W,useFog:S.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:ye,skinning:z.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:ge,morphTextureStride:Le,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:i.shadowMap.enabled&&C.length>0,shadowMapType:i.shadowMap.type,toneMapping:tt,decodeVideoTexture:et&&S.map.isVideoTexture===!0&&ke.getTransfer(S.map.colorSpace)===Ze,decodeVideoTextureEmissive:Je&&S.emissiveMap.isVideoTexture===!0&&ke.getTransfer(S.emissiveMap.colorSpace)===Ze,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===$t,flipSided:S.side===Mt,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:we&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&S.extensions.multiDraw===!0||Ue)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return ft.vertexUv1s=c.has(1),ft.vertexUv2s=c.has(2),ft.vertexUv3s=c.has(3),c.clear(),ft}function u(S){const x=[];if(S.shaderID?x.push(S.shaderID):(x.push(S.customVertexShaderID),x.push(S.customFragmentShaderID)),S.defines!==void 0)for(const C in S.defines)x.push(C),x.push(S.defines[C]);return S.isRawShaderMaterial===!1&&(A(x,S),T(x,S),x.push(i.outputColorSpace)),x.push(S.customProgramCacheKey),x.join()}function A(S,x){S.push(x.precision),S.push(x.outputColorSpace),S.push(x.envMapMode),S.push(x.envMapCubeUVHeight),S.push(x.mapUv),S.push(x.alphaMapUv),S.push(x.lightMapUv),S.push(x.aoMapUv),S.push(x.bumpMapUv),S.push(x.normalMapUv),S.push(x.displacementMapUv),S.push(x.emissiveMapUv),S.push(x.metalnessMapUv),S.push(x.roughnessMapUv),S.push(x.anisotropyMapUv),S.push(x.clearcoatMapUv),S.push(x.clearcoatNormalMapUv),S.push(x.clearcoatRoughnessMapUv),S.push(x.iridescenceMapUv),S.push(x.iridescenceThicknessMapUv),S.push(x.sheenColorMapUv),S.push(x.sheenRoughnessMapUv),S.push(x.specularMapUv),S.push(x.specularColorMapUv),S.push(x.specularIntensityMapUv),S.push(x.transmissionMapUv),S.push(x.thicknessMapUv),S.push(x.combine),S.push(x.fogExp2),S.push(x.sizeAttenuation),S.push(x.morphTargetsCount),S.push(x.morphAttributeCount),S.push(x.numDirLights),S.push(x.numPointLights),S.push(x.numSpotLights),S.push(x.numSpotLightMaps),S.push(x.numHemiLights),S.push(x.numRectAreaLights),S.push(x.numDirLightShadows),S.push(x.numPointLightShadows),S.push(x.numSpotLightShadows),S.push(x.numSpotLightShadowsWithMaps),S.push(x.numLightProbes),S.push(x.shadowMapType),S.push(x.toneMapping),S.push(x.numClippingPlanes),S.push(x.numClipIntersection),S.push(x.depthPacking)}function T(S,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),S.push(o.mask)}function E(S){const x=v[S.type];let C;if(x){const q=Ht[x];C=Kl.clone(q.uniforms)}else C=S.uniforms;return C}function U(S,x){let C;for(let q=0,z=h.length;q<z;q++){const W=h[q];if(W.cacheKey===x){C=W,++C.usedTimes;break}}return C===void 0&&(C=new vd(i,x,S,s),h.push(C)),C}function R(S){if(--S.usedTimes===0){const x=h.indexOf(S);h[x]=h[h.length-1],h.pop(),S.destroy()}}function w(S){l.remove(S)}function I(){l.dispose()}return{getParameters:p,getProgramCacheKey:u,getUniforms:E,acquireProgram:U,releaseProgram:R,releaseShaderCache:w,programs:h,dispose:I}}function yd(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Td(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function qa(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Ya(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(d,f,m,v,M,p){let u=i[e];return u===void 0?(u={id:d.id,object:d,geometry:f,material:m,groupOrder:v,renderOrder:d.renderOrder,z:M,group:p},i[e]=u):(u.id=d.id,u.object=d,u.geometry=f,u.material=m,u.groupOrder=v,u.renderOrder=d.renderOrder,u.z=M,u.group=p),e++,u}function o(d,f,m,v,M,p){const u=a(d,f,m,v,M,p);m.transmission>0?n.push(u):m.transparent===!0?r.push(u):t.push(u)}function l(d,f,m,v,M,p){const u=a(d,f,m,v,M,p);m.transmission>0?n.unshift(u):m.transparent===!0?r.unshift(u):t.unshift(u)}function c(d,f){t.length>1&&t.sort(d||Td),n.length>1&&n.sort(f||qa),r.length>1&&r.sort(f||qa)}function h(){for(let d=e,f=i.length;d<f;d++){const m=i[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Ad(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Ya,i.set(n,[a])):r>=s.length?(a=new Ya,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function bd(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Ye};break;case"SpotLight":t={position:new F,direction:new F,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new F,halfWidth:new F,halfHeight:new F};break}return i[e.id]=t,t}}}function Rd(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let wd=0;function Cd(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Pd(i){const e=new bd,t=Rd(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new F);const r=new F,s=new st,a=new st;function o(c){let h=0,d=0,f=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let m=0,v=0,M=0,p=0,u=0,A=0,T=0,E=0,U=0,R=0,w=0;c.sort(Cd);for(let S=0,x=c.length;S<x;S++){const C=c[S],q=C.color,z=C.intensity,W=C.distance,$=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=q.r*z,d+=q.g*z,f+=q.b*z;else if(C.isLightProbe){for(let G=0;G<9;G++)n.probe[G].addScaledVector(C.sh.coefficients[G],z);w++}else if(C.isDirectionalLight){const G=e.get(C);if(G.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const Q=C.shadow,V=t.get(C);V.shadowIntensity=Q.intensity,V.shadowBias=Q.bias,V.shadowNormalBias=Q.normalBias,V.shadowRadius=Q.radius,V.shadowMapSize=Q.mapSize,n.directionalShadow[m]=V,n.directionalShadowMap[m]=$,n.directionalShadowMatrix[m]=C.shadow.matrix,A++}n.directional[m]=G,m++}else if(C.isSpotLight){const G=e.get(C);G.position.setFromMatrixPosition(C.matrixWorld),G.color.copy(q).multiplyScalar(z),G.distance=W,G.coneCos=Math.cos(C.angle),G.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),G.decay=C.decay,n.spot[M]=G;const Q=C.shadow;if(C.map&&(n.spotLightMap[U]=C.map,U++,Q.updateMatrices(C),C.castShadow&&R++),n.spotLightMatrix[M]=Q.matrix,C.castShadow){const V=t.get(C);V.shadowIntensity=Q.intensity,V.shadowBias=Q.bias,V.shadowNormalBias=Q.normalBias,V.shadowRadius=Q.radius,V.shadowMapSize=Q.mapSize,n.spotShadow[M]=V,n.spotShadowMap[M]=$,E++}M++}else if(C.isRectAreaLight){const G=e.get(C);G.color.copy(q).multiplyScalar(z),G.halfWidth.set(C.width*.5,0,0),G.halfHeight.set(0,C.height*.5,0),n.rectArea[p]=G,p++}else if(C.isPointLight){const G=e.get(C);if(G.color.copy(C.color).multiplyScalar(C.intensity),G.distance=C.distance,G.decay=C.decay,C.castShadow){const Q=C.shadow,V=t.get(C);V.shadowIntensity=Q.intensity,V.shadowBias=Q.bias,V.shadowNormalBias=Q.normalBias,V.shadowRadius=Q.radius,V.shadowMapSize=Q.mapSize,V.shadowCameraNear=Q.camera.near,V.shadowCameraFar=Q.camera.far,n.pointShadow[v]=V,n.pointShadowMap[v]=$,n.pointShadowMatrix[v]=C.shadow.matrix,T++}n.point[v]=G,v++}else if(C.isHemisphereLight){const G=e.get(C);G.skyColor.copy(C.color).multiplyScalar(z),G.groundColor.copy(C.groundColor).multiplyScalar(z),n.hemi[u]=G,u++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=te.LTC_FLOAT_1,n.rectAreaLTC2=te.LTC_FLOAT_2):(n.rectAreaLTC1=te.LTC_HALF_1,n.rectAreaLTC2=te.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=f;const I=n.hash;(I.directionalLength!==m||I.pointLength!==v||I.spotLength!==M||I.rectAreaLength!==p||I.hemiLength!==u||I.numDirectionalShadows!==A||I.numPointShadows!==T||I.numSpotShadows!==E||I.numSpotMaps!==U||I.numLightProbes!==w)&&(n.directional.length=m,n.spot.length=M,n.rectArea.length=p,n.point.length=v,n.hemi.length=u,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=E,n.spotShadowMap.length=E,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=E+U-R,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=w,I.directionalLength=m,I.pointLength=v,I.spotLength=M,I.rectAreaLength=p,I.hemiLength=u,I.numDirectionalShadows=A,I.numPointShadows=T,I.numSpotShadows=E,I.numSpotMaps=U,I.numLightProbes=w,n.version=wd++)}function l(c,h){let d=0,f=0,m=0,v=0,M=0;const p=h.matrixWorldInverse;for(let u=0,A=c.length;u<A;u++){const T=c[u];if(T.isDirectionalLight){const E=n.directional[d];E.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(p),d++}else if(T.isSpotLight){const E=n.spot[m];E.position.setFromMatrixPosition(T.matrixWorld),E.position.applyMatrix4(p),E.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(p),m++}else if(T.isRectAreaLight){const E=n.rectArea[v];E.position.setFromMatrixPosition(T.matrixWorld),E.position.applyMatrix4(p),a.identity(),s.copy(T.matrixWorld),s.premultiply(p),a.extractRotation(s),E.halfWidth.set(T.width*.5,0,0),E.halfHeight.set(0,T.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),v++}else if(T.isPointLight){const E=n.point[f];E.position.setFromMatrixPosition(T.matrixWorld),E.position.applyMatrix4(p),f++}else if(T.isHemisphereLight){const E=n.hemi[M];E.direction.setFromMatrixPosition(T.matrixWorld),E.direction.transformDirection(p),M++}}}return{setup:o,setupView:l,state:n}}function Za(i){const e=new Pd(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Dd(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Za(i),e.set(r,[o])):s>=a.length?(o=new Za(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Ld=`void main() { 3781 gl_Position = vec4( position, 1.0 ); 3782}`,Ud=`uniform sampler2D shadow_pass; 3783uniform vec2 resolution; 3784uniform float radius; 3785#include <packing> 3786void main() { 3787 const float samples = float( VSM_SAMPLES ); 3788 float mean = 0.0; 3789 float squared_mean = 0.0; 3790 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3791 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3792 for ( float i = 0.0; i < samples; i ++ ) { 3793 float uvOffset = uvStart + i * uvStride; 3794 #ifdef HORIZONTAL_PASS 3795 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3796 mean += distribution.x; 3797 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3798 #else 3799 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3800 mean += depth; 3801 squared_mean += depth * depth; 3802 #endif 3803 } 3804 mean = mean / samples; 3805 squared_mean = squared_mean / samples; 3806 float std_dev = sqrt( squared_mean - mean * mean ); 3807 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3808}`;function Id(i,e,t){let n=new To;const r=new Be,s=new Be,a=new rt,o=new ac({depthPacking:_l}),l=new oc,c={},h=t.maxTextureSize,d={[pn]:Mt,[Mt]:pn,[$t]:$t},f=new mn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:Ld,fragmentShader:Ud}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const v=new _n;v.setAttribute("position",new zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new Qt(v,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=$a;let u=this.type;this.render=function(R,w,I){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||R.length===0)return;const S=i.getRenderTarget(),x=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),q=i.state;q.setBlending(hn),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const z=u!==Kt&&this.type===Kt,W=u===Kt&&this.type!==Kt;for(let $=0,G=R.length;$<G;$++){const Q=R[$],V=Q.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",Q,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const re=V.getFrameExtents();if(r.multiply(re),s.copy(V.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/re.x),r.x=s.x*re.x,V.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/re.y),r.y=s.y*re.y,V.mapSize.y=s.y)),V.map===null||z===!0||W===!0){const ge=this.type!==Kt?{minFilter:Bt,magFilter:Bt}:{};V.map!==null&&V.map.dispose(),V.map=new Un(r.x,r.y,ge),V.map.texture.name=Q.name+".shadowMap",V.camera.updateProjectionMatrix()}i.setRenderTarget(V.map),i.clear();const ue=V.getViewportCount();for(let ge=0;ge<ue;ge++){const Le=V.getViewport(ge);a.set(s.x*Le.x,s.y*Le.y,s.x*Le.z,s.y*Le.w),q.viewport(a),V.updateMatrices(Q,ge),n=V.getFrustum(),E(w,I,V.camera,Q,this.type)}V.isPointLightShadow!==!0&&this.type===Kt&&A(V,I),V.needsUpdate=!1}u=this.type,p.needsUpdate=!1,i.setRenderTarget(S,x,C)};function A(R,w){const I=e.update(M);f.defines.VSM_SAMPLES!==R.blurSamples&&(f.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Un(r.x,r.y)),f.uniforms.shadow_pass.value=R.map.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,i.setRenderTarget(R.mapPass),i.clear(),i.renderBufferDirect(w,null,I,f,M,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,i.setRenderTarget(R.map),i.clear(),i.renderBufferDirect(w,null,I,m,M,null)}function T(R,w,I,S){let x=null;const C=I.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(C!==void 0)x=C;else if(x=I.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const q=x.uuid,z=w.uuid;let W=c[q];W===void 0&&(W={},c[q]=W);let $=W[z];$===void 0&&($=x.clone(),W[z]=$,w.addEventListener("dispose",U)),x=$}if(x.visible=w.visible,x.wireframe=w.wireframe,S===Kt?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:d[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,I.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const q=i.properties.get(x);q.light=I}return x}function E(R,w,I,S,x){if(R.visible===!1)return;if(R.layers.test(w.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===Kt)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,R.matrixWorld);const z=e.update(R),W=R.material;if(Array.isArray(W)){const $=z.groups;for(let G=0,Q=$.length;G<Q;G++){const V=$[G],re=W[V.materialIndex];if(re&&re.visible){const ue=T(R,re,S,x);R.onBeforeShadow(i,R,w,I,z,ue,V),i.renderBufferDirect(I,null,z,ue,R,V),R.onAfterShadow(i,R,w,I,z,ue,V)}}}else if(W.visible){const $=T(R,W,S,x);R.onBeforeShadow(i,R,w,I,z,$,null),i.renderBufferDirect(I,null,z,$,R,null),R.onAfterShadow(i,R,w,I,z,$,null)}}const q=R.children;for(let z=0,W=q.length;z<W;z++)E(q[z],w,I,S,x)}function U(R){R.target.removeEventListener("dispose",U);for(const I in c){const S=c[I],x=R.target.uuid;x in S&&(S[x].dispose(),delete S[x])}}}const Nd={[$r]:jr,[Jr]:ts,[Qr]:ns,[ri]:es,[jr]:$r,[ts]:Jr,[ns]:Qr,[es]:ri};function Fd(i,e){function t(){let P=!1;const ne=new rt;let H=null;const Z=new rt(0,0,0,0);return{setMask:function(le){H!==le&&!P&&(i.colorMask(le,le,le,le),H=le)},setLocked:function(le){P=le},setClear:function(le,oe,we,tt,ft){ft===!0&&(le*=tt,oe*=tt,we*=tt),ne.set(le,oe,we,tt),Z.equals(ne)===!1&&(i.clearColor(le,oe,we,tt),Z.copy(ne))},reset:function(){P=!1,H=null,Z.set(-1,0,0,0)}}}function n(){let P=!1,ne=!1,H=null,Z=null,le=null;return{setReversed:function(oe){if(ne!==oe){const we=e.get("EXT_clip_control");ne?we.clipControlEXT(we.LOWER_LEFT_EXT,we.ZERO_TO_ONE_EXT):we.clipControlEXT(we.LOWER_LEFT_EXT,we.NEGATIVE_ONE_TO_ONE_EXT);const tt=le;le=null,this.setClear(tt)}ne=oe},getReversed:function(){return ne},setTest:function(oe){oe?se(i.DEPTH_TEST):ye(i.DEPTH_TEST)},setMask:function(oe){H!==oe&&!P&&(i.depthMask(oe),H=oe)},setFunc:function(oe){if(ne&&(oe=Nd[oe]),Z!==oe){switch(oe){case $r:i.depthFunc(i.NEVER);break;case jr:i.depthFunc(i.ALWAYS);break;case Jr:i.depthFunc(i.LESS);break;case ri:i.depthFunc(i.LEQUAL);break;case Qr:i.depthFunc(i.EQUAL);break;case es:i.depthFunc(i.GEQUAL);break;case ts:i.depthFunc(i.GREATER);break;case ns:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Z=oe}},setLocked:function(oe){P=oe},setClear:function(oe){le!==oe&&(ne&&(oe=1-oe),i.clearDepth(oe),le=oe)},reset:function(){P=!1,H=null,Z=null,le=null,ne=!1}}}function r(){let P=!1,ne=null,H=null,Z=null,le=null,oe=null,we=null,tt=null,ft=null;return{setTest:function(qe){P||(qe?se(i.STENCIL_TEST):ye(i.STENCIL_TEST))},setMask:function(qe){ne!==qe&&!P&&(i.stencilMask(qe),ne=qe)},setFunc:function(qe,Lt,kt){(H!==qe||Z!==Lt||le!==kt)&&(i.stencilFunc(qe,Lt,kt),H=qe,Z=Lt,le=kt)},setOp:function(qe,Lt,kt){(oe!==qe||we!==Lt||tt!==kt)&&(i.stencilOp(qe,Lt,kt),oe=qe,we=Lt,tt=kt)},setLocked:function(qe){P=qe},setClear:function(qe){ft!==qe&&(i.clearStencil(qe),ft=qe)},reset:function(){P=!1,ne=null,H=null,Z=null,le=null,oe=null,we=null,tt=null,ft=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},d={},f=new WeakMap,m=[],v=null,M=!1,p=null,u=null,A=null,T=null,E=null,U=null,R=null,w=new Ye(0,0,0),I=0,S=!1,x=null,C=null,q=null,z=null,W=null;const $=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let G=!1,Q=0;const V=i.getParameter(i.VERSION);V.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(V)[1]),G=Q>=1):V.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),G=Q>=2);let re=null,ue={};const ge=i.getParameter(i.SCISSOR_BOX),Le=i.getParameter(i.VIEWPORT),$e=new rt().fromArray(ge),X=new rt().fromArray(Le);function ee(P,ne,H,Z){const le=new Uint8Array(4),oe=i.createTexture();i.bindTexture(P,oe),i.texParameteri(P,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(P,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let we=0;we<H;we++)P===i.TEXTURE_3D||P===i.TEXTURE_2D_ARRAY?i.texImage3D(ne,0,i.RGBA,1,1,Z,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(ne+we,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return oe}const me={};me[i.TEXTURE_2D]=ee(i.TEXTURE_2D,i.TEXTURE_2D,1),me[i.TEXTURE_CUBE_MAP]=ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),me[i.TEXTURE_2D_ARRAY]=ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),me[i.TEXTURE_3D]=ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),se(i.DEPTH_TEST),a.setFunc(ri),Ne(!1),Fe(Qs),se(i.CULL_FACE),b(hn);function se(P){h[P]!==!0&&(i.enable(P),h[P]=!0)}function ye(P){h[P]!==!1&&(i.disable(P),h[P]=!1)}function Re(P,ne){return d[P]!==ne?(i.bindFramebuffer(P,ne),d[P]=ne,P===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=ne),P===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=ne),!0):!1}function Ue(P,ne){let H=m,Z=!1;if(P){H=f.get(ne),H===void 0&&(H=[],f.set(ne,H));const le=P.textures;if(H.length!==le.length||H[0]!==i.COLOR_ATTACHMENT0){for(let oe=0,we=le.length;oe<we;oe++)H[oe]=i.COLOR_ATTACHMENT0+oe;H.length=le.length,Z=!0}}else H[0]!==i.BACK&&(H[0]=i.BACK,Z=!0);Z&&i.drawBuffers(H)}function et(P){return v!==P?(i.useProgram(P),v=P,!0):!1}const ze={[Rn]:i.FUNC_ADD,[Go]:i.FUNC_SUBTRACT,[ko]:i.FUNC_REVERSE_SUBTRACT};ze[Wo]=i.MIN,ze[Xo]=i.MAX;const it={[qo]:i.ZERO,[Yo]:i.ONE,[Zo]:i.SRC_COLOR,[Zr]:i.SRC_ALPHA,[el]:i.SRC_ALPHA_SATURATE,[Jo]:i.DST_COLOR,[$o]:i.DST_ALPHA,[Ko]:i.ONE_MINUS_SRC_COLOR,[Kr]:i.ONE_MINUS_SRC_ALPHA,[Qo]:i.ONE_MINUS_DST_COLOR,[jo]:i.ONE_MINUS_DST_ALPHA,[tl]:i.CONSTANT_COLOR,[nl]:i.ONE_MINUS_CONSTANT_COLOR,[il]:i.CONSTANT_ALPHA,[rl]:i.ONE_MINUS_CONSTANT_ALPHA};function b(P,ne,H,Z,le,oe,we,tt,ft,qe){if(P===hn){M===!0&&(ye(i.BLEND),M=!1);return}if(M===!1&&(se(i.BLEND),M=!0),P!==Vo){if(P!==p||qe!==S){if((u!==Rn||E!==Rn)&&(i.blendEquation(i.FUNC_ADD),u=Rn,E=Rn),qe)switch(P){case ti:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ea:i.blendFunc(i.ONE,i.ONE);break;case ta:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case na:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}else switch(P){case ti:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ea:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case ta:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case na:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",P);break}A=null,T=null,U=null,R=null,w.set(0,0,0),I=0,p=P,S=qe}return}le=le||ne,oe=oe||H,we=we||Z,(ne!==u||le!==E)&&(i.blendEquationSeparate(ze[ne],ze[le]),u=ne,E=le),(H!==A||Z!==T||oe!==U||we!==R)&&(i.blendFuncSeparate(it[H],it[Z],it[oe],it[we]),A=H,T=Z,U=oe,R=we),(tt.equals(w)===!1||ft!==I)&&(i.blendColor
vendor: 3,402 bytes, line 3808
3808(tt.r,tt.g,tt.b,ft),w.copy(tt),I=ft),p=P,S=!1}function bt(P,ne){P.side===$t?ye(i.CULL_FACE):se(i.CULL_FACE);let H=P.side===Mt;ne&&(H=!H),Ne(H),P.blending===ti&&P.transparent===!1?b(hn):b(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.blendColor,P.blendAlpha,P.premultipliedAlpha),a.setFunc(P.depthFunc),a.setTest(P.depthTest),a.setMask(P.depthWrite),s.setMask(P.colorWrite);const Z=P.stencilWrite;o.setTest(Z),Z&&(o.setMask(P.stencilWriteMask),o.setFunc(P.stencilFunc,P.stencilRef,P.stencilFuncMask),o.setOp(P.stencilFail,P.stencilZFail,P.stencilZPass)),Je(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits),P.alphaToCoverage===!0?se(i.SAMPLE_ALPHA_TO_COVERAGE):ye(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(P){x!==P&&(P?i.frontFace(i.CW):i.frontFace(i.CCW),x=P)}function Fe(P){P!==Bo?(se(i.CULL_FACE),P!==C&&(P===Qs?i.cullFace(i.BACK):P===zo?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ye(i.CULL_FACE),C=P}function ve(P){P!==q&&(G&&i.lineWidth(P),q=P)}function Je(P,ne,H){P?(se(i.POLYGON_OFFSET_FILL),(z!==ne||W!==H)&&(i.polygonOffset(ne,H),z=ne,W=H)):ye(i.POLYGON_OFFSET_FILL)}function xe(P){P?se(i.SCISSOR_TEST):ye(i.SCISSOR_TEST)}function y(P){P===void 0&&(P=i.TEXTURE0+$-1),re!==P&&(i.activeTexture(P),re=P)}function _(P,ne,H){H===void 0&&(re===null?H=i.TEXTURE0+$-1:H=re);let Z=ue[H];Z===void 0&&(Z={type:void 0,texture:void 0},ue[H]=Z),(Z.type!==P||Z.texture!==ne)&&(re!==H&&(i.activeTexture(H),re=H),i.bindTexture(P,ne||me[P]),Z.type=P,Z.texture=ne)}function N(){const P=ue[re];P!==void 0&&P.type!==void 0&&(i.bindTexture(P.type,null),P.type=void 0,P.texture=void 0)}function Y(){try{i.compressedTexImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function K(){try{i.compressedTexImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function k(){try{i.texSubImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function _e(){try{i.texSubImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function he(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function He(){try{i.texStorage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function J(){try{i.texStorage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function fe(){try{i.texImage2D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Ee(){try{i.texImage3D.apply(i,arguments)}catch(P){console.error("THREE.WebGLState:",P)}}function Te(P){$e.equals(P)===!1&&(i.scissor(P.x,P.y,P.z,P.w),$e.copy(P))}function de(P){X.equals(P)===!1&&(i.viewport(P.x,P.y,P.z,P.w),X.copy(P))}function Oe(P,ne){let H=c.get(ne);H===void 0&&(H=new WeakMap,c.set(ne,H));let Z=H.get(P);Z===void 0&&(Z=i.getUniformBlockIndex(ne,P.name),H.set(P,Z))}function Pe(P,ne){const Z=c.get(ne).get(P);l.get(ne)!==Z&&(i.uniformBlockBinding(ne,Z,P.__bindingPointIndex),l.set(ne,Z))}function je(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor
vendor: 5,645 bytes, line 3808
3808(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},re=null,ue={},d={},f=new WeakMap,m=[],v=null,M=!1,p=null,u=null,A=null,T=null,E=null,U=null,R=null,w=new Ye(0,0,0),I=0,S=!1,x=null,C=null,q=null,z=null,W=null,$e.set(0,0,i.canvas.width,i.canvas.height),X.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:se,disable:ye,bindFramebuffer:Re,drawBuffers:Ue,useProgram:et,setBlending:b,setMaterial:bt,setFlipSided:Ne,setCullFace:Fe,setLineWidth:ve,setPolygonOffset:Je,setScissorTest:xe,activeTexture:y,bindTexture:_,unbindTexture:N,compressedTexImage2D:Y,compressedTexImage3D:K,texImage2D:fe,texImage3D:Ee,updateUBOMapping:Oe,uniformBlockBinding:Pe,texStorage2D:He,texStorage3D:J,texSubImage2D:k,texSubImage3D:_e,compressedTexSubImage2D:ae,compressedTexSubImage3D:he,scissor:Te,viewport:de,reset:je}}function Od(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Be,h=new WeakMap;let d;const f=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(y,_){return m?new OffscreenCanvas(y,_):cr("canvas")}function M(y,_,N){let Y=1;const K=xe(y);if((K.width>N||K.height>N)&&(Y=N/Math.max(K.width,K.height)),Y<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const k=Math.floor(Y*K.width),_e=Math.floor(Y*K.height);d===void 0&&(d=v(k,_e));const ae=_?v(k,_e):d;return ae.width=k,ae.height=_e,ae.getContext("2d").drawImage(y,0,0,k,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+k+"x"+_e+")."),ae}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),y;return y}function p(y){return y.generateMipmaps}function u(y){i.generateMipmap(y)}function A(y){return y.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:y.isWebGL3DRenderTarget?i.TEXTURE_3D:y.isWebGLArrayRenderTarget||y.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(y,_,N,Y,K=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let k=_;if(_===i.RED&&(N===i.FLOAT&&(k=i.R32F),N===i.HALF_FLOAT&&(k=i.R16F),N===i.UNSIGNED_BYTE&&(k=i.R8)),_===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(k=i.R8UI),N===i.UNSIGNED_SHORT&&(k=i.R16UI),N===i.UNSIGNED_INT&&(k=i.R32UI),N===i.BYTE&&(k=i.R8I),N===i.SHORT&&(k=i.R16I),N===i.INT&&(k=i.R32I)),_===i.RG&&(N===i.FLOAT&&(k=i.RG32F),N===i.HALF_FLOAT&&(k=i.RG16F),N===i.UNSIGNED_BYTE&&(k=i.RG8)),_===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(k=i.RG8UI),N===i.UNSIGNED_SHORT&&(k=i.RG16UI),N===i.UNSIGNED_INT&&(k=i.RG32UI),N===i.BYTE&&(k=i.RG8I),N===i.SHORT&&(k=i.RG16I),N===i.INT&&(k=i.RG32I)),_===i.RGB_INTEGER&&(N===i.UNSIGNED_BYTE&&(k=i.RGB8UI),N===i.UNSIGNED_SHORT&&(k=i.RGB16UI),N===i.UNSIGNED_INT&&(k=i.RGB32UI),N===i.BYTE&&(k=i.RGB8I),N===i.SHORT&&(k=i.RGB16I),N===i.INT&&(k=i.RGB32I)),_===i.RGBA_INTEGER&&(N===i.UNSIGNED_BYTE&&(k=i.RGBA8UI),N===i.UNSIGNED_SHORT&&(k=i.RGBA16UI),N===i.UNSIGNED_INT&&(k=i.RGBA32UI),N===i.BYTE&&(k=i.RGBA8I),N===i.SHORT&&(k=i.RGBA16I),N===i.INT&&(k=i.RGBA32I)),_===i.RGB&&N===i.UNSIGNED_INT_5_9_9_9_REV&&(k=i.RGB9_E5),_===i.RGBA){const _e=K?or:ke.getTransfer(Y);N===i.FLOAT&&(k=i.RGBA32F),N===i.HALF_FLOAT&&(k=i.RGBA16F),N===i.UNSIGNED_BYTE&&(k=_e===Ze?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT_4_4_4_4&&(k=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(k=i.RGB5_A1)}return(k===i.R16F||k===i.R32F||k===i.RG16F||k===i.RG32F||k===i.RGBA16F||k===i.RGBA32F)&&e.get("EXT_color_buffer_float"),k}function E(y,_){let N;return y?_===null||_===Ln||_===oi?N=i.DEPTH24_STENCIL8:_===jt?N=i.DEPTH32F_STENCIL8:_===Ei&&(N=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Ln||_===oi?N=i.DEPTH_COMPONENT24:_===jt?N=i.DEPTH_COMPONENT32F:_===Ei&&(N=i.DEPTH_COMPONENT16),N}function U(y,_){return p(y)===!0||y.isFramebufferTexture&&y.minFilter!==Bt&&y.minFilter!==Gt?Math.log2(Math.max(_.width,_.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?_.mipmaps.length:1}function R(y){const _=y.target;_.removeEventListener("dispose",R),I(_),_.isVideoTexture&&h.delete(_)}function w(y){const _=y.target;_.removeEventListener("dispose",w),x(_)}function I(y){const _=n.get(y);if(_.__webglInit===void 0)return;const N=y.source,Y=f.get(N);if(Y){const K=Y[_.__cacheKey];K.usedTimes--,K.usedTimes===0&&S(y),Object.keys(Y).length===0&&f.delete(N)}n.remove(y)}function S(y){const _=n.get(y);i.deleteTexture(_.__webglTexture);const N=y.source,Y=f.get(N);delete Y[_.__cacheKey],a.memory.textures--}function x(y){const _=n.get(y);if(y.depthTexture&&(y.depthTexture.dispose(),n.remove(y.depthTexture)),y.isWebGLCubeRen
vendor: 4,487 bytes, line 3808
3808derTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(_.__webglFramebuffer[Y]))for(let K=0;K<_.__webglFramebuffer[Y].length;K++)i.deleteFramebuffer(_.__webglFramebuffer[Y][K]);else i.deleteFramebuffer(_.__webglFramebuffer[Y]);_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer[Y])}else{if(Array.isArray(_.__webglFramebuffer))for(let Y=0;Y<_.__webglFramebuffer.length;Y++)i.deleteFramebuffer(_.__webglFramebuffer[Y]);else i.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&i.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let Y=0;Y<_.__webglColorRenderbuffer.length;Y++)_.__webglColorRenderbuffer[Y]&&i.deleteRenderbuffer(_.__webglColorRenderbuffer[Y]);_.__webglDepthRenderbuffer&&i.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const N=y.textures;for(let Y=0,K=N.length;Y<K;Y++){const k=n.get(N[Y]);k.__webglTexture&&(i.deleteTexture(k.__webglTexture),a.memory.textures--),n.remove(N[Y])}n.remove(y)}let C=0;function q(){C=0}function z(){const y=C;return y>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),C+=1,y}function W(y){const _=[];return _.push(y.wrapS),_.push(y.wrapT),_.push(y.wrapR||0),_.push(y.magFilter),_.push(y.minFilter),_.push(y.anisotropy),_.push(y.internalFormat),_.push(y.format),_.push(y.type),_.push(y.generateMipmaps),_.push(y.premultiplyAlpha),_.push(y.flipY),_.push(y.unpackAlignment),_.push(y.colorSpace),_.join()}function $(y,_){const N=n.get(y);if(y.isVideoTexture&&ve(y),y.isRenderTargetTexture===!1&&y.version>0&&N.__version!==y.version){const Y=y.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{X(N,y,_);return}}t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+_)}function G(y,_){const N=n.get(y);if(y.version>0&&N.__version!==y.version){X(N,y,_);return}t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+_)}function Q(y,_){const N=n.get(y);if(y.version>0&&N.__version!==y.version){X(N,y,_);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+_)}function V(y,_){const N=n.get(y);if(y.version>0&&N.__version!==y.version){ee(N,y,_);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+_)}const re={[ss]:i.REPEAT,[Cn]:i.CLAMP_TO_EDGE,[as]:i.MIRRORED_REPEAT},ue={[Bt]:i.NEAREST,[pl]:i.NEAREST_MIPMAP_NEAREST,[Pi]:i.NEAREST_MIPMAP_LINEAR,[Gt]:i.LINEAR,[_r]:i.LINEAR_MIPMAP_NEAREST,[Pn]:i.LINEAR_MIPMAP_LINEAR},ge={[xl]:i.NEVER,[Al]:i.ALWAYS,[Ml]:i.LESS,[co]:i.LEQUAL,[Sl]:i.EQUAL,[Tl]:i.GEQUAL,[El]:i.GREATER,[yl]:i.NOTEQUAL};function Le(y,_){if(_.type===jt&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Gt||_.magFilter===_r||_.magFilter===Pi||_.magFilter===Pn||_.minFilter===Gt||_.minFilter===_r||_.minFilter===Pi||_.minFilter===Pn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,re[_.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,re[_.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,re[_.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,ue[_.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,ue[_.minFilter]),_.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,ge[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===Bt||_.minFilter!==Pi&&_.minFilter!==Pn||_.type===jt&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||n.get(_).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");i.texParameterf(y,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy}}}function $e(y,_){let N=!1;y.__webglInit===void 0&&(y.__webglInit=!0,_.addEventListener("dispose",R));const Y=_.source;let K=f.get(Y);K===void 0&&(K={},f.set(Y,K));const k=W(_);if(k!==y.__cacheKey){K[k]===void 0&&(K[k]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),K[k].usedTimes++;const _e=K[y.__cacheKey];_e!==void 0&&(K[y.__cacheKey].usedTimes--,_e.usedTimes===0&&S(_)),y.__cacheKey=k,y.__webglTexture=K[k].texture}return N}function X(y,_,N){let Y=i.TEXTURE_2D;
vendor: 27,447 bytes, lines 3808-3832
3808(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),_.isData3DTexture&&(Y=i.TEXTURE_3D);const K=$e(y,_),k=_.source;t.bindTexture(Y,y.__webglTexture,i.TEXTURE0+N);const _e=n.get(k);if(k.version!==_e.__version||K===!0){t.activeTexture(i.TEXTURE0+N);const ae=ke.getPrimaries(ke.workingColorSpace),he=_.colorSpace===un?null:ke.getPrimaries(_.colorSpace),He=_.colorSpace===un||ae===he?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,He);let J=M(_.image,!1,r.maxTextureSize);J=Je(_,J);const fe=s.convert(_.format,_.colorSpace),Ee=s.convert(_.type);let Te=T(_.internalFormat,fe,Ee,_.colorSpace,_.isVideoTexture);Le(Y,_);let de;const Oe=_.mipmaps,Pe=_.isVideoTexture!==!0,je=_e.__version===void 0||K===!0,P=k.dataReady,ne=U(_,J);if(_.isDepthTexture)Te=E(_.format===li,_.type),je&&(Pe?t.texStorage2D(i.TEXTURE_2D,1,Te,J.width,J.height):t.texImage2D(i.TEXTURE_2D,0,Te,J.width,J.height,0,fe,Ee,null));else if(_.isDataTexture)if(Oe.length>0){Pe&&je&&t.texStorage2D(i.TEXTURE_2D,ne,Te,Oe[0].width,Oe[0].height);for(let H=0,Z=Oe.length;H<Z;H++)de=Oe[H],Pe?P&&t.texSubImage2D(i.TEXTURE_2D,H,0,0,de.width,de.height,fe,Ee,de.data):t.texImage2D(i.TEXTURE_2D,H,Te,de.width,de.height,0,fe,Ee,de.data);_.generateMipmaps=!1}else Pe?(je&&t.texStorage2D(i.TEXTURE_2D,ne,Te,J.width,J.height),P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,J.width,J.height,fe,Ee,J.data)):t.texImage2D(i.TEXTURE_2D,0,Te,J.width,J.height,0,fe,Ee,J.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){Pe&&je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Te,Oe[0].width,Oe[0].height,J.depth);for(let H=0,Z=Oe.length;H<Z;H++)if(de=Oe[H],_.format!==Ot)if(fe!==null)if(Pe){if(P)if(_.layerUpdates.size>0){const le=Ta(de.width,de.height,_.format,_.type);for(const oe of _.layerUpdates){const we=de.data.subarray(oe*le/de.data.BYTES_PER_ELEMENT,(oe+1)*le/de.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,H,0,0,oe,de.width,de.height,1,fe,we)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,H,0,0,0,de.width,de.height,J.depth,fe,de.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,H,Te,de.width,de.height,J.depth,0,de.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Pe?P&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,H,0,0,0,de.width,de.height,J.depth,fe,Ee,de.data):t.texImage3D(i.TEXTURE_2D_ARRAY,H,Te,de.width,de.height,J.depth,0,fe,Ee,de.data)}else{Pe&&je&&t.texStorage2D(i.TEXTURE_2D,ne,Te,Oe[0].width,Oe[0].height);for(let H=0,Z=Oe.length;H<Z;H++)de=Oe[H],_.format!==Ot?fe!==null?Pe?P&&t.compressedTexSubImage2D(i.TEXTURE_2D,H,0,0,de.width,de.height,fe,de.data):t.compressedTexImage2D(i.TEXTURE_2D,H,Te,de.width,de.height,0,de.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pe?P&&t.texSubImage2D(i.TEXTURE_2D,H,0,0,de.width,de.height,fe,Ee,de.data):t.texImage2D(i.TEXTURE_2D,H,Te,de.width,de.height,0,fe,Ee,de.data)}else if(_.isDataArrayTexture)if(Pe){if(je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,Te,J.width,J.height,J.depth),P)if(_.layerUpdates.size>0){const H=Ta(J.width,J.height,_.format,_.type);for(const Z of _.layerUpdates){const le=J.data.subarray(Z*H/J.data.BYTES_PER_ELEMENT,(Z+1)*H/J.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Z,J.width,J.height,1,fe,Ee,le)}_.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,fe,Ee,J.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Te,J.width,J.height,J.depth,0,fe,Ee,J.data);else if(_.isData3DTexture)Pe?(je&&t.texStorage3D(i.TEXTURE_3D,ne,Te,J.width,J.height,J.depth),P&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,fe,Ee,J.data)):t.texImage3D(i.TEXTURE_3D,0,Te,J.width,J.height,J.depth,0,fe,Ee,J.data);else if(_.isFramebufferTexture){if(je)if(Pe)t.texStorage2D(i.TEXTURE_2D,ne,Te,J.width,J.height);else{let H=J.width,Z=J.height;for(let le=0;le<ne;le++)t.texImage2D(i.TEXTURE_2D,le,Te,H,Z,0,fe,Ee,null),H>>=1,Z>>=1}}else if(Oe.length>0){if(Pe&&je){const H=xe(Oe[0]);t.texStorage2D(i.TEXTURE_2D,ne,Te,H.width,H.height)}for(let H=0,Z=Oe.length;H<Z;H++)de=Oe[H],Pe?P&&t.texSubImage2D(i.TEXTURE_2D,H,0,0,fe,Ee,de):t.texImage2D(i.TEXTURE_2D,H,Te,fe,Ee,de);_.generateMipmaps=!1}else if(Pe){if(je){const H=xe(J);t.texStorage2D(i.TEXTURE_2D,ne,Te,H.width,H.height)}P&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,Ee,J)}else t.texImage2D(i.TEXTURE_2D,0,Te,fe,Ee,J);p(_)&&u(Y),_e.__version=k.version,_.onUpdate&&_.onUpdate(_)}y.__version=_.version}function ee(y,_,N){if(_.image.length!==6)return;const Y=$e(y,_),K=_.source;t.bindTexture(i.TEXTURE_CUBE_MAP,y.__webglTexture,i.TEXTURE0+N);const k=n.get(K);if(K.version!==k.__version||Y===!0){t.activeTexture(i.TEXTURE0+N);const _e=ke.getPrimaries(ke.workingColorSpace),ae=_.colorSpace===un?null:ke.getPrimaries(_.colorSpace),he=_.colorSpace===un||_e===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,he);const He=_.isCompressedTexture||_.image[0].isCompressedTexture,J=_.image[0]&&_.image[0].isDataTexture,fe=[];for(let Z=0;Z<6;Z++)!He&&!J?fe[Z]=M(_.image[Z],!0,r.maxCubemapSize):fe[Z]=J?_.image[Z].image:_.image[Z],fe[Z]=Je(_,fe[Z]);const Ee=fe[0],Te=s.convert(_.format,_.colorSpace),de=s.convert(_.type),Oe=T(_.internalFormat,Te,de,_.colorSpace),Pe=_.isVideoTexture!==!0,je=k.__version===void 0||Y===!0,P=K.dataReady;let ne=U(_,Ee);Le(i.TEXTURE_CUBE_MAP,_);let H;if(He){Pe&&je&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,Oe,Ee.width,Ee.height);for(let Z=0;Z<6;Z++){H=fe[Z].mipmaps;for(let le=0;le<H.length;le++){const oe=H[le];_.format!==Ot?Te!==null?Pe?P&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,oe.width,oe.height,Te,oe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,Oe,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Pe?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,oe.width,oe.height,Te,de,oe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,Oe,oe.width,oe.height,0,Te,de,oe.data)}}}else{if(H=_.mipmaps,Pe&&je){H.length>0&&ne++;const Z=xe(fe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ne,Oe,Z.width,Z.height)}for(let Z=0;Z<6;Z++)if(J){Pe?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,fe[Z].width,fe[Z].height,Te,de,fe[Z].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Oe,fe[Z].width,fe[Z].height,0,Te,de,fe[Z].data);for(let le=0;le<H.length;le++){const we=H[le].image[Z].image;Pe?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,we.width,we.height,Te,de,we.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,Oe,we.width,we.height,0,Te,de,we.data)}}else{Pe?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Te,de,fe[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Oe,Te,de,fe[Z]);for(let le=0;le<H.length;le++){const oe=H[le];Pe?P&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,Te,de,oe.image[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,Oe,Te,de,oe.image[Z])}}}p(_)&&u(i.TEXTURE_CUBE_MAP),k.__version=K.version,_.onUpdate&&_.onUpdate(_)}y.__version=_.version}function me(y,_,N,Y,K,k){const _e=s.convert(N.format,N.colorSpace),ae=s.convert(N.type),he=T(N.internalFormat,_e,ae,N.colorSpace),He=n.get(_),J=n.get(N);if(J.__renderTarget=_,!He.__hasExternalTextures){const fe=Math.max(1,_.width>>k),Ee=Math.max(1,_.height>>k);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?t.texImage3D(K,k,he,fe,Ee,_.depth,0,_e,ae,null):t.texImage2D(K,k,he,fe,Ee,0,_e,ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,y),Fe(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,K,J.__webglTexture,0,Ne(_)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,K,J.__webglTexture,k),t.bindFramebuffer(i.FRAMEBUFFER,null)}function se(y,_,N){if(i.bindRenderbuffer(i.RENDERBUFFER,y),_.depthBuffer){const Y=_.depthTexture,K=Y&&Y.isDepthTexture?Y.type:null,k=E(_.stencilBuffer,K),_e=_.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=Ne(_);Fe(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ae,k,_.width,_.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,ae,k,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,k,_.width,_.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,_e,i.RENDERBUFFER,y)}else{const Y=_.textures;for(let K=0;K<Y.length;K++){const k=Y[K],_e=s.convert(k.format,k.colorSpace),ae=s.convert(k.type),he=T(k.internalFormat,_e,ae,k.colorSpace),He=Ne(_);N&&Fe(_)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,He,he,_.width,_.height):Fe(_)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,He,he,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,he,_.width,_.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ye(y,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,y),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Y=n.get(_.depthTexture);Y.__renderTarget=_,(!Y.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),$(_.depthTexture,0);const K=Y.__webglTexture,k=Ne(_);if(_.depthTexture.format===ni)Fe(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0,k):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0);else if(_.depthTexture.format===li)Fe(_)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0,k):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0);else throw new Error("Unknown depthTexture format")}function Re(y){const _=n.get(y),N=y.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==y.depthTexture){const Y=y.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),Y){const K=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,Y.removeEventListener("dispose",K)};Y.addEventListener("dispose",K),_.__depthDisposeCallback=K}_.__boundDepthTexture=Y}if(y.depthTexture&&!_.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");ye(_.__webglFramebuffer,y)}else if(N){_.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[Y]),_.__webglDepthbuffer[Y]===void 0)_.__webglDepthbuffer[Y]=i.createRenderbuffer(),se(_.__webglDepthbuffer[Y],y,!1);else{const K=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,k=_.__webglDepthbuffer[Y];i.bindRenderbuffer(i.RENDERBUFFER,k),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,k)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=i.createRenderbuffer(),se(_.__webglDepthbuffer,y,!1);else{const Y=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,K=_.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,K),i.framebufferRenderbuffer(i.FRAMEBUFFER,Y,i.RENDERBUFFER,K)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ue(y,_,N){const Y=n.get(y);_!==void 0&&me(Y.__webglFramebuffer,y,y.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&Re(y)}function et(y){const _=y.texture,N=n.get(y),Y=n.get(_);y.addEventListener("dispose",w);const K=y.textures,k=y.isWebGLCubeRenderTarget===!0,_e=K.length>1;if(_e||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=_.version,a.memory.textures++),k){N.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer[ae]=[];for(let he=0;he<_.mipmaps.length;he++)N.__webglFramebuffer[ae][he]=i.createFramebuffer()}else N.__webglFramebuffer[ae]=i.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer=[];for(let ae=0;ae<_.mipmaps.length;ae++)N.__webglFramebuffer[ae]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(_e)for(let ae=0,he=K.length;ae<he;ae++){const He=n.get(K[ae]);He.__webglTexture===void 0&&(He.__webglTexture=i.createTexture(),a.memory.textures++)}if(y.samples>0&&Fe(y)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let ae=0;ae<K.length;ae++){const he=K[ae];N.__webglColorRenderbuffer[ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[ae]);const He=s.convert(he.format,he.colorSpace),J=s.convert(he.type),fe=T(he.internalFormat,He,J,he.colorSpace,y.isXRRenderTarget===!0),Ee=Ne(y);i.renderbufferStorageMultisample(i.RENDERBUFFER,Ee,fe,y.width,y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ae,i.RENDERBUFFER,N.__webglColorRenderbuffer[ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),y.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),se(N.__webglDepthRenderbuffer,y,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(k){t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture),Le(i.TEXTURE_CUBE_MAP,_);for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0)for(let he=0;he<_.mipmaps.length;he++)me(N.__webglFramebuffer[ae][he],y,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,he);else me(N.__webglFramebuffer[ae],y,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);p(_)&&u(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_e){for(let ae=0,he=K.length;ae<he;ae++){const He=K[ae],J=n.get(He);t.bindTexture(i.TEXTURE_2D,J.__webglTexture),Le(i.TEXTURE_2D,He),me(N.__webglFramebuffer,y,He,i.COLOR_ATTACHMENT0+ae,i.TEXTURE_2D,0),p(He)&&u(i.TEXTURE_2D)}t.unbindTexture()}else{let ae=i.TEXTURE_2D;if((y.isWebGL3DRenderTarget||y.isWebGLArrayRenderTarget)&&(ae=y.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ae,Y.__webglTexture),Le(ae,_),_.mipmaps&&_.mipmaps.length>0)for(let he=0;he<_.mipmaps.length;he++)me(N.__webglFramebuffer[he],y,_,i.COLOR_ATTACHMENT0,ae,he);else me(N.__webglFramebuffer,y,_,i.COLOR_ATTACHMENT0,ae,0);p(_)&&u(ae),t.unbindTexture()}y.depthBuffer&&Re(y)}function ze(y){const _=y.textures;for(let N=0,Y=_.length;N<Y;N++){const K=_[N];if(p(K)){const k=A(y),_e=n.get(K).__webglTexture;t.bindTexture(k,_e),u(k),t.unbindTexture()}}}const it=[],b=[];function bt(y){if(y.samples>0){if(Fe(y)===!1){const _=y.textures,N=y.width,Y=y.height;let K=i.COLOR_BUFFER_BIT;const k=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_e=n.get(y),ae=_.length>1;if(ae)for(let he=0;he<_.length;he++)t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let he=0;he<_.length;he++){if(y.resolveDepthBuffer&&(y.depthBuffer&&(K|=i.DEPTH_BUFFER_BIT),y.stencilBuffer&&y.resolveStencilBuffer&&(K|=i.STENCIL_BUFFER_BIT)),ae){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,_e.__webglColorRenderbuffer[he]);const He=n.get(_[he]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,He,0)}i.blitFramebuffer(0,0,N,Y,0,0,N,Y,K,i.NEAREST),l===!0&&(it.length=0,b.length=0,it.push(i.COLOR_ATTACHMENT0+he),y.depthBuffer&&y.resolveDepthBuffer===!1&&(it.push(k),b.push(k),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,b)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,it))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ae)for(let he=0;he<_.length;he++){t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,_e.__webglColorRenderbuffer[he]);const He=n.get(_[he]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,He,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}else if(y.depthBuffer&&y.resolveDepthBuffer===!1&&l){const _=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[_])}}}function Ne(y){return Math.min(r.maxSamples,y.samples)}function Fe(y){const _=n.get(y);return y.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function ve(y){const _=a.render.frame;h.get(y)!==_&&(h.set(y,_),y.update())}function Je(y,_){const N=y.colorSpace,Y=y.format,K=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||N!==ci&&N!==un&&(ke.getTransfer(N)===Ze?(Y!==Ot||K!==tn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),_}function xe(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=q,this.setTexture2D=$,this.setTexture2DArray=G,this.setTexture3D=Q,this.setTextureCube=V,this.rebindTextures=Ue,this.setupRenderTarget=et,this.updateRenderTargetMipmap=ze,this.updateMultisampleRenderTarget=bt,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=me,this.useMultisampledRTT=Fe}function Bd(i,e){function t(n,r=un){let s;const a=ke.getTransfer(r);if(n===tn)return i.UNSIGNED_BYTE;if(n===Bs)return i.UNSIGNED_SHORT_4_4_4_4;if(n===zs)return i.UNSIGNED_SHORT_5_5_5_1;if(n===to)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Qa)return i.BYTE;if(n===eo)return i.SHORT;if(n===Ei)return i.UNSIGNED_SHORT;if(n===Os)return i.INT;if(n===Ln)return i.UNSIGNED_INT;if(n===jt)return i.FLOAT;if(n===yi)return i.HALF_FLOAT;if(n===no)return i.ALPHA;if(n===io)return i.RGB;if(n===Ot)return i.RGBA;if(n===ro)return i.LUMINANCE;if(n===so)return i.LUMINANCE_ALPHA;if(n===ni)return i.DEPTH_COMPONENT;if(n===li)return i.DEPTH_STENCIL;if(n===ao)return i.RED;if(n===Hs)return i.RED_INTEGER;if(n===oo)return i.RG;if(n===Vs)return i.RG_INTEGER;if(n===Gs)return i.RGBA_INTEGER;if(n===tr||n===nr||n===ir||n===rr)if(a===Ze)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===tr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===nr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ir)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===tr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===nr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ir)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===rr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===os||n===ls||n===cs||n===us)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===os)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ls)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===cs)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===us)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===hs||n===fs||n===ds)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===hs||n===fs)return a===Ze?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ds)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ps||n===ms||n===_s||n===gs||n===vs||n===xs||n===Ms||n===Ss||n===Es||n===ys||n===Ts||n===As||n===bs||n===Rs)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ps)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ms)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===_s)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===gs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===vs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===xs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ms)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ss)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Es)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ys)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ts)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===As)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Rs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===sr||n===ws||n===Cs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===sr)return a===Ze?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ws)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Cs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===lo||n===Ps||n===Ds||n===Ls)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===sr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ps)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ds)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ls)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===oi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const zd={type:"move"};class qr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ji,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 ji,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ji,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const M of e.hand.values()){const p=t.getJointPose(M,n),u=this._getHandJoint(c,M);p!==null&&(u.matrix.fromArray(p.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=p.radius),u.visible=p!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=h.position.distanceTo(d.position),m=.02,v=.005;c.inputState.pinching&&f>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zd)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ji;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Hd=` 3809void main() { 3810 3811 gl_Position = vec4( position, 1.0 ); 3812 3813}`,Vd=` 3814uniform sampler2DArray depthColor; 3815uniform float depthWidth; 3816uniform float depthHeight; 3817 3818void main() { 3819 3820 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3821 3822 if ( coord.x >= 1.0 ) { 3823 3824 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3825 3826 } else { 3827 3828 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3829 3830 } 3831 3832}`;class Gd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new vt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new mn({vertexShader:Hd,fragmentShader:Vd,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Qt(new fr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class kd extends hi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,f=null,m=null,v=null;const M=new Gd,p=t.getContextAttributes();let u=null,A=null;const T=[],E=[],U=new Be;let R=null;const w=new Pt;w.viewport=new rt;const I=new Pt;I.viewport=new rt;const S=[w,I],x=new cc;let C=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let ee=T[X];return ee===void 0&&(ee=new qr,T[X]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(X){let ee=T[X];return ee===void 0&&(ee=new qr,T[X]=ee),ee.getGripSpace()},this.getHand=function(X){let ee=T[X];return ee===void 0&&(ee=new qr,T[X]=ee),ee.getHandSpace()};function z(X){const ee=E.indexOf(X.inputSource);if(ee===-1)return;const me=T[ee];me!==void 0&&(me.update(X.inputSource,X.frame,c||a),me.dispatchEvent({type:X.t
vendor: 1,685 bytes, line 3832
3832ype,data:X.inputSource}))}function W(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",$);for(let X=0;X<T.length;X++){const ee=E[X];ee!==null&&(E[X]=null,T[X].disconnect(ee))}C=null,q=null,M.reset(),e.setRenderTarget(u),m=null,f=null,d=null,r=null,A=null,$e.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(U.width,U.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){o=X,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(X){c=X},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return d},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(X){if(r=X,r!==null){if(u=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",W),r.addEventListener("inputsourceschange",$),p.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(U),r.renderState.layers===void 0){const ee={antialias:p.antialias,alpha:!0,depth:
vendor: 5,928 bytes, line 3832
3832p.depth,stencil:p.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,ee),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),A=new Un(m.framebufferWidth,m.framebufferHeight,{format:Ot,type:tn,colorSpace:e.outputColorSpace,stencilBuffer:p.stencil})}else{let ee=null,me=null,se=null;p.depth&&(se=p.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ee=p.stencil?li:ni,me=p.stencil?oi:Ln);const ye={colorFormat:t.RGBA8,depthFormat:se,scaleFactor:s};d=new XRWebGLBinding(r,t),f=d.createProjectionLayer(ye),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),A=new Un(f.textureWidth,f.textureHeight,{format:Ot,type:tn,depthTexture:new Ao(f.textureWidth,f.textureHeight,me,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:p.stencil,colorSpace:e.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),$e.setContext(r),$e.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function $(X){for(let ee=0;ee<X.removed.length;ee++){const me=X.removed[ee],se=E.indexOf(me);se>=0&&(E[se]=null,T[se].disconnect(me))}for(let ee=0;ee<X.added.length;ee++){const me=X.added[ee];let se=E.indexOf(me);if(se===-1){for(let Re=0;Re<T.length;Re++)if(Re>=E.length){E.push(me),se=Re;break}else if(E[Re]===null){E[Re]=me,se=Re;break}if(se===-1)break}const ye=T[se];ye&&ye.connect(me)}}const G=new F,Q=new F;function V(X,ee,me){G.setFromMatrixPosition(ee.matrixWorld),Q.setFromMatrixPosition(me.matrixWorld);const se=G.distanceTo(Q),ye=ee.projectionMatrix.elements,Re=me.projectionMatrix.elements,Ue=ye[14]/(ye[10]-1),et=ye[14]/(ye[10]+1),ze=(ye[9]+1)/ye[5],it=(ye[9]-1)/ye[5],b=(ye[8]-1)/ye[0],bt=(Re[8]+1)/Re[0],Ne=Ue*b,Fe=Ue*bt,ve=se/(-b+bt),Je=ve*-b;if(ee.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(Je),X.translateZ(ve),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),ye[10]===-1)X.projectionMatrix.copy(ee.projectionMatrix),X.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const xe=Ue+ve,y=et+ve,_=Ne-Je,N=Fe+(se-Je),Y=ze*et/y*xe,K=it*et/y*xe;X.projectionMatrix.makePerspective(_,N,Y,K,xe,y),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function re(X,ee){ee===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(ee.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(r===null)return;let ee=X.near,me=X.far;M.texture!==null&&(M.depthNear>0&&(ee=M.depthNear),M.depthFar>0&&(me=M.depthFar)),x.near=I.near=w.near=ee,x.far=I.far=w.far=me,(C!==x.near||q!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),C=x.near,q=x.far),w.layers.mask=X.layers.mask|2,I.layers.mask=X.layers.mask|4,x.layers.mask=w.layers.mask|I.layers.mask;const se=X.parent,ye=x.cameras;re(x,se);for(let Re=0;Re<ye.length;Re++)re(ye[Re],se);ye.length===2?V(x,w,I):x.projectionMatrix.copy(w.projectionMatrix),ue(X,x,se)};function ue(X,ee,me){me===null?X.matrix.copy(ee.matrixWorld):(X.matrix.copy(me.matrixWorld),X.matrix.invert(),X.matrix.multiply(ee.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(ee.projectionMatrix),X.projectionMatrixInverse.copy(ee.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Is*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&m===null))return l},this.setFoveation=function(X){l=X,f!==null&&(f.fixedFoveation=X),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=X)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(x)};let ge=null;function Le(X,ee){if(h=ee.getViewerPose(c||a),v=ee,h!==null){const me=h.views;m!==null&&(e.setRenderTargetFramebuffer(A,m.framebuffer),e.setRenderTarget(A));let se=!1;me.length!==x.cameras.length&&(x.cameras.length=0,se=!0);for(let Re=0;Re<me.length;Re++){const Ue=me[Re];let et=null;if(m!==null)et=m.getViewport(Ue);else{const it=d.getViewSubImage(f,Ue);et=it.viewport,Re===0&&(e.setRenderTargetTextures(A,it.colorTexture,f.ignoreDepthValues?void 0:it.depthStencilTexture),e.setRenderTarget(A))}let ze=S[Re];ze===void 0&&(ze=new Pt,ze.layers.enable(Re),ze.viewport=new rt,S[Re]=ze),ze.matrix.fromArray(Ue.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(Ue.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(et.x,et.y,et.width,et.height),Re===0&&(x.matrix.copy(ze.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),se===!0&&x.cameras.push(ze)}const ye=r.enabledFeatures;if(ye&&ye.includes("depth-sensing")){const Re=d.getDepthInformation(me[0]);Re&&Re.isValid&&Re.texture&&M.init(e,Re,r.renderState)}}for(let me=0;me<T.length;me++){const se=E[me],ye=T[me];se!==null&&ye!==void 0&&ye.update(se,ee,c||a)}ge&&ge(X,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),v=null}const $e=new bo;$e.setAnimationLoop(Le),this.setAnimationLoop=function(X){ge=X},this.dispose=function(){}}}const Tn=new nn,Wd=new st;function Xd(i,e){function t(p,u){p.matrixAutoUpdate===!0&&p.updateMatrix(),u.value.copy(p.matrix)}function n(p,u){u.color.getRGB(p.fogColor.value,xo(i)),u.isFog?(p.fogNear.value=u.near,p.fogFar.value=u.far):u.isFogExp2&&(p.fogDensity.value=u.density)}function r(p,u,A,T,E){u.isMeshBasicMaterial||u.isMeshLambertMaterial?s(p,u):u.isMeshToonMaterial?(s(p,u),d(p,u)):u.isMeshPhongMaterial?(s(p,u),h(p,u)):u.isMeshStandardMaterial?(s(p,u),f(p,u),u.isMeshPhysicalMaterial&&m(p,u,E)):u.isMeshMat
vendor: 41,156 bytes, line 3832
3832capMaterial?(s(p,u),v(p,u)):u.isMeshDepthMaterial?s(p,u):u.isMeshDistanceMaterial?(s(p,u),M(p,u)):u.isMeshNormalMaterial?s(p,u):u.isLineBasicMaterial?(a(p,u),u.isLineDashedMaterial&&o(p,u)):u.isPointsMaterial?l(p,u,A,T):u.isSpriteMaterial?c(p,u):u.isShadowMaterial?(p.color.value.copy(u.color),p.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(p,u){p.opacity.value=u.opacity,u.color&&p.diffuse.value.copy(u.color),u.emissive&&p.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(p.map.value=u.map,t(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.bumpMap&&(p.bumpMap.value=u.bumpMap,t(u.bumpMap,p.bumpMapTransform),p.bumpScale.value=u.bumpScale,u.side===Mt&&(p.bumpScale.value*=-1)),u.normalMap&&(p.normalMap.value=u.normalMap,t(u.normalMap,p.normalMapTransform),p.normalScale.value.copy(u.normalScale),u.side===Mt&&p.normalScale.value.negate()),u.displacementMap&&(p.displacementMap.value=u.displacementMap,t(u.displacementMap,p.displacementMapTransform),p.displacementScale.value=u.displacementScale,p.displacementBias.value=u.displacementBias),u.emissiveMap&&(p.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,p.emissiveMapTransform)),u.specularMap&&(p.specularMap.value=u.specularMap,t(u.specularMap,p.specularMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest);const A=e.get(u),T=A.envMap,E=A.envMapRotation;T&&(p.envMap.value=T,Tn.copy(E),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),p.envMapRotation.value.setFromMatrix4(Wd.makeRotationFromEuler(Tn)),p.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=u.reflectivity,p.ior.value=u.ior,p.refractionRatio.value=u.refractionRatio),u.lightMap&&(p.lightMap.value=u.lightMap,p.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,p.lightMapTransform)),u.aoMap&&(p.aoMap.value=u.aoMap,p.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,p.aoMapTransform))}function a(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform))}function o(p,u){p.dashSize.value=u.dashSize,p.totalSize.value=u.dashSize+u.gapSize,p.scale.value=u.scale}function l(p,u,A,T){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.size.value=u.size*A,p.scale.value=T*.5,u.map&&(p.map.value=u.map,t(u.map,p.uvTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function c(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.rotation.value=u.rotation,u.map&&(p.map.value=u.map,t(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,t(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function h(p,u){p.specular.value.copy(u.specular),p.shininess.value=Math.max(u.shininess,1e-4)}function d(p,u){u.gradientMap&&(p.gradientMap.value=u.gradientMap)}function f(p,u){p.metalness.value=u.metalness,u.metalnessMap&&(p.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,p.metalnessMapTransform)),p.roughness.value=u.roughness,u.roughnessMap&&(p.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,p.roughnessMapTransform)),u.envMap&&(p.envMapIntensity.value=u.envMapIntensity)}function m(p,u,A){p.ior.value=u.ior,u.sheen>0&&(p.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),p.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(p.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,p.sheenColorMapTransform)),u.sheenRoughnessMap&&(p.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,p.sheenRoughnessMapTransform))),u.clearcoat>0&&(p.clearcoat.value=u.clearcoat,p.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(p.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,p.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(p.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===Mt&&p.clearcoatNormalScale.value.negate())),u.dispersion>0&&(p.dispersion.value=u.dispersion),u.iridescence>0&&(p.iridescence.value=u.iridescence,p.iridescenceIOR.value=u.iridescenceIOR,p.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(p.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,p.iridescenceMapTransform)),u.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),u.transmission>0&&(p.transmission.value=u.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),u.transmissionMap&&(p.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,p.transmissionMapTransform)),p.thickness.value=u.thickness,u.thicknessMap&&(p.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=u.attenuationDistance,p.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(p.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(p.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=u.specularIntensity,p.specularColor.value.copy(u.specularColor),u.specularColorMap&&(p.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,p.specularColorMapTransform)),u.specularIntensityMap&&(p.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,p.specularIntensityMapTransform))}function v(p,u){u.matcap&&(p.matcap.value=u.matcap)}function M(p,u){const A=e.get(u).light;p.referencePosition.value.setFromMatrixPosition(A.matrixWorld),p.nearDistance.value=A.shadow.camera.near,p.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function qd(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,T){const E=T.program;n.uniformBlockBinding(A,E)}function c(A,T){let E=r[A.id];E===void 0&&(v(A),E=h(A),r[A.id]=E,A.addEventListener("dispose",p));const U=T.program;n.updateUBOMapping(A,U);const R=e.render.frame;s[A.id]!==R&&(f(A),s[A.id]=R)}function h(A){const T=d();A.__bindingPointIndex=T;const E=i.createBuffer(),U=A.__size,R=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,U,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,E),E}function d(){for(let A=0;A<o;A++)if(a.indexOf(A)===-1)return a.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(A){const T=r[A.id],E=A.uniforms,U=A.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let R=0,w=E.length;R<w;R++){const I=Array.isArray(E[R])?E[R]:[E[R]];for(let S=0,x=I.length;S<x;S++){const C=I[S];if(m(C,R,S,U)===!0){const q=C.__offset,z=Array.isArray(C.value)?C.value:[C.value];let W=0;for(let $=0;$<z.length;$++){const G=z[$],Q=M(G);typeof G=="number"||typeof G=="boolean"?(C.__data[0]=G,i.bufferSubData(i.UNIFORM_BUFFER,q+W,C.__data)):G.isMatrix3?(C.__data[0]=G.elements[0],C.__data[1]=G.elements[1],C.__data[2]=G.elements[2],C.__data[3]=0,C.__data[4]=G.elements[3],C.__data[5]=G.elements[4],C.__data[6]=G.elements[5],C.__data[7]=0,C.__data[8]=G.elements[6],C.__data[9]=G.elements[7],C.__data[10]=G.elements[8],C.__data[11]=0):(G.toArray(C.__data,W),W+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,q,C.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(A,T,E,U){const R=A.value,w=T+"_"+E;if(U[w]===void 0)return typeof R=="number"||typeof R=="boolean"?U[w]=R:U[w]=R.clone(),!0;{const I=U[w];if(typeof R=="number"||typeof R=="boolean"){if(I!==R)return U[w]=R,!0}else if(I.equals(R)===!1)return I.copy(R),!0}return!1}function v(A){const T=A.uniforms;let E=0;const U=16;for(let w=0,I=T.length;w<I;w++){const S=Array.isArray(T[w])?T[w]:[T[w]];for(let x=0,C=S.length;x<C;x++){const q=S[x],z=Array.isArray(q.value)?q.value:[q.value];for(let W=0,$=z.length;W<$;W++){const G=z[W],Q=M(G),V=E%U,re=V%Q.boundary,ue=V+re;E+=re,ue!==0&&U-ue<Q.storage&&(E+=U-ue),q.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),q.__offset=E,E+=Q.storage}}}const R=E%U;return R>0&&(E+=U-R),A.__size=E,A.__cache={},this}function M(A){const T={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(T.boundary=4,T.storage=4):A.isVector2?(T.boundary=8,T.storage=8):A.isVector3||A.isColor?(T.boundary=16,T.storage=12):A.isVector4?(T.boundary=16,T.storage=16):A.isMatrix3?(T.boundary=48,T.storage=48):A.isMatrix4?(T.boundary=64,T.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),T}function p(A){const T=A.target;T.removeEventListener("dispose",p);const E=a.indexOf(T.__bindingPointIndex);a.splice(E,1),i.deleteBuffer(r[T.id]),delete r[T.id],delete s[T.id]}function u(){for(const A in r)i.deleteBuffer(r[A]);a=[],r={},s={}}return{bind:l,update:c,dispose:u}}class Yd{constructor(e={}){const{canvas:t=Rl(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const v=new Uint32Array(4),M=new Int32Array(4);let p=null,u=null;const A=[],T=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=At,this.toneMapping=fn,this.toneMappingExposure=1;const E=this;let U=!1,R=0,w=0,I=null,S=-1,x=null;const C=new rt,q=new rt;let z=null;const W=new Ye(0);let $=0,G=t.width,Q=t.height,V=1,re=null,ue=null;const ge=new rt(0,0,G,Q),Le=new rt(0,0,G,Q);let $e=!1;const X=new To;let ee=!1,me=!1;const se=new st,ye=new st,Re=new F,Ue=new rt,et={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ze=!1;function it(){return I===null?V:1}let b=n;function bt(g,D){return t.getContext(g,D)}try{const g={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Fs}`),t.addEventListener("webglcontextlost",Z,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",oe,!1),b===null){const D="webgl2";if(b=bt(D,g),b===null)throw bt(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(g){throw console.error("THREE.WebGLRenderer: "+g.message),g}let Ne,Fe,ve,Je,xe,y,_,N,Y,K,k,_e,ae,he,He,J,fe,Ee,Te,de,Oe,Pe,je,P;function ne(){Ne=new tf(b),Ne.init(),Pe=new Bd(b,Ne),Fe=new Kh(b,Ne,e,Pe),ve=new Fd(b,Ne),Fe.reverseDepthBuffer&&f&&ve.buffers.depth.setReversed(!0),Je=new sf(b),xe=new yd,y=new Od(b,Ne,ve,xe,Fe,Pe,Je),_=new jh(E),N=new ef(E),Y=new hc(b),je=new Yh(b,Y),K=new nf(b,Y,Je,je),k=new of(b,K,Y,Je),Te=new af(b,Fe,y),J=new $h(xe),_e=new Ed(E,_,N,Ne,Fe,je,J),ae=new Xd(E,xe),he=new Ad,He=new Dd(Ne),Ee=new qh(E,_,N,ve,k,m,l),fe=new Id(E,k,Fe),P=new qd(b,Je,Fe,ve),de=new Zh(b,Ne,Je),Oe=new rf(b,Ne,Je),Je.programs=_e.programs,E.capabilities=Fe,E.extensions=Ne,E.properties=xe,E.renderLists=he,E.shadowMap=fe,E.state=ve,E.info=Je}ne();const H=new kd(E,b);this.xr=H,this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){const g=Ne.get("WEBGL_lose_context");g&&g.loseContext()},this.forceContextRestore=function(){const g=Ne.get("WEBGL_lose_context");g&&g.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(g){g!==void 0&&(V=g,this.setSize(G,Q,!1))},this.getSize=function(g){return g.set(G,Q)},this.setSize=function(g,D,O=!0){if(H.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}G=g,Q=D,t.width=Math.floor(g*V),t.height=Math.floor(D*V),O===!0&&(t.style.width=g+"px",t.style.height=D+"px"),this.setViewport(0,0,g,D)},this.getDrawingBufferSize=function(g){return g.set(G*V,Q*V).floor()},this.setDrawingBufferSize=function(g,D,O){G=g,Q=D,V=O,t.width=Math.floor(g*O),t.height=Math.floor(D*O),this.setViewport(0,0,g,D)},this.getCurrentViewport=function(g){return g.copy(C)},this.getViewport=function(g){return g.copy(ge)},this.setViewport=function(g,D,O,B){g.isVector4?ge.set(g.x,g.y,g.z,g.w):ge.set(g,D,O,B),ve.viewport(C.copy(ge).multiplyScalar(V).round())},this.getScissor=function(g){return g.copy(Le)},this.setScissor=function(g,D,O,B){g.isVector4?Le.set(g.x,g.y,g.z,g.w):Le.set(g,D,O,B),ve.scissor(q.copy(Le).multiplyScalar(V).round())},this.getScissorTest=function(){return $e},this.setScissorTest=function(g){ve.setScissorTest($e=g)},this.setOpaqueSort=function(g){re=g},this.setTransparentSort=function(g){ue=g},this.getClearColor=function(g){return g.copy(Ee.getClearColor())},this.setClearColor=function(){Ee.setClearColor.apply(Ee,arguments)},this.getClearAlpha=function(){return Ee.getClearAlpha()},this.setClearAlpha=function(){Ee.setClearAlpha.apply(Ee,arguments)},this.clear=function(g=!0,D=!0,O=!0){let B=0;if(g){let L=!1;if(I!==null){const j=I.texture.format;L=j===Gs||j===Vs||j===Hs}if(L){const j=I.texture.type,ie=j===tn||j===Ln||j===Ei||j===oi||j===Bs||j===zs,ce=Ee.getClearColor(),pe=Ee.getClearAlpha(),Ae=ce.r,be=ce.g,Me=ce.b;ie?(v[0]=Ae,v[1]=be,v[2]=Me,v[3]=pe,b.clearBufferuiv(b.COLOR,0,v)):(M[0]=Ae,M[1]=be,M[2]=Me,M[3]=pe,b.clearBufferiv(b.COLOR,0,M))}else B|=b.COLOR_BUFFER_BIT}D&&(B|=b.DEPTH_BUFFER_BIT),O&&(B|=b.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),b.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Z,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",oe,!1),Ee.dispose(),he.dispose(),He.dispose(),xe.dispose(),_.dispose(),N.dispose(),k.dispose(),je.dispose(),P.dispose(),_e.dispose(),H.dispose(),H.removeEventListener("sessionstart",Xs),H.removeEventListener("sessionend",qs),gn.stop()};function Z(g){g.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),U=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),U=!1;const g=Je.autoReset,D=fe.enabled,O=fe.autoUpdate,B=fe.needsUpdate,L=fe.type;ne(),Je.autoReset=g,fe.enabled=D,fe.autoUpdate=O,fe.needsUpdate=B,fe.type=L}function oe(g){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",g.statusMessage)}function we(g){const D=g.target;D.removeEventListener("dispose",we),tt(D)}function tt(g){ft(g),xe.remove(g)}function ft(g){const D=xe.get(g).programs;D!==void 0&&(D.forEach(function(O){_e.releaseProgram(O)}),g.isShaderMaterial&&_e.releaseShaderCache(g))}this.renderBufferDirect=function(g,D,O,B,L,j){D===null&&(D=et);const ie=L.isMesh&&L.matrixWorld.determinant()<0,ce=Do(g,D,O,B,L);ve.setMaterial(B,ie);let pe=O.index,Ae=1;if(B.wireframe===!0){if(pe=K.getWireframeAttribute(O),pe===void 0)return;Ae=2}const be=O.drawRange,Me=O.attributes.position;let Ve=be.start*Ae,We=(be.start+be.count)*Ae;j!==null&&(Ve=Math.max(Ve,j.start*Ae),We=Math.min(We,(j.start+j.count)*Ae)),pe!==null?(Ve=Math.max(Ve,0),We=Math.min(We,pe.count)):Me!=null&&(Ve=Math.max(Ve,0),We=Math.min(We,Me.count));const at=We-Ve;if(at<0||at===1/0)return;je.setup(L,B,ce,O,pe);let nt,Ge=de;if(pe!==null&&(nt=Y.get(pe),Ge=Oe,Ge.setIndex(nt)),L.isMesh)B.wireframe===!0?(ve.setLineWidth(B.wireframeLinewidth*it()),Ge.setMode(b.LINES)):Ge.setMode(b.TRIANGLES);else if(L.isLine){let Se=B.linewidth;Se===void 0&&(Se=1),ve.setLineWidth(Se*it()),L.isLineSegments?Ge.setMode(b.LINES):L.isLineLoop?Ge.setMode(b.LINE_LOOP):Ge.setMode(b.LINE_STRIP)}else L.isPoints?Ge.setMode(b.POINTS):L.isSprite&&Ge.setMode(b.TRIANGLES);if(L.isBatchedMesh)if(L._multiDrawInstances!==null)Ge.renderMultiDrawInstances(L._multiDrawStarts,L._multiDrawCounts,L._multiDrawCount,L._multiDrawInstances);else if(Ne.get("WEBGL_multi_draw"))Ge.renderMultiDraw(L._multiDrawStarts,L._multiDrawCounts,L._multiDrawCount);else{const Se=L._multiDrawStarts,ht=L._multiDrawCounts,Xe=L._multiDrawCount,Ut=pe?Y.get(pe).bytesPerElement:1,In=xe.get(B).currentProgram.getUniforms();for(let Et=0;Et<Xe;Et++)In.setValue(b,"_gl_DrawID",Et),Ge.render(Se[Et]/Ut,ht[Et])}else if(L.isInstancedMesh)Ge.renderInstances(Ve,at,L.count);else if(O.isInstancedBufferGeometry){const Se=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,ht=Math.min(O.instanceCount,Se);Ge.renderInstances(Ve,at,ht)}else Ge.render(Ve,at)};function qe(g,D,O){g.transparent===!0&&g.side===$t&&g.forceSinglePass===!1?(g.side=Mt,g.needsUpdate=!0,Ci(g,D,O),g.side=pn,g.needsUpdate=!0,Ci(g,D,O),g.side=$t):Ci(g,D,O)}this.compile=function(g,D,O=null){O===null&&(O=g),u=He.get(O),u.init(D),T.push(u),O.traverseVisible(function(L){L.isLight&&L.layers.test(D.layers)&&(u.pushLight(L),L.castShadow&&u.pushShadow(L))}),g!==O&&g.traverseVisible(function(L){L.isLight&&L.layers.test(D.layers)&&(u.pushLight(L),L.castShadow&&u.pushShadow(L))}),u.setupLights();const B=new Set;return g.traverse(function(L){if(!(L.isMesh||L.isPoints||L.isLine||L.isSprite))return;const j=L.material;if(j)if(Array.isArray(j))for(let ie=0;ie<j.length;ie++){const ce=j[ie];qe(ce,O,L),B.add(ce)}else qe(j,O,L),B.add(j)}),T.pop(),u=null,B},this.compileAsync=function(g,D,O=null){const B=this.compile(g,D,O);return new Promise(L=>{function j(){if(B.forEach(function(ie){xe.get(ie).currentProgram.isReady()&&B.delete(ie)}),B.size===0){L(g);return}setTimeout(j,10)}Ne.get("KHR_parallel_shader_compile")!==null?j():setTimeout(j,10)})};let Lt=null;function kt(g){Lt&&Lt(g)}function Xs(){gn.stop()}function qs(){gn.start()}const gn=new bo;gn.setAnimationLoop(kt),typeof self<"u"&&gn.setContext(self),this.setAnimationLoop=function(g){Lt=g,H.setAnimationLoop(g),g===null?gn.stop():gn.start()},H.addEventListener("sessionstart",Xs),H.addEventListener("sessionend",qs),this.render=function(g,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;if(g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),H.enabled===!0&&H.isPresenting===!0&&(H.cameraAutoUpdate===!0&&H.updateCamera(D),D=H.getCamera()),g.isScene===!0&&g.onBeforeRender(E,g,D,I),u=He.get(g,T.length),u.init(D),T.push(u),ye.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),X.setFromProjectionMatrix(ye),me=this.localClippingEnabled,ee=J.init(this.clippingPlanes,me),p=he.get(g,A.length),p.init(),A.push(p),H.enabled===!0&&H.isPresenting===!0){const j=E.xr.getDepthSensingMesh();j!==null&&pr(j,D,-1/0,E.sortObjects)}pr(g,D,0,E.sortObjects),p.finish(),E.sortObjects===!0&&p.sort(re,ue),ze=H.enabled===!1||H.isPresenting===!1||H.hasDepthSensing()===!1,ze&&Ee.addToRenderList(p,g),this.info.render.frame++,ee===!0&&J.beginShadows();const O=u.state.shadowsArray;fe.render(O,g,D),ee===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset();const B=p.opaque,L=p.transmissive;if(u.setupLights(),D.isArrayCamera){const j=D.cameras;if(L.length>0)for(let ie=0,ce=j.length;ie<ce;ie++){const pe=j[ie];Zs(B,L,g,pe)}ze&&Ee.render(g);for(let ie=0,ce=j.length;ie<ce;ie++){const pe=j[ie];Ys(p,g,pe,pe.viewport)}}else L.length>0&&Zs(B,L,g,D),ze&&Ee.render(g),Ys(p,g,D);I!==null&&(y.updateMultisampleRenderTarget(I),y.updateRenderTargetMipmap(I)),g.isScene===!0&&g.onAfterRender(E,g,D),je.resetDefaultState(),S=-1,x=null,T.pop(),T.length>0?(u=T[T.length-1],ee===!0&&J.setGlobalState(E.clippingPlanes,u.state.camera)):u=null,A.pop(),A.length>0?p=A[A.length-1]:p=null};function pr(g,D,O,B){if(g.visible===!1)return;if(g.layers.test(D.layers)){if(g.isGroup)O=g.renderOrder;else if(g.isLOD)g.autoUpdate===!0&&g.update(D);else if(g.isLight)u.pushLight(g),g.castShadow&&u.pushShadow(g);else if(g.isSprite){if(!g.frustumCulled||X.intersectsSprite(g)){B&&Ue.setFromMatrixPosition(g.matrixWorld).applyMatrix4(ye);const ie=k.update(g),ce=g.material;ce.visible&&p.push(g,ie,ce,O,Ue.z,null)}}else if((g.isMesh||g.isLine||g.isPoints)&&(!g.frustumCulled||X.intersectsObject(g))){const ie=k.update(g),ce=g.material;if(B&&(g.boundingSphere!==void 0?(g.boundingSphere===null&&g.computeBoundingSphere(),Ue.copy(g.boundingSphere.center)):(ie.boundingSphere===null&&ie.computeBoundingSphere(),Ue.copy(ie.boundingSphere.center)),Ue.applyMatrix4(g.matrixWorld).applyMatrix4(ye)),Array.isArray(ce)){const pe=ie.groups;for(let Ae=0,be=pe.length;Ae<be;Ae++){const Me=pe[Ae],Ve=ce[Me.materialIndex];Ve&&Ve.visible&&p.push(g,ie,Ve,O,Ue.z,Me)}}else ce.visible&&p.push(g,ie,ce,O,Ue.z,null)}}const j=g.children;for(let ie=0,ce=j.length;ie<ce;ie++)pr(j[ie],D,O,B)}function Ys(g,D,O,B){const L=g.opaque,j=g.transmissive,ie=g.transparent;u.setupLightsView(O),ee===!0&&J.setGlobalState(E.clippingPlanes,O),B&&ve.viewport(C.copy(B)),L.length>0&&wi(L,D,O),j.length>0&&wi(j,D,O),ie.length>0&&wi(ie,D,O),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function Zs(g,D,O,B){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;u.state.transmissionRenderTarget[B.id]===void 0&&(u.state.transmissionRenderTarget[B.id]=new Un(1,1,{generateMipmaps:!0,type:Ne.has("EXT_color_buffer_half_float")||Ne.has("EXT_color_buffer_float")?yi:tn,minFilter:Pn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ke.workingColorSpace}));const j=u.state.transmissionRenderTarget[B.id],ie=B.viewport||C;j.setSize(ie.z,ie.w);const ce=E.getRenderTarget();E.setRenderTarget(j),E.getClearColor(W),$=E.getClearAlpha(),$<1&&E.setClearColor(16777215,.5),E.clear(),ze&&Ee.render(O);const pe=E.toneMapping;E.toneMapping=fn;const Ae=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),u.setupLightsView(B),ee===!0&&J.setGlobalState(E.clippingPlanes,B),wi(g,O,B),y.updateMultisampleRenderTarget(j),y.updateRenderTargetMipmap(j),Ne.has("WEBGL_multisampled_render_to_texture")===!1){let be=!1;for(let Me=0,Ve=D.length;Me<Ve;Me++){const We=D[Me],at=We.object,nt=We.geometry,Ge=We.material,Se=We.group;if(Ge.side===$t&&at.layers.test(B.layers)){const ht=Ge.side;Ge.side=Mt,Ge.needsUpdate=!0,Ks(at,O,B,nt,Ge,Se),Ge.side=ht,Ge.needsUpdate=!0,be=!0}}be===!0&&(y.updateMultisampleRenderTarget(j),y.updateRenderTargetMipmap(j))}E.setRenderTarget(ce),E.setClearColor(W,$),Ae!==void 0&&(B.viewport=Ae),E.toneMapping=pe}function wi(g,D,O){const B=D.isScene===!0?D.overrideMaterial:null;for(let L=0,j=g.length;L<j;L++){const ie=g[L],ce=ie.object,pe=ie.geometry,Ae=B===null?ie.material:B,be=ie.group;ce.layers.test(O.layers)&&Ks(ce,D,O,pe,Ae,be)}}function Ks(g,D,O,B,L,j){g.onBeforeRender(E,D,O,B,L,j),g.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,g.matrixWorld),g.normalMatrix.getNormalMatrix(g.modelViewMatrix),L.onBeforeRender(E,D,O,B,g,j),L.transparent===!0&&L.side===$t&&L.forceSinglePass===!1?(L.side=Mt,L.needsUpdate=!0,E.renderBufferDirect(O,D,B,L,g,j),L.side=pn,L.needsUpdate=!0,E.renderBufferDirect(O,D,B,L,g,j),L.side=$t):E.renderBufferDirect(O,D,B,L,g,j),g.onAfterRender(E,D,O,B,L,j)}function Ci(g,D,O){D.isScene!==!0&&(D=et);const B=xe.get(g),L=u.state.lights,j=u.state.shadowsArray,ie=L.state.version,ce=_e.getParameters(g,L.state,j,D,O),pe=_e.getProgramCacheKey(ce);let Ae=B.programs;B.environment=g.isMeshStandardMaterial?D.environment:null,B.fog=D.fog,B.envMap=(g.isMeshStandardMaterial?N:_).get(g.envMap||B.environment),B.envMapRotation=B.environment!==null&&g.envMap===null?D.environmentRotation:g.envMapRotation,Ae===void 0&&(g.addEventListener("dispose",we),Ae=new Map,B.programs=Ae);let be=Ae.get(pe);if(be!==void 0){if(B.currentProgram===be&&B.lightsStateVersion===ie)return js(g,ce),be}else ce.uniforms=_e.getUniforms(g),g.onBeforeCompile(ce,E),be=_e.acquireProgram(ce,pe),Ae.set(pe,be),B.uniforms=ce.uniforms;const Me=B.uniforms;return(!g.isShaderMaterial&&!g.isRawShaderMaterial||g.clipping===!0)&&(Me.clippingPlanes=J.uniform),js(g,ce),B.needsLights=Uo(g),B.lightsStateVersion=ie,B.needsLights&&(Me.ambientLightColor.value=L.state.ambient,Me.lightProbe.value=L.state.probe,Me.directionalLights.value=L.state.directional,Me.directionalLightShadows.value=L.state.directionalShadow,Me.spotLights.value=L.state.spot,Me.spotLightShadows.value=L.state.spotShadow,Me.rectAreaLights.value=L.state.rectArea,Me.ltc_1.value=L.state.rectAreaLTC1,Me.ltc_2.value=L.state.rectAreaLTC2,Me.pointLights.value=L.state.point,Me.pointLightShadows.value=L.state.pointShadow,Me.hemisphereLights.value=L.state.hemi,Me.directionalShadowMap.value=L.state.directionalShadowMap,Me.directionalShadowMatrix.value=L.state.directionalShadowMatrix,Me.spotShadowMap.value=L.state.spotShadowMap,Me.spotLightMatrix.value=L.state.spotLightMatrix,Me.spotLightMap.value=L.state.spotLightMap,Me.pointShadowMap.value=L.state.pointShadowMap,Me.pointShadowMatrix.value=L.state.pointShadowMatrix),B.currentProgram=be,B.uniformsList=null,be}function $s(g){if(g.uniformsList===null){const D=g.currentProgram.getUniforms();g.uniformsList=ar.seqWithValue(D.seq,g.uniforms)}return g.uniformsList}function js(g,D){const O=xe.get(g);O.outputColorSpace=D.outputColorSpace,O.batching=D.batching,O.batchingColor=D.batchingColor,O.instancing=D.instancing,O.instancingColor=D.instancingColor,O.instancingMorph=D.instancingMorph,O.skinning=D.skinning,O.morphTargets=D.morphTargets,O.morphNormals=D.morphNormals,O.morphColors=D.morphColors,O.morphTargetsCount=D.morphTargetsCount,O.numClippingPlanes=D.numClippingPlanes,O.numIntersection=D.numClipIntersection,O.vertexAlphas=D.vertexAlphas,O.vertexTangents=D.vertexTangents,O.toneMapping=D.toneMapping}function Do(g,D,O,B,L){D.isScene!==!0&&(D=et),y.resetTextureUnits();const j=D.fog,ie=B.isMeshStandardMaterial?D.environment:null,ce=I===null?E.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:ci,pe=(B.isMeshStandardMaterial?N:_).get(B.envMap||ie),Ae=B.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,be=!!O.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Me=!!O.morphAttributes.position,Ve=!!O.morphAttributes.normal,We=!!O.morphAttributes.color;let at=fn;B.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(at=E.toneMapping);const nt=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,Ge=nt!==void 0?nt.length:0,Se=xe.get(B),ht=u.state.lights;if(ee===!0&&(me===!0||g!==x)){const mt=g===x&&B.id===S;J.setState(B,g,mt)}let Xe=!1;B.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==ht.state.version||Se.outputColorSpace!==ce||L.isBatchedMesh&&Se.batching===!1||!L.isBatchedMesh&&Se.batching===!0||L.isBatchedMesh&&Se.batchingColor===!0&&L.colorTexture===null||L.isBatchedMesh&&Se.batchingColor===!1&&L.colorTexture!==null||L.isInstancedMesh&&Se.instancing===!1||!L.isInstancedMesh&&Se.instancing===!0||L.isSkinnedMesh&&Se.skinning===!1||!L.isSkinnedMesh&&Se.skinning===!0||L.isInstancedMesh&&Se.instancingColor===!0&&L.instanceColor===null||L.isInstancedMesh&&Se.instancingColor===!1&&L.instanceColor!==null||L.isInstancedMesh&&Se.instancingMorph===!0&&L.morphTexture===null||L.isInstancedMesh&&Se.instancingMorph===!1&&L.morphTexture!==null||Se.envMap!==pe||B.fog===!0&&Se.fog!==j||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==J.numPlanes||Se.numIntersection!==J.numIntersection)||Se.vertexAlphas!==Ae||Se.vertexTangents!==be||Se.morphTargets!==Me||Se.morphNormals!==Ve||Se.morphColors!==We||Se.toneMapping!==at||Se.morphTargetsCount!==Ge)&&(Xe=!0):(Xe=!0,Se.__version=B.version);let Ut=Se.currentProgram;Xe===!0&&(Ut=Ci(B,D,L));let In=!1,Et=!1,di=!1;const Qe=Ut.getUniforms(),Rt=Se.uniforms;if(ve.useProgram(Ut.program)&&(In=!0,Et=!0,di=!0),B.id!==S&&(S=B.id,Et=!0),In||x!==g){ve.buffers.depth.getReversed()?(se.copy(g.projectionMatrix),Cl(se),Pl(se),Qe.setValue(b,"projectionMatrix",se)):Qe.setValue(b,"projectionMatrix",g.projectionMatrix),Qe.setValue(b,"viewMatrix",g.matrixWorldInverse);const xt=Qe.map.cameraPosition;xt!==void 0&&xt.setValue(b,Re.setFromMatrixPosition(g.matrixWorld)),Fe.logarithmicDepthBuffer&&Qe.setValue(b,"logDepthBufFC",2/(Math.log(g.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&Qe.setValue(b,"isOrthographic",g.isOrthographicCamera===!0),x!==g&&(x=g,Et=!0,di=!0)}if(L.isSkinnedMesh){Qe.setOptional(b,L,"bindMatrix"),Qe.setOptional(b,L,"bindMatrixInverse");const mt=L.skeleton;mt&&(mt.boneTexture===null&&mt.computeBoneTexture(),Qe.setValue(b,"boneTexture",mt.boneTexture,y))}L.isBatchedMesh&&(Qe.setOptional(b,L,"batchingTexture"),Qe.setValue(b,"batchingTexture",L._matricesTexture,y),Qe.setOptional(b,L,"batchingIdTexture"),Qe.setValue(b,"batchingIdTexture",L._indirectTexture,y),Qe.setOptional(b,L,"batchingColorTexture"),L._colorsTexture!==null&&Qe.setValue(b,"batchingColorTexture",L._colorsTexture,y));const wt=O.morphAttributes;if((wt.position!==void 0||wt.normal!==void 0||wt.color!==void 0)&&Te.update(L,O,Ut),(Et||Se.receiveShadow!==L.receiveShadow)&&(Se.receiveShadow=L.receiveShadow,Qe.setValue(b,"receiveShadow",L.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(Rt.envMap.value=pe,Rt.flipEnvMap.value=pe.isCubeTexture&&pe.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&&B.envMap===null&&D.environment!==null&&(Rt.envMapIntensity.value=D.environmentIntensity),Et&&(Qe.setValue(b,"toneMappingExposure",E.toneMappingExposure),Se.needsLights&&Lo(Rt,di),j&&B.fog===!0&&ae.refreshFogUniforms(Rt,j),ae.refreshMaterialUniforms(Rt,B,V,Q,u.state.transmissionRenderTarget[g.id]),ar.upload(b,$s(Se),Rt,y)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(ar.upload(b,$s(Se),Rt,y),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&Qe.setValue(b,"center",L.center),Qe.setValue(b,"modelViewMatrix",L.modelViewMatrix),Qe.setValue(b,"normalMatrix",L.normalMatrix),Qe.setValue(b,"modelMatrix",L.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const mt=B.uniformsGroups;for(let xt=0,mr=mt.length;xt<mr;xt++){const vn=mt[xt];P.update(vn,Ut),P.bind(vn,Ut)}}return Ut}function Lo(g,D){g.ambientLightColor.needsUpdate=D,g.lightProbe.needsUpdate=D,g.directionalLights.needsUpdate=D,g.directionalLightShadows.needsUpdate=D,g.pointLights.needsUpdate=D,g.pointLightShadows.needsUpdate=D,g.spotLights.needsUpdate=D,g.spotLightShadows.needsUpdate=D,g.rectAreaLights.needsUpdate=D,g.hemisphereLights.needsUpdate=D}function Uo(g){return g.isMeshLambertMaterial||g.isMeshToonMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isShadowMaterial||g.isShaderMaterial&&g.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(g,D,O){xe.get(g.texture).__webglTexture=D,xe.get(g.depthTexture).__webglTexture=O;const B=xe.get(g);B.__hasExternalTextures=!0,B.__autoAllocateDepthBuffer=O===void 0,B.__autoAllocateDepthBuffer||Ne.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),B.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(g,D){const O=xe.get(g);O.__webglFramebuffer=D,O.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(g,D=0,O=0){I=g,R=D,w=O;let B=!0,L=null,j=!1,ie=!1;if(g){const pe=xe.get(g);if(pe.__useDefaultFramebuffer!==void 0)ve.bindFramebuffer(b.FRAMEBUFFER,null),B=!1;else if(pe.__webglFramebuffer===void 0)y.setupRenderTarget(g);else if(pe.__hasExternalTextures)y.rebindTextures(g,xe.get(g.texture).__webglTexture,xe.get(g.depthTexture).__webglTexture);else if(g.depthBuffer){const Me=g.depthTexture;if(pe.__boundDepthTexture!==Me){if(Me!==null&&xe.has(Me)&&(g.width!==Me.image.width||g.height!==Me.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");y.setupDepthRenderbuffer(g)}}const Ae=g.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ie=!0);const be=xe.get(g).__webglFramebuffer;g.isWebGLCubeRenderTarget?(Array.isArray(be[D])?L=be[D][O]:L=be[D],j=!0):g.samples>0&&y.useMultisampledRTT(g)===!1?L=xe.get(g).__webglMultisampledFramebuffer:Array.isArray(be)?L=be[O]:L=be,C.copy(g.viewport),q.copy(g.scissor),z=g.scissorTest}else C.copy(ge).multiplyScalar(V).floor(),q.copy(Le).multiplyScalar(V).floor(),z=$e;if(ve.bindFramebuffer(b.FRAMEBUFFER,L)&&B&&ve.drawBuffers(g,L),ve.viewport(C),ve.scissor(q),ve.setScissorTest(z),j){const pe=xe.get(g.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+D,pe.__webglTexture,O)}else if(ie){const pe=xe.get(g.texture),Ae=D||0;b.framebufferTextureLayer(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,pe.__webglTexture,O||0,Ae)}S=-1},this.readRenderTargetPixels=function(g,D,O,B,L,j,ie){if(!(g&&g.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ce=xe.get(g).__webglFramebuffer;if(g.isWebGLCubeRenderTarget&&ie!==void 0&&(ce=ce[ie]),ce){ve.bindFramebuffer(b.FRAMEBUFFER,ce);try{const pe=g.texture,Ae=pe.format,be=pe.type;if(!Fe.textureFormatReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Fe.textureTypeReadable(be)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=g.width-B&&O>=0&&O<=g.height-L&&b.readPixels(D,O,B,L,Pe.convert(Ae),Pe.convert(be),j)}finally{const pe=I!==null?xe.get(I).__webglFramebuffer:null;ve.bindFramebuffer(b.FRAMEBUFFER,pe)}}},this.readRenderTargetPixelsAsync=async function(g,D,O,B,L,j,ie){if(!(g&&g.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ce=xe.get(g).__webglFramebuffer;if(g.isWebGLCubeRenderTarget&&ie!==void 0&&(ce=ce[ie]),ce){const pe=g.texture,Ae=pe.format,be=pe.type;if(!Fe.textureFormatReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Fe.textureTypeReadable(be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=g.width-B&&O>=0&&O<=g.height-L){ve.bindFramebuffer(b.FRAMEBUFFER,ce);const Me=b.createBuffer();b.bindBuffer(b.PIXEL_PACK_BUFFER,Me),b.bufferData(b.PIXEL_PACK_BUFFER,j.byteLength,b.STREAM_READ),b.readPixels(D,O,B,L,Pe.convert(Ae),Pe.convert(be),0);const Ve=I!==null?xe.get(I).__webglFramebuffer:null;ve.bindFramebuffer(b.FRAMEBUFFER,Ve);const We=b.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);return b.flush(),await wl(b,We,4),b.bindBuffer(b.PIXEL_PACK_BUFFER,Me),b.getBufferSubData(b.PIXEL_PACK_BUFFER,0,j),b.deleteBuffer(Me),b.deleteSync(We),j}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(g,D=null,O=0){g.isTexture!==!0&&(Qn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,g=arguments[1]);const B=Math.pow(2,-O),L=Math.floor(g.image.width*B),j=Math.floor(g.image.height*B),ie=D!==null?D.x:0,ce=D!==null?D.y:0;y.setTexture2D(g,0),b.copyTexSubImage2D(b.TEXTURE_2D,O,0,0,ie,ce,L,j),ve.unbindTexture()};const Io=b.createFramebuffer(),No=b.createFramebuffer();this.copyTextureToTexture=function(g,D,O=null,B=null,L=0,j=null){g.isTexture!==!0&&(Qn("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,g=arguments[1],D=arguments[2],j=arguments[3]||0,O=null),j===null&&(L!==0?(Qn("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),j=L,L=0):j=0);let ie,ce,pe,Ae,be,Me,Ve,We,at;const nt=g.isCompressedTexture?g.mipmaps[j]:g.image;if(O!==null)ie=O.max.x-O.min.x,ce=O.max.y-O.min.y,pe=O.isBox3?O.max.z-O.min.z:1,Ae=O.min.x,be=O.min.y,Me=O.isBox3?O.min.z:0;else{const wt=Math.pow(2,-L);ie=Math.floor(nt.width*wt),ce=Math.floor(nt.height*wt),g.isDataArrayTexture?pe=nt.depth:g.isData3DTexture?pe=Math.floor(nt.depth*wt):pe=1,Ae=0,be=0,Me=0}B!==null?(Ve=B.x,We=B.y,at=B.z):(Ve=0,We=0,at=0);const Ge=Pe.convert(D.format),Se=Pe.convert(D.type);let ht;D.isData3DTexture?(y.setTexture3D(D,0),ht=b.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(y.setTexture2DArray(D,0),ht=b.TEXTURE_2D_ARRAY):(y.setTexture2D(D,0),ht=b.TEXTURE_2D),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,D.flipY),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),b.pixelStorei(b.UNPACK_ALIGNMENT,D.unpackAlignment);const Xe=b.getParameter(b.UNPACK_ROW_LENGTH),Ut=b.getParameter(b.UNPACK_IMAGE_HEIGHT),In=b.getParameter(b.UNPACK_SKIP_PIXELS),Et=b.getParameter(b.UNPACK_SKIP_ROWS),di=b.getParameter(b.UNPACK_SKIP_IMAGES);b.pixelStorei(b.UNPACK_ROW_LENGTH,nt.width),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,nt.height),b.pixelStorei(b.UNPACK_SKIP_PIXELS,Ae),b.pixelStorei(b.UNPACK_SKIP_ROWS,be),b.pixelStorei(b.UNPACK_SKIP_IMAGES,Me);const Qe=g.isDataArrayTexture||g.isData3DTexture,Rt=D.isDataArrayTexture||D.isData3DTexture;if(g.isDepthTexture){const wt=xe.get(g),mt=xe.get(D),xt=xe.get(wt.__renderTarget),mr=xe.get(mt.__renderTarget);ve.bindFramebuffer(b.READ_FRAMEBUFFER,xt.__webglFramebuffer),ve.bindFramebuffer(b.DRAW_FRAMEBUFFER,mr.__webglFramebuffer);for(let vn=0;vn<pe;vn++)Qe&&(b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,xe.get(g).__webglTexture,L,Me+vn),b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,xe.get(D).__webglTexture,j,at+vn)),b.blitFramebuffer(Ae,be,ie,ce,Ve,We,ie,ce,b.DEPTH_BUFFER_BIT,b.NEAREST);ve.bindFramebuffer(b.READ_FRAMEBUFFER,null),ve.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else if(L!==0||g.isRenderTargetTexture||xe.has(g)){const wt=xe.get(g),mt=xe.get(D);ve.bindFramebuffer(b.READ_FRAMEBUFFER,Io),ve.bindFramebuffer(b.DRAW_FRAMEBUFFER,No);for(let xt=0;xt<pe;xt++)Qe?b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,wt.__webglTexture,L,Me+xt):b.framebufferTexture2D(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,wt.__webglTexture,L),Rt?b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,mt.__webglTexture,j,at+xt):b.framebufferTexture2D(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,mt.__webglTexture,j),L!==0?b.blitFramebuffer(Ae,be,ie,ce,Ve,We,ie,ce,b.COLOR_BUFFER_BIT,b.NEAREST):Rt?b.copyTexSubImage3D(ht,j,Ve,We,at+xt,Ae,be,ie,ce):b.copyTexSubImage2D(ht,j,Ve,We,Ae,be,ie,ce);ve.bindFramebuffer(b.READ_FRAMEBUFFER,null),ve.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else Rt?g.isDataTexture||g.isData3DTexture?b.texSubImage3D(ht,j,Ve,We,at,ie,ce,pe,Ge,Se,nt.data):D.isCompressedArrayTexture?b.compressedTexSubImage3D(ht,j,Ve,We,at,ie,ce,pe,Ge,nt.data):b.texSubImage3D(ht,j,Ve,We,at,ie,ce,pe,Ge,Se,nt):g.isDataTexture?b.texSubImage2D(b.TEXTURE_2D,j,Ve,We,ie,ce,Ge,Se,nt.data):g.isCompressedTexture?b.compressedTexSubImage2D(b.TEXTURE_2D,j,Ve,We,nt.width,nt.height,Ge,nt.data):b.texSubImage2D(b.TEXTURE_2D,j,Ve,We,ie,ce,Ge,Se,nt);b.pixelStorei(b.UNPACK_ROW_LENGTH,Xe),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,Ut),b.pixelStorei(b.UNPACK_SKIP_PIXELS,In),b.pixelStorei(b.UNPACK_SKIP_ROWS,Et),b.pixelStorei(b.UNPACK_SKIP_IMAGES,di),j===0&&D.generateMipmaps&&b.generateMipmap(ht),ve.unbindTexture()},this.copyTextureToTexture3D=function(g,D,O=null,B=null,L=0){return g.isTexture!==!0&&(Qn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),O=arguments[0]||null,B=arguments[1]||null,g=arguments[2],D=arguments[3],L=arguments[4]||0),Qn('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(g,D,O,B,L)},this.initRenderTarget=function(g){xe.get(g).__webglFramebuffer===void 0&&y.setupRenderTarget(g)},this.initTexture=function(g){g.isCubeTexture?y.setTextureCube(g,0):g.isData3DTexture?y.setTexture3D(g,0):g.isDataArrayTexture||g.isCompressedArrayTexture?y.setTexture2DArray(g,0):y.setTexture2D(g,0),ve.unbindTexture()},this.resetState=function(){R=0,w=0,I=null,ve.reset(),je.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Jt}get outputColorSpace(){return this._outputColorSpace}
3832set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=ke._getDrawingBufferColorSpace(e),t.unpackColorSpace=ke._getUnpackColorSpace()}}const Yr=36,Ka=.012;function Zd(){const i=Oo.flatMap(t=>t.metadata.keywords);return Array.from(new Set(i)).filter(t=>t.length<=18).slice(0,24)}function Kd(i){const e=document.createElement("canvas");e.width=256,e.height=40;const t=e.getContext("2d");t.font='20px "Space Mono", monospace',t.fillStyle="rgba(110, 255, 160, 1)",t.textBaseline="middle",t.fillText(i,4,20);const n=new sc(e);return n.colorSpace=At,n}function jd(){const i=Js.useRef(null);return Js.useEffect(()=>{const e=i.current;if(!e)return;const t=new Yd({alpha:!0,antialias:!1});t.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),t.setSize(e.clientWidth,e.clientHeight),e.appendChild(t.domElement);const n=new ec,r=new Pt(50,e.clientWidth/e.clientHeight,.1,30);r.position.z=10;const a=Zd().map(Kd),o=[];for(let A=0;A<Yr;A++){const T=a[A%a.length],E=new Eo({map:T,transparent:!0,opacity:.05+A%4*.01,depthWrite:!1}),U=new nc(E),R=1.4+A%3*.5;U.scale.set(R*3.2,R*.5,1),U.position.set(A/Yr*24-12+A*7%5-2,A*13%14-7,-2-A%5);const w=A/Yr*Math.PI*2;o.push({s:U,vx:Math.cos(w)*Ka,vy:Math.sin(w)*Ka*.6}),n.add(U)}let l=0,c=0;const h=A=>{l=(A.clientX/window.innerWidth-.5)*.24,c=-(A.clientY/window.innerHeight-.5)*.16};window.addEventListener("pointermove",h,{passive:!0});let d=!0,f=0,m=performance.now();const v=A=>{if(f=requestAnimationFrame(v),!d)return;const T=Math.min((A-m)/1e3,.05);m=A;for(const{s:E,vx:U,vy:R}of o)E.position.x+=U*T*60,E.position.y+=R*T*60,E.position.x>13&&(E.position.x=-13),E.position.x<-13&&(E.position.x=13),E.position.y>8&&(E.position.y=-8),E.position.y<-8&&(E.position.y=8);r.position.x+=(l-r.position.x)*.04,r.position.y+=(c-r.position.y)*.04,t.render(n,r)};f=requestAnimationFrame(v);const M=new IntersectionObserver(([A])=>{d=A.isIntersecting&&!document.hidden});M.observe(e);const p=()=>{d=!document.hidden,m=performance.now()};document.addEventListener("visibilitychange",p);const u=()=>{e.clientWidth&&(r.aspect=e.clientWidth/e.clientHeight,r.updateProjectionMatrix(),t.setSize(e.clientWidth,e.clientHeight))};return window.addEventListener("resize",u),()=>{cancelAnimationFrame(f),M.disconnect(),document.removeEventListener("visibilitychange",p),window.removeEventListener("pointermove",h),window.removeEventListener("resize",u),o.forEach(({s:A})=>A.material.dispose()),a.forEach(A=>A.dispose()),t.dispose(),e.removeChild(t.domElement)}},[]),Fo.jsx("div",{ref:i,className:"absolute inset-0 z-0 pointer-events-none","aria-hidden":!0})}export{jd as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.