vendor: 5,085 bytes, lines 1-5
1import"./global-43dcac59.js";/** 2 * @license 3 * Copyright 2010-2023 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Zr="152",To=0,ss=1,bo=2,Va=1,Ao=2,Kt=3,an=0,pt=1,Zt=2,sn=0,Wn=1,as=2,os=3,ls=4,wo=5,Hn=100,Ro=101,Co=102,cs=103,us=104,Lo=200,Po=201,Uo=202,Do=203,ka=204,Wa=205,Io=206,No=207,Fo=208,Oo=209,Bo=210,zo=0,Go=1,Ho=2,Or=3,Vo=4,ko=5,Wo=6,Xo=7,$r=0,qo=1,jo=2,$t=0,Yo=1,Ko=2,Zo=3,$o=4,Jo=5,Xa=300,jn=301,Yn=302,Br=303,zr=304,Ki=306,Gr=1e3,Dt=1001,Hr=1002,ut=1003,hs=1004,nr=1005,bt=1006,Qo=1007,li=1008,En=1009,el=1010,tl=1011,qa=1012,nl=1013,gn=1014,vn=1015,ci=1016,il=1017,rl=1018,Xn=1020,sl=1021,It=1023,al=1024,ol=1025,xn=1026,Kn=1027,ll=1028,cl=1029,ul=1030,hl=1031,dl=1033,ir=33776,rr=33777,sr=33778,ar=33779,ds=35840,fs=35841,ps=35842,ms=35843,fl=36196,_s=37492,gs=37496,vs=37808,xs=37809,Ms=37810,Ss=37811,Es=37812,ys=37813,Ts=37814,bs=37815,As=37816,ws=37817,Rs=37818,Cs=37819,Ls=37820,Ps=37821,or=36492,pl=36283,Us=36284,Ds=36285,Is=36286,ja=3e3,Mn=3001,ml=3200,_l=3201,Ya=0,gl=1,Sn="",Te="srgb",Ht="srgb-linear",Ka="display-p3",lr=7680,vl=519,Ns=35044,Fs="300 es",Vr=1035;class $n{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,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const rt=["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"],cr=Math.PI/180,kr=180/Math.PI;function ui(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(rt[i&255]+rt[i>>8&255]+rt[i>>16&255]+rt[i>>24&255]+"-"+rt[e&255]+rt[e>>8&255]+"-"+rt[e>>16&15|64]+rt[e>>24&255]+"-"+rt[t&63|128]+rt[t>>8&255]+"-"+rt[t>>16&255]+rt[t>>24&255]+rt[n&255]+rt[n>>8&255]+rt[n>>16&255]+rt[n>>24&255]).toLowerCase()}function ft(i,e,t){return Math.max(e,Math.min(t,i))}function xl(i,e){return(i%e+e)%e}function ur(i,e,t){return(1-t)*i+t*e}function Os(i){return(i&i-1)===0&&i!==0}function Ml(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function _i(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function _t(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Oe{constructor(e=0,t=0){Oe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 5,622 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}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(ft(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,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pe{constructor(){Pe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,r,s,o,a,u,l){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=s,c[5]=u,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],u=n[6],l=n[1],c=n[4],d=n[7],f=n[2],p=n[5],_=n[8],g=r[0],m=r[3],h=r[6],y=r[1],M=r[4],R=r[7],T=r[2],A=r[5],P=r[8];return s[0]=o*g+a*y+u*T,s[3]=o*m+a*M+u*A,s[6]=o*h+a*R+u*P,s[1]=l*g+c*y+d*T,s[4]=l*m+c*M+d*A,s[7]=l*h+c*R+d*P,s[2]=f*g+p*y+_*T,s[5]=f*m+p*M+_*A,s[8]=f*h+p*R+_*P,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],o=e[4],a=e[5],u=e[6],l=e[7],c=e[8];return t*o*c-t*a*l-n*s*c+n*a*u+r*s*l-r*o*u}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],u=e[6],l=e[7],c=e[8],d=c*o-a*l,f=a*u-c*s,p=l*s-o*u,_=t*d+n*f+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=d*g,e[1]=(r*l-c*n)*g,e[2]=(a*n-r*o)*g,e[3]=f*g,e[4]=(c*t-r*u)*g,e[5]=(r*s-a*t)*g,e[6]=p*g,e[7]=(n*u-l*t)*g,e[8]=(o*t-n*s)*g,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,o,a){const u=Math.cos(s),l=Math.sin(s);return this.set(n*u,n*l,-n*(u*o+l*a)+o+e,-r*l,r*u,-r*(-l*o+u*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(hr.makeScale(e,t)),this}rotate(e){return this.premultiply(hr.makeRotation(-e)),this}translate(e,t){return this.premultiply(hr.makeTranslation(e,t)),this}makeTranslation(e,t){return 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)}}
5const hr=new Pe;function Za(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Yi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}const Bs={};function oi(i){i in Bs||(Bs[i]=!0,console.warn(i))}function qn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function dr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const Sl=new Pe().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),El=new Pe().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function yl(i){return i.convertSRGBToLinear().applyMatrix3(El)}function Tl(i){return i.applyMatrix3(Sl).convertLinearToSRGB()}const bl={[Ht]:i=>i,[Te]:i=>i.convertSRGBToLinear(),[Ka]:yl},Al={[Ht]:i=>i,[Te]:i=>i.convertLinearToSRGB(),[Ka]:Tl},Rt={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(i){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!i},get workingColorSpace(){return Ht},set workingColorSpace(i){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=bl[e],r=Al[t];if(n===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)}};let bn;class $a{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{bn===void 0&&(bn=Yi("canvas")),bn.width=e.width,bn.height=e.height;const n=bn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=bn}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=Yi("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 o=0;o<s.length;o++)s[o]=qn(s[o]/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(qn(t[n]/255)*255):t[n]=qn(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}}class Ja{constructor(e=null){this.isSource=!0,this.uuid=ui(),this.data=e,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 o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(fr(r[o].image)):s.push(fr(r[o]))}else s=fr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function fr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?$a.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 wl=0;class Mt extends $n{constructor(e=Mt.DEFAULT_IMAGE,t=Mt.DEFAULT_MAPPING,n=Dt,r=Dt,s=bt,o=li,a=It,u=En,l=Mt.DEFAULT_ANISOTROPY,c=Sn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:wl++}),this.uuid=ui(),this.name="",this.source=new Ja(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=u,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof c=="string"?this.colorSpace
vendor: 4,244 bytes, line 5
5=c:(oi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=c===Mn?Te:Sn),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,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!==Xa)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Gr:e.x=e.x-Math.floor(e.x);break;case Dt:e.x=e.x<0?0:1;break;case Hr: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 Gr:e.y=e.y-Math.floor(e.y);break;case Dt:e.y=e.y<0?0:1;break;case Hr: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)}get encoding(){return oi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Te?Mn:ja}set encoding(e){oi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Mn?Te:Sn}}Mt.DEFAULT_IMAGE=null;Mt.DEFAULT_MAPPING=Xa;Mt.DEFAULT_ANISOTROPY=1;class Ve{constructor(e=0,t=0,n=0,r=1){Ve.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}
vendor: 20,853 bytes, line 5
5sub(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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const u=e.elements,l=u[0],c=u[4],d=u[8],f=u[1],p=u[5],_=u[9],g=u[2],m=u[6],h=u[10];if(Math.abs(c-f)<.01&&Math.abs(d-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(c+f)<.1&&Math.abs(d+g)<.1&&Math.abs(_+m)<.1&&Math.abs(l+p+h-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(l+1)/2,R=(p+1)/2,T=(h+1)/2,A=(c+f)/4,P=(d+g)/4,k=(_+m)/4;return M>R&&M>T?M<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(M),r=A/n,s=P/n):R>T?R<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(R),n=A/r,s=k/r):T<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),n=P/s,r=k/s),this.set(n,r,s,t),this}let y=Math.sqrt((m-_)*(m-_)+(d-g)*(d-g)+(f-c)*(f-c));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(d-g)/y,this.z=(f-c)/y,this.w=Math.acos((l+p+h-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){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 yn extends $n{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ve(0,0,e,t),this.scissorTest=!1,this.viewport=new Ve(0,0,e,t);const r={width:e,height:t,depth:1};n.encoding!==void 0&&(oi("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Mn?Te:Sn),this.texture=new Mt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:bt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ja(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qa extends Mt{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=ut,this.minFilter=ut,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Rl extends Mt{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=ut,this.minFilter=ut,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class hi{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,o,a){let u=n[r+0],l=n[r+1],c=n[r+2],d=n[r+3];const f=s[o+0],p=s[o+1],_=s[o+2],g=s[o+3];if(a===0){e[t+0]=u,e[t+1]=l,e[t+2]=c,e[t+3]=d;return}if(a===1){e[t+0]=f,e[t+1]=p,e[t+2]=_,e[t+3]=g;return}if(d!==g||u!==f||l!==p||c!==_){let m=1-a;const h=u*f+l*p+c*_+d*g,y=h>=0?1:-1,M=1-h*h;if(M>Number.EPSILON){const T=Math.sqrt(M),A=Math.atan2(T,h*y);m=Math.sin(m*A)/T,a=Math.sin(a*A)/T}const R=a*y;if(u=u*m+f*R,l=l*m+p*R,c=c*m+_*R,d=d*m+g*R,m===1-a){const T=1/Math.sqrt(u*u+l*l+c*c+d*d);u*=T,l*=T,c*=T,d*=T}}e[t]=u,e[t+1]=l,e[t+2]=c,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],u=n[r+1],l=n[r+2],c=n[r+3],d=s[o],f=s[o+1],p=s[o+2],_=s[o+3];return e[t]=a*_+c*d+u*p-l*f,e[t+1]=u*_+c*f+l*d-a*p,e[t+2]=l*_+c*p+a*f-u*d,e[t+3]=c*_-a*d-u*f-l*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,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){const n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,u=Math.sin,l=a(n/2),c=a(r/2),d=a(s/2),f=u(n/2),p=u(r/2),_=u(s/2);switch(o){case"XYZ":this._x=f*c*d+l*p*_,this._y=l*p*d-f*c*_,this._z=l*c*_+f*p*d,this._w=l*c*d-f*p*_;break;case"YXZ":this._x=f*c*d+l*p*_,this._y=l*p*d-f*c*_,this._z=l*c*_-f*p*d,this._w=l*c*d+f*p*_;break;case"ZXY":this._x=f*c*d-l*p*_,this._y=l*p*d+f*c*_,this._z=l*c*_+f*p*d,this._w=l*c*d-f*p*_;break;case"ZYX":this._x=f*c*d-l*p*_,this._y=l*p*d+f*c*_,this._z=l*c*_-f*p*d,this._w=l*c*d+f*p*_;break;case"YZX":this._x=f*c*d+l*p*_,this._y=l*p*d+f*c*_,this._z=l*c*_-f*p*d,this._w=l*c*d-f*p*_;break;case"XZY":this._x=f*c*d-l*p*_,this._y=l*p*d-f*c*_,this._z=l*c*_+f*p*d,this._w=l*c*d+f*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],o=t[1],a=t[5],u=t[9],l=t[2],c=t[6],d=t[10],f=n+a+d;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(c-u)*p,this._y=(s-l)*p,this._z=(o-r)*p}else if(n>a&&n>d){const p=2*Math.sqrt(1+n-a-d);this._w=(c-u)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+l)/p}else if(a>d){const p=2*Math.sqrt(1+a-n-d);this._w=(s-l)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(u+c)/p}else{const p=2*Math.sqrt(1+d-n-a);this._w=(o-r)/p,this._x=(s+l)/p,this._y=(u+c)/p,this._z=.25*p}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(ft(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,o=e._w,a=t._x,u=t._y,l=t._z,c=t._w;return this._x=n*c+o*a+r*l-s*u,this._y=r*c+o*u+s*a-n*l,this._z=s*c+o*l+n*u-r*a,this._w=o*c-n*a-r*u-s*l,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,o=this._w;let a=o*e._w+n*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const u=1-a*a;if(u<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(u),c=Math.atan2(l,a),d=Math.sin((1-t)*c)/l,f=Math.sin(t*c)/l;return this._w=o*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=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(s),n*Math.cos(s),t*Math.sin(r))}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}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 L{constructor(e=0,t=0,n=0){L.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(zs.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(zs.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,u=e.w,l=u*t+o*r-a*n,c=u*n+a*t-s*r,d=u*r+s*n-o*t,f=-s*t-o*n-a*r;return this.x=l*u+f*-s+c*-a-d*-o,this.y=c*u+f*-o+d*-s-l*-a,this.z=d*u+f*-a+l*-o-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,u=t.z;return this.x=r*u-s*a,this.y=s*o-n*u,this.z=n*a-r*o,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 pr.copy(this).projectOnVector(e),this.sub(pr)}reflect(e){return this.sub(pr.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(ft(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()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const pr=new L,zs=new hi;class di{constructor(e=new L(1/0,1/0,1/0),t=new L(-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(kt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(kt.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=kt.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){if(e.updateWorldMatrix(!1,!1),e.boundingBox!==void 0)e.boundingBox===null&&e.computeBoundingBox(),An.copy(e.boundingBox),An.applyMatrix4(e.matrixWorld),this.union(An);else{const r=e.geometry;if(r!==void 0)if(t&&r.attributes!==void 0&&r.attributes.position!==void 0){const s=r.attributes.position;for(let o=0,a=s.count;o<a;o++)kt.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(kt)}else r.boundingBox===null&&r.computeBoundingBox(),An.copy(r.boun
vendor: 11,233 bytes, line 5
5dingBox),An.applyMatrix4(e.matrixWorld),this.union(An)}const n=e.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],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,kt),kt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ei),gi.subVectors(this.max,ei),wn.subVectors(e.a,ei),Rn.subVectors(e.b,ei),Cn.subVectors(e.c,ei),en.subVectors(Rn,wn),tn.subVectors(Cn,Rn),un.subVectors(wn,Cn);let t=[0,-en.z,en.y,0,-tn.z,tn.y,0,-un.z,un.y,en.z,0,-en.x,tn.z,0,-tn.x,un.z,0,-un.x,-en.y,en.x,0,-tn.y,tn.x,0,-un.y,un.x,0];return!mr(t,wn,Rn,Cn,gi)||(t=[1,0,0,0,1,0,0,0,1],!mr(t,wn,Rn,Cn,gi))?!1:(vi.crossVectors(en,tn),t=[vi.x,vi.y,vi.z],mr(t,wn,Rn,Cn,gi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,kt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(kt).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:(Vt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vt),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 Vt=[new L,new L,new L,new L,new L,new L,new L,new L],kt=new L,An=new di,wn=new L,Rn=new L,Cn=new L,en=new L,tn=new L,un=new L,ei=new L,gi=new L,vi=new L,hn=new L;function mr(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){hn.fromArray(i,s);const a=r.x*Math.abs(hn.x)+r.y*Math.abs(hn.y)+r.z*Math.abs(hn.z),u=e.dot(hn),l=t.dot(hn),c=n.dot(hn);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>a)return!1}return!0}const Cl=new di,ti=new L,_r=new L;class fi{constructor(e=new L,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Cl.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;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;ti.subVectors(e,this.center);const t=ti.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ti,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):(_r.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ti.copy(e.center).add(_r)),this.expandByPoint(ti.copy(e.center).sub(_r))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Wt=new L,gr=new L,xi=new L,nn=new L,vr=new L,Mi=new L,xr=new L;class Jr{constructor(e=new L,t=new L(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,Wt)),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=Wt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Wt.copy(this.origin).addScaledVector(this.direction,t),Wt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){gr.copy(e).add(t).multiplyScalar(.5),xi.copy(t).sub(e).normalize(),nn.copy(this.origin).sub(gr);const s=e.distanceTo(t)*.5,o=-this.direction.dot(xi),a=nn.dot(this.direction),u=-nn.dot(xi),l=nn.lengthSq(),c=Math.abs(1-o*o);let d,f,p,_;if(c>0)if(d=o*u-a,f=o*a-u,_=s*c,d>=0)if(f>=-_)if(f<=_){const g=1/c;d*=g,f*=g,p=d*(d+o*f+2*a)+f*(o*d+f+2*u)+l}else f=s,d=Math.max(0,-(o*f+a)),p=-d*d+f*(f+2*u)+l;else f=-s,d=Math.max(0,-(o*f+a)),p=-d*d+f*(f+2*u)+l;else f<=-_?(d=Math.max(0,-(-o*s+a)),f=d>0?-s:Math.min(Math.max(-s,-u),s),p=-d*d+f*(f+2*u)+l):f<=_?(d=0,f=Math.min(Math.max(-s,-u),s),p=f*(f+2*u)+l):(d=Math.max(0,-(o*s+a)),f=d>0?s:Math.min(Math.max(-s,-u),s),p=-d*d+f*(f+2*u)+l);else f=o>0?-s:s,d=Math.max(0,-(o*f+a)),p=-d*d+f*(f+2*u)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(gr).addScaledVector(xi,f),p}intersectSphere(e,t){Wt.subVectors(e.center,this.origin);const n=Wt.dot(this.direction),r=Wt.dot(Wt)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,u=n+o;return u<0?null:a<0?this.at(u,t):this.at(a,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,o,a,u;const l=1/this.direction.x,c=1/this.direction.y,d=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,r=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,r=(e.min.x-f.x)*l),c>=0?(s=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(s=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-f.z)*d,u=(e.max.z-f.z)*d):(a=(e.max.z-f.z)*d,u=(e.min.z-f.z)*d),n>u||a>r)||((a>n||n!==n)&&(n=a),(u<r||r!==r)&&(r=u),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Wt)!==null}intersectTriangle(e,t,n,r,s){vr.subVectors(t,e),Mi.subVectors(n,e),xr.crossVectors(vr,Mi);let o=this.direction.dot(xr),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;nn.subVectors(this.origin,e);const u=a*this.direction.dot(Mi.crossVectors(nn,Mi));if(u<0)return null;const l=a*this.direction.dot(vr.cross(nn));if(l<0||u+l>o)return null;const c=-a*nn.dot(xr);return c<0?null:this.at(c/o,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 We{constructor(){We.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,r,s,o,a,u,l,c,d,f,p,_,g,m){const h=this.elements;return h[0]=e,h[4]=t,h[8]=n,h[12]=r,h[1]=s,h[5]=o,h[9]=a,h[13]=u,h[2]=l,h[6]=c,h[10]=d,h[14]=f,h[3]=p,h[7]=_,h[11]=g,h[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new We().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/Ln.setFromMatrixColumn(e,0).length(),s=1/Ln.setFromMatrixColumn(e,1).length(),o=1/Ln.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),u=Math.cos(r),l=Math.sin(r),c=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=o*c,p=o*d,_=a*c,g=a*d;t[0]=u*c,t[4]=-u*d,t[8]=l,t[1]=p+_*l,t[5]=f-g*l,t[9]=-a*u,t[2]=g-f*l,t[6]=_+p*l,t[10]=o*u}else if(e.order==="YXZ"){const f=u*c,p=u*d,_=l*c,g=l*d;t[0]=f+g*a,t[4]=_*a-p,t[8]=o*l,t[1]=o*d,t[5]=o*c,t[9]=-a,t[2]=p*a-_,t[6]=g+f*a,t[10]=o*u}else if(e.order==="ZXY"){const f=u*c,p=u*d,_=l*c,g=l*d;t[0]=f-g*a,t[4]=-o*d,t[8]=_+p*a,t[1]=p+_*a,t[5]=o*c,t[9]=g-f*a,t[2]=-o*l,t[6]=a,t[10]=o*u}else if(e.order==="ZYX"){const f=o*c,p=o*d,_=a*c,g=a*d;t[0]=u*c,t[4]=_*l-p,t[8]=f*l+g,t[1]=u*d,t[5]=g*l+f,t[9]=p*l-_,t[2]=-l,t[6]=a*u,t[10]=o*u}else if(e.order==="YZX"){const f=o*u,p=o*l,_=a*u,g=a*l;t[0]=u*c,t[4]=g-f*d,t[8]=_*d+p,t[1]=d,t[5]=o*c,t[9]=-a*c,t[2]=-l*c,t[6]=p*d+_,t[10]=f-g*d}else if(e.order==="XZY"){const f=o*u,p=o*l,_=a*u,g=a*l;
vendor: 14,339 bytes, line 5
5t[0]=u*c,t[4]=-d,t[8]=l*c,t[1]=f*d+g,t[5]=o*c,t[9]=p*d-_,t[2]=_*d-p,t[6]=a*c,t[10]=g*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(Ll,e,Pl)}lookAt(e,t,n){const r=this.elements;return gt.subVectors(e,t),gt.lengthSq()===0&&(gt.z=1),gt.normalize(),rn.crossVectors(n,gt),rn.lengthSq()===0&&(Math.abs(n.z)===1?gt.x+=1e-4:gt.z+=1e-4,gt.normalize(),rn.crossVectors(n,gt)),rn.normalize(),Si.crossVectors(gt,rn),r[0]=rn.x,r[4]=Si.x,r[8]=gt.x,r[1]=rn.y,r[5]=Si.y,r[9]=gt.y,r[2]=rn.z,r[6]=Si.z,r[10]=gt.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,o=n[0],a=n[4],u=n[8],l=n[12],c=n[1],d=n[5],f=n[9],p=n[13],_=n[2],g=n[6],m=n[10],h=n[14],y=n[3],M=n[7],R=n[11],T=n[15],A=r[0],P=r[4],k=r[8],x=r[12],b=r[1],q=r[5],Z=r[9],I=r[13],z=r[2],G=r[6],ee=r[10],X=r[14],W=r[3],Y=r[7],J=r[11],he=r[15];return s[0]=o*A+a*b+u*z+l*W,s[4]=o*P+a*q+u*G+l*Y,s[8]=o*k+a*Z+u*ee+l*J,s[12]=o*x+a*I+u*X+l*he,s[1]=c*A+d*b+f*z+p*W,s[5]=c*P+d*q+f*G+p*Y,s[9]=c*k+d*Z+f*ee+p*J,s[13]=c*x+d*I+f*X+p*he,s[2]=_*A+g*b+m*z+h*W,s[6]=_*P+g*q+m*G+h*Y,s[10]=_*k+g*Z+m*ee+h*J,s[14]=_*x+g*I+m*X+h*he,s[3]=y*A+M*b+R*z+T*W,s[7]=y*P+M*q+R*G+T*Y,s[11]=y*k+M*Z+R*ee+T*J,s[15]=y*x+M*I+R*X+T*he,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],o=e[1],a=e[5],u=e[9],l=e[13],c=e[2],d=e[6],f=e[10],p=e[14],_=e[3],g=e[7],m=e[11],h=e[15];return _*(+s*u*d-r*l*d-s*a*f+n*l*f+r*a*p-n*u*p)+g*(+t*u*p-t*l*f+s*o*f-r*o*p+r*l*c-s*u*c)+m*(+t*l*d-t*a*p-s*o*d+n*o*p+s*a*c-n*l*c)+h*(-r*a*c-t*u*d+t*a*f+r*o*d-n*o*f+n*u*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],u=e[6],l=e[7],c=e[8],d=e[9],f=e[10],p=e[11],_=e[12],g=e[13],m=e[14],h=e[15],y=d*m*l-g*f*l+g*u*p-a*m*p-d*u*h+a*f*h,M=_*f*l-c*m*l-_*u*p+o*m*p+c*u*h-o*f*h,R=c*g*l-_*d*l+_*a*p-o*g*p-c*a*h+o*d*h,T=_*d*u-c*g*u-_*a*f+o*g*f+c*a*m-o*d*m,A=t*y+n*M+r*R+s*T;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/A;return e[0]=y*P,e[1]=(g*f*s-d*m*s-g*r*p+n*m*p+d*r*h-n*f*h)*P,e[2]=(a*m*s-g*u*s+g*r*l-n*m*l-a*r*h+n*u*h)*P,e[3]=(d*u*s-a*f*s-d*r*l+n*f*l+a*r*p-n*u*p)*P,e[4]=M*P,e[5]=(c*m*s-_*f*s+_*r*p-t*m*p-c*r*h+t*f*h)*P,e[6]=(_*u*s-o*m*s-_*r*l+t*m*l+o*r*h-t*u*h)*P,e[7]=(o*f*s-c*u*s+c*r*l-t*f*l-o*r*p+t*u*p)*P,e[8]=R*P,e[9]=(_*d*s-c*g*s-_*n*p+t*g*p+c*n*h-t*d*h)*P,e[10]=(o*g*s-_*a*s+_*n*l-t*g*l-o*n*h+t*a*h)*P,e[11]=(c*a*s-o*d*s-c*n*l+t*d*l+o*n*p-t*a*p)*P,e[12]=T*P,e[13]=(c*g*r-_*d*r+_*n*f-t*g*f-c*n*m+t*d*m)*P,e[14]=(_*a*r-o*g*r-_*n*u+t*g*u+o*n*m-t*a*m)*P,e[15]=(o*d*r-c*a*r+c*n*u-t*d*u-o*n*f+t*a*f)*P,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 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,o=e.x,a=e.y,u=e.z,l=s*o,c=s*a;return this.set(l*o+n,l*a-r*u,l*u+r*a,0,l*a+r*u,c*a+n,c*u-r*o,0,l*u-r*a,c*u+r*o,s*u*u+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,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,u=t._w,l=s+s,c=o+o,d=a+a,f=s*l,p=s*c,_=s*d,g=o*c,m=o*d,h=a*d,y=u*l,M=u*c,R=u*d,T=n.x,A=n.y,P=n.z;return r[0]=(1-(g+h))*T,r[1]=(p+R)*T,r[2]=(_-M)*T,r[3]=0,r[4]=(p-R)*A,r[5]=(1-(f+h))*A,r[6]=(m+y)*A,r[7]=0,r[8]=(_+M)*P,r[9]=(m-y)*P,r[10]=(1-(f+g))*P,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=Ln.set(r[0],r[1],r[2]).length();const o=Ln.set(r[4],r[5],r[6]).length(),a=Ln.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],Ct.copy(this);const l=1/s,c=1/o,d=1/a;return Ct.elements[0]*=l,Ct.elements[1]*=l,Ct.elements[2]*=l,Ct.elements[4]*=c,Ct.elements[5]*=c,Ct.elements[6]*=c,Ct.elements[8]*=d,Ct.elements[9]*=d,Ct.elements[10]*=d,t.setFromRotationMatrix(Ct),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,r,s,o){const a=this.elements,u=2*s/(t-e),l=2*s/(n-r),c=(t+e)/(t-e),d=(n+r)/(n-r),f=-(o+s)/(o-s),p=-2*o*s/(o-s);return a[0]=u,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,r,s,o){const a=this.elements,u=1/(t-e),l=1/(n-r),c=1/(o-s),d=(t+e)*u,f=(n+r)*l,p=(o+s)*c;return a[0]=2*u,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[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 Ln=new L,Ct=new We,Ll=new L(0,0,0),Pl=new L(1,1,1),rn=new L,Si=new L,gt=new L,Gs=new We,Hs=new hi;class Zi{constructor(e=0,t=0,n=0,r=Zi.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],o=r[4],a=r[8],u=r[1],l=r[5],c=r[9],d=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(ft(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ft(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(u,l)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ft(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ft(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(ft(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-ft(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,p),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 Gs.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gs,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Hs.setFromEuler(this),this.setFromQuaternion(Hs,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}}Zi.DEFAULT_ORDER="XYZ";class eo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Ul=0;const Vs=new L,Pn=new hi,Xt=new We,Ei=new L,ni=new L,Dl=new L,Il=new hi,ks=new L(1,0,0),Ws=new L(0,1,0),Xs=new L(0,0,1),Nl={type:"added"},qs={type:"removed"};class at extends $n{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ul++}),this.uuid=ui(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=at.DEFAULT_UP.clone();const e=new L,t=new Zi,n=new hi,r=new L(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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 We},normalMatrix:{value:new Pe}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=at.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new eo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pn.setFromAxisAngle(e,t),this.quaternion.multiply(Pn),this}rotateOnWorldAxis(e,t){return Pn.setFromAxisAngle(e,t),this.quaternion.premultiply(Pn),this}rotateX(e){return this.rotateOnAxis(ks,e)}rotateY(e){return this.rotateOnAxis(Ws,e)}rotateZ(e){return this.rotateOnAxis(Xs,e)}translateOnAxis(e,t){return Vs.copy(e).applyQuaternion(this.quaternion),this.position.add(Vs.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ks,e)}translateY(e){return this.translateOnAxis(Ws,e)}translateZ(e){return this.translateOnAxis(Xs,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Xt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ei.copy(e):Ei.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ni.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xt.lookAt(ni,Ei,this.up):Xt.lookAt(Ei,ni,this.up),this.quaternion.setFromRotationMatrix(Xt),r&&(Xt.extractRotation(r.matrixWorld),Pn.setFromRotationMatrix(Xt),this.quaternion.premultiply(Pn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Nl)):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(qs)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(qs)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Xt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Xt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Xt),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t){let n=[];this[e]===t&&n.push(this);for(let r=0,s=this.children.length;r<s;r++){const o=this.children[r].getObjectsByProperty(e,t);o.length>0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ni,e,Dl),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ni,Il,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.parent===null?this.matrixWorld.copy(this.matrix
vendor: 4,597 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++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.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.5,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()));function s(a,u){return a[u.uuid]===void 0&&(a[u.uuid]=u.toJSON(e)),u.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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const u=a.shapes;if(Array.isArray(u))for(let l=0,c=u.length;l<c;l++){const d=u[l];s(e.shapes,d)}else s(e.shapes,u)}}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 a=[];for(let u=0,l=this.material.length;u<l;u++)a.push(s(e.materials,this.material[u]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const u=this.animations[a];r.animations.push(s(e.animations,u))}}if(t){const a=o(e.geometries),u=o(e.materials),l=o(e.textures),c=o(e.images),d=o(e.shapes),f=o(e.skeletons),p=o(e.animations),_=o(e.nodes);a.length>0&&(n.geometries=a),u.length>0&&(n.materials=u),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),d.length>0&&(n.shapes=d),f.length>0&&(n.skeletons=f),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function o(a){const u=[];for(const l in a){const c=a[l];delete c.metadata,u.push(c)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,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}}at.DEFAULT_UP=new L(0,1,0);at.DEFAULT_MATRIX_AUTO_UPDATE=!0;at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Lt=new L,qt=new L,Mr=new L,jt=new L,Un=new L,Dn=new L,js=new L,Sr=new L,Er=new L,yr=new L;let yi=!1;class Ut{constructor(e=new L,t=new L,n=new L){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Lt.subVectors(e,t),r.cross(Lt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}
vendor: 12,241 bytes, line 5
5static getBarycoord(e,t,n,r,s){Lt.subVectors(r,t),qt.subVectors(n,t),Mr.subVectors(e,t);const o=Lt.dot(Lt),a=Lt.dot(qt),u=Lt.dot(Mr),l=qt.dot(qt),c=qt.dot(Mr),d=o*l-a*a;if(d===0)return s.set(-2,-1,-1);const f=1/d,p=(l*u-a*c)*f,_=(o*c-a*u)*f;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,jt),jt.x>=0&&jt.y>=0&&jt.x+jt.y<=1}static getUV(e,t,n,r,s,o,a,u){return yi===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),yi=!0),this.getInterpolation(e,t,n,r,s,o,a,u)}static getInterpolation(e,t,n,r,s,o,a,u){return this.getBarycoord(e,t,n,r,jt),u.setScalar(0),u.addScaledVector(s,jt.x),u.addScaledVector(o,jt.y),u.addScaledVector(a,jt.z),u}static isFrontFacing(e,t,n,r){return Lt.subVectors(n,t),qt.subVectors(e,t),Lt.cross(qt).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 Lt.subVectors(this.c,this.b),qt.subVectors(this.a,this.b),Lt.cross(qt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ut.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ut.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,s){return yi===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),yi=!0),Ut.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}getInterpolation(e,t,n,r,s){return Ut.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Ut.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ut.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 o,a;Un.subVectors(r,n),Dn.subVectors(s,n),Sr.subVectors(e,n);const u=Un.dot(Sr),l=Dn.dot(Sr);if(u<=0&&l<=0)return t.copy(n);Er.subVectors(e,r);const c=Un.dot(Er),d=Dn.dot(Er);if(c>=0&&d<=c)return t.copy(r);const f=u*d-c*l;if(f<=0&&u>=0&&c<=0)return o=u/(u-c),t.copy(n).addScaledVector(Un,o);yr.subVectors(e,s);const p=Un.dot(yr),_=Dn.dot(yr);if(_>=0&&p<=_)return t.copy(s);const g=p*l-u*_;if(g<=0&&l>=0&&_<=0)return a=l/(l-_),t.copy(n).addScaledVector(Dn,a);const m=c*_-p*d;if(m<=0&&d-c>=0&&p-_>=0)return js.subVectors(s,r),a=(d-c)/(d-c+(p-_)),t.copy(r).addScaledVector(js,a);const h=1/(m+g+f);return o=g*h,a=f*h,t.copy(n).addScaledVector(Un,o).addScaledVector(Dn,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Fl=0;class Jt extends $n{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fl++}),this.uuid=ui(),this.name="",this.type="Material",this.blending=Wn,this.side=an,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=ka,this.blendDst=Wa,this.blendEquation=Hn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Or,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lr,this.stencilZFail=lr,this.stencilZPass=lr,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}onBuild(){}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.5,type:"Material",generator:"Material.toJSON"}};n.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&&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.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.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.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!==Wn&&(n.blending=this.blending),this.side!==an&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),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 o=[];for(const a in s){const u=s[a];delete u.metadata,o.push(u)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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.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: 7,566 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.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++}}const to={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},Pt={h:0,s:0,l:0},Ti={h:0,s:0,l:0};function Tr(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 Ie{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Te){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Rt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Rt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Rt.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Rt.workingColorSpace){if(e=xl(e,1),t=ft(t,0,1),n=ft(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Tr(o,s,e+1/3),this.g=Tr(o,s,e),this.b=Tr(o,s,e-1/3)}return Rt.toWorkingColorSpace(this,r),this}setStyle(e,t=Te){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 o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))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],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===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=Te){const n=to[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=qn(e.r),this.g=qn(e.g),this.b=qn(e.b),this}copyLinearToSRGB(e){return this.r=dr(e.r),this.g=dr(e.g),this.b=dr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Te){return Rt.fromWorkingColorSpace(st.copy(this),e),Math.round(ft(st.r*255,0,255))*65536+Math.round(ft(st.g*255,0,255))*256+Math.round(ft(st.b*255,0,255))}getHexString(e=Te){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Rt.workingColorSpace){Rt.fromWorkingColorSpace(st.copy(this),t);const n=st.r,r=st.g,s=st.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let u,l;const c=(a+o)/2;if(a===o)u=0,l=0;else{const d=o-a;switch(l=c<=.5?d/(o+a):d/(2-o-a),o){case n:u=(r-s)/d+(r<s?6:0);break;case r:u=(s-n)/d+2;break;case s:u=(n-r)/d+4;break}u/=6}return e.h=u,e.s=l,e.l=c,e}getRGB(e,t=Rt.workingColorSpace){return Rt.fromWorkingColorSpace(st.copy(this),t),e.r=st.r,e.g=st.g,e.b=st.b,e}getStyle(e=Te){Rt.fromWorkingColorSpace(st.copy(this),e);const t=st.r,n=st.g,r=st.b;return e!==Te?`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(Pt),Pt.h+=e,Pt.s+=t,Pt.l+=n,this.setHSL(Pt.h,Pt.s,Pt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 8,172 bytes, line 5
5lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Pt),e.getHSL(Ti);const n=ur(Pt.h,Ti.h,t),r=ur(Pt.s,Ti.s,t),s=ur(Pt.l,Ti.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const st=new Ie;Ie.NAMES=to;class no extends Jt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$r,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.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 Ye=new L,bi=new Oe;class Gt{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=Ns,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let 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++)bi.fromBufferAttribute(this,t),bi.applyMatrix3(e),this.setXY(t,bi.x,bi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.applyMatrix3(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.applyMatrix4(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.applyNormalMatrix(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ye.fromBufferAttribute(this,t),Ye.transformDirection(e),this.setXYZ(t,Ye.x,Ye.y,Ye.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=_i(t,this.array)),t}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=_i(t,this.array)),t}setY(e,t){return this.normalized&&(t=_t(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=_i(t,this.array)),t}setZ(e,t){return this.normalized&&(t=_t(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=_i(t,this.array)),t}setW(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),n=_t(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=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),n=_t(n,this.array),r=_t(r,this.array),s=_t(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!==Ns&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class io extends Gt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ro extends Gt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class ht extends Gt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Ol=0;const Et=new We,br=new at,In=new L,vt=new di,ii=new di,tt=new L;class Nt extends $n{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ol++}),this.uuid=ui(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Za(e)?ro:io)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Pe().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 Et.makeRotationFromQuaternion(e),this.applyMatrix4(Et),this}rotateX(e){return Et.makeRotationX(e),this.applyMatrix4(Et),this}rotateY(e){return Et.makeRotationY(e),this.applyMatrix4(Et),this}rotateZ(e){return Et.makeRotationZ(e),this.applyMatrix4(Et),this}translate(e,t,n){return Et.makeTranslation(e,t,n),this.applyMatrix4(Et),this}scale(e,t,n){return Et.makeScale(e,t,n),this.applyMatrix4(Et),this}lookAt(e){return br.lookAt(e),br.updateMatrix(),this.applyMatrix4(br.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(In).negate(),this.translate(In.x,In.y,In.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ht(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(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];vt.setFromBufferAttribute(s),this.morphTargetsRelative?(tt.addVectors(this.boundingBox.min,vt.min),this.boundingBox.expandByPoint(tt),tt.addVectors(this.boundingBox.max,vt.max),this.boundingBox.expandByPoint(tt)):(this.boundingBox.expandByPoint(vt.min),this.boundingBox.expandByPoint(vt.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 fi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new L,1/0);return}if(e){const n=this.boundingSphere.center;if(vt.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];ii.setFromBufferAttribute(a),this.morphTargetsRelative?(tt.addVectors(vt.min,ii.min),vt.expandByPoint(tt),tt.addVectors(vt.max,ii.max),vt.expandByPoint(tt)):(vt.expandByPoint(ii.min),vt.expandByPoint(ii.max))}vt.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)tt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(tt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],u=this.morphTargetsRelative;for(let l=0,c=a.count;l<c;l++)tt.fromBufferAttribute(a,l),u&&(In.fromBufferAttribute(e,l),tt.add(In)),r=Math.max(r,n.distanceToSquared(tt))}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=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,a=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Gt(new Float32Array(4*a),4));const u=this.getAttribute("tangent").array,l=[],c=[];for(let b=0;b<a;b++)l[b]=new L,c[b]=new L;const d=new L,f=new L,p=new L,_=new Oe,g=new Oe,m=new Oe,h=new L,y=new L;function M(b,q,Z){d.fromArray(r,b*3),f.fromArray(r,q*3),p.fromArray(r,Z*3),_.fromArray(o,b*2),g.fromArray(o,q*2),m.fromArray(o,Z*2),f.sub(d),p.sub(d),g.sub(_),m.sub(_);const I=1/(g.x*m.y-m.x*g.y);isFinite(I)&&(h.copy(f).multiplyScalar(m.y).addScaledVector(p,-g.y).multiplyScalar(I),y.copy(p).multiplyScalar(g.x).addScaledVector(f,-m.x).multiplyScalar(I),l[b].add(h),l[q].add(h),l[Z].add(h),c[b].add(y),c[q].add(y),c[Z].add(y))}let R=this.groups;R.length===0&&(R=[{start:0,count:n.length}]);for(let b=0,q=R.length;b<q;++b){const Z=R[b],I=Z.start,z=Z.count;for(let G=I,ee=I+z;G<ee;G+=3)M(n[G+0],n[G+1],n[G+2])}const T=new L,A=new L,P=new L,k=new L;function x(b){P.fromArray(s,b*3),k.copy(P);const q=l[b];T.copy(q),T.sub(P.multiplyScalar(P.dot(q))).normalize(),A.crossVectors(k,q);const I=A.dot(c[b])<0?-1:1;u[b*4]=T.x,u[b*4+1]=T.y,u[b*4+2]=T.z,u[b*4+3]=I}for(let b=0,q=R.length;b<q;++b){const Z=R[b],I=Z.start,z=Z.count;for(let G=I,ee=I+z;G<ee;G+=3)x(n[G+0]),x(n[G+1]),x(n[G+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 Gt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,p=n.count;f<p;f++)n.setXYZ(f,0,0,0);const r=new L,s=new L,o=new L,a=new L,u=new L,l=new L,c=new L,d=new L;if(e)for(let f=0,p=e.count;f<p;f+=3){const _=e.getX(f+0),g=e.getX(f+1),m=e.getX(f+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),c.subVectors(o,s),d.subVectors(r,s),c.cross(d),a.fromBufferAttribute(n,_),u.fromBufferAttribute(n,g),l.fromBufferAttribute(n,m),a.add(c),u.add(c),l.add(c),n.setXYZ(_,a.x,a.y,a.z),n.setXYZ(g,u.x,u.y,u.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),c.subVectors(o,s),d.subVectors(r,s),c.cross(d),n.setXYZ(f+0,c.x,c.y,c.z),n.setXYZ(f+1,c.x,c.y,c.z),n.setXYZ(f+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)tt.fromBufferAttribute(e,t),tt.normalize(),e.setXYZ(t,tt.x,tt.y,tt.z)}toNonIndexed(){function e(a,u){const l=a.array,c=a.itemSize,d=a.normalized,f=new l.constructor(u.length*c);let p=0,_=0;for(let g=0,m=u.length;g<m;g++){a.isInterleavedBufferAttribute?p=u[g]*a.data.stride+a.offset:p=u[g]*c;for(let h=0;h<c;h++)f[_++]=l[p++]}return new Gt(f,c,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Nt,n=this.index.array,r=this.attributes;for(const a in r){const u=r[a],l=e(u,n);t.setAttribute(a,l)}const s=this.morphAttributes;for(const a in s){const u=[],l=s[a];for(let c=0,d=l.length;c<d;c++){const f=l[c],p=e(f,n);u.push(p)}t.morphAttributes[a]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,u=o.length;a<u;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 11,551 bytes, lines 5-9
5if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const l in u)u[l]!==void 0&&(e[l]=u[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const l=n[u];e.data.attributes[u]=l.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const l=this.morphAttributes[u],c=[];for(let d=0,f=l.length;d<f;d++){const p=l[d];c.push(p.toJSON(e.data))}c.length>0&&(r[u]=c,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 l in r){const c=r[l];this.setAttribute(l,c.clone(t))}const s=e.morphAttributes;for(const l in s){const c=[],d=s[l];for(let f=0,p=d.length;f<p;f++)c.push(d[f].clone(t));this.morphAttributes[l]=c}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,c=o.length;l<c;l++){const d=o[l];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ys=new We,Ot=new Jr,Ai=new fi,Ks=new L,Nn=new L,Fn=new L,On=new L,Ar=new L,wi=new L,Ri=new Oe,Ci=new Oe,Li=new Oe,Zs=new L,$s=new L,Js=new L,Pi=new L,Ui=new L;class At extends at{constructor(e=new Nt,t=new no){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=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,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){wi.set(0,0,0);for(let u=0,l=s.length;u<l;u++){const c=a[u],d=s[u];c!==0&&(Ar.fromBufferAttribute(d,e),o?wi.addScaledVector(Ar,c):wi.addScaledVector(Ar.sub(t),c))}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(),Ai.copy(n.boundingSphere),Ai.applyMatrix4(s),Ot.copy(e.ray).recast(e.near),!(Ai.containsPoint(Ot.origin)===!1&&(Ot.intersectSphere(Ai,Ks)===null||Ot.origin.distanceToSquared(Ks)>(e.far-e.near)**2))&&(Ys.copy(s).invert(),Ot.copy(e.ray).applyMatrix4(Ys),!(n.boundingBox!==null&&Ot.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t)))}_computeIntersections(e,t){let n;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,u=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(s))for(let p=0,_=d.length;p<_;p++){const g=d[p],m=s[g.materialIndex],h=Math.max(g.start,f.start),y=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let M=h,R=y;M<R;M+=3){const T=o.getX(M),A=o.getX(M+1),P=o.getX(M+2);n=Di(this,m,e,Ot,u,l,c,T,A,P),n&&(n.faceIndex=Math.floor(M/3),n.face.materialIndex=g.materialIndex,t.push(n))}}else{const p=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=p,m=_;g<m;g+=3){const h=o.getX(g),y=o.getX(g+1),M=o.getX(g+2);n=Di(this,s,e,Ot,u,l,c,h,y,M),n&&(n.faceIndex=Math.floor(g/3),t.push(n))}}else if(a!==void 0)if(Array.isArray(s))for(let p=0,_=d.length;p<_;p++){const g=d[p],m=s[g.materialIndex],h=Math.max(g.start,f.start),y=Math.min(a.count,Math.min(g.start+g.count,f.start+f.count));for(let M=h,R=y;M<R;M+=3){const T=M,A=M+1,P=M+2;n=Di(this,m,e,Ot,u,l,c,T,A,P),n&&(n.faceIndex=Math.floor(M/3),n.face.materialIndex=g.materialIndex,t.push(n))}}else{const p=Math.max(0,f.start),_=Math.min(a.count,f.start+f.count);for(let g=p,m=_;g<m;g+=3){const h=g,y=g+1,M=g+2;n=Di(this,s,e,Ot,u,l,c,h,y,M),n&&(n.faceIndex=Math.floor(g/3),t.push(n))}}}}function Bl(i,e,t,n,r,s,o,a){let u;if(e.side===pt?u=n.intersectTriangle(o,s,r,!0,a):u=n.intersectTriangle(r,s,o,e.side===an,a),u===null)return null;Ui.copy(a),Ui.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(Ui);return l<t.near||l>t.far?null:{distance:l,point:Ui.clone(),object:i}}function Di(i,e,t,n,r,s,o,a,u,l){i.getVertexPosition(a,Nn),i.getVertexPosition(u,Fn),i.getVertexPosition(l,On);const c=Bl(i,e,t,n,Nn,Fn,On,Pi);if(c){r&&(Ri.fromBufferAttribute(r,a),Ci.fromBufferAttribute(r,u),Li.fromBufferAttribute(r,l),c.uv=Ut.getInterpolation(Pi,Nn,Fn,On,Ri,Ci,Li,new Oe)),s&&(Ri.fromBufferAttribute(s,a),Ci.fromBufferAttribute(s,u),Li.fromBufferAttribute(s,l),c.uv1=Ut.getInterpolation(Pi,Nn,Fn,On,Ri,Ci,Li,new Oe),c.uv2=c.uv1),o&&(Zs.fromBufferAttribute(o,a),$s.fromBufferAttribute(o,u),Js.fromBufferAttribute(o,l),c.normal=Ut.getInterpolation(Pi,Nn,Fn,On,Zs,$s,Js,new L),c.normal.dot(n.direction)>0&&c.normal.multiplyScalar(-1));const d={a,b:u,c:l,normal:new L,materialIndex:0};Ut.getNormal(Nn,Fn,On,d.normal),c.face=d}return c}class pi extends Nt{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const u=[],l=[],c=[],d=[];let f=0,p=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,r,o,2),_("x","z","y",1,-1,e,n,-t,r,o,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(u),this.setAttribute("position",new ht(l,3)),this.setAttribute("normal",new ht(c,3)),this.setAttribute("uv",new ht(d,2));function _(g,m,h,y,M,R,T,A,P,k,x){const b=R/P,q=T/k,Z=R/2,I=T/2,z=A/2,G=P+1,ee=k+1;let X=0,W=0;const Y=new L;for(let J=0;J<ee;J++){const he=J*q-I;for(let oe=0;oe<G;oe++){const F=oe*b-Z;Y[g]=F*y,Y[m]=he*M,Y[h]=z,l.push(Y.x,Y.y,Y.z),Y[g]=0,Y[m]=0,Y[h]=A>0?1:-1,c.push(Y.x,Y.y,Y.z),d.push(oe/P),d.push(1-J/k),X+=1}}for(let J=0;J<k;J++)for(let he=0;he<P;he++){const oe=f+he+G*J,F=f+he+G*(J+1),j=f+(he+1)+G*(J+1),ie=f+(he+1)+G*J;u.push(oe,F,ie),u.push(F,j,ie),W+=6}a.addGroup(p,W,x),p+=W,f+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Zn(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 ct(i){const e={};for(let t=0;t<i.length;t++){const n=Zn(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 so(i){return i.getRenderTarget()===null?i.outputColorSpace:Ht}const Gl={clone:Zn,merge:ct};var Hl=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,Vl=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class Tn extends Jt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Hl,this.fragmentShader=Vl,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!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=Zn(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 o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}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 ao extends at{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class xt extends ao{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=kr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cr*.5*this.fov);return .5*this.getFilmHeight()/e}
9getEffectiveFOV(){return kr*2*Math.atan(Math.tan(cr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,r,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const u=o.fullWidth,l=o.fullHeight;s+=o.offsetX*r/u,t-=o.offsetY*n/l,r*=o.width/u,n*=o.height/l}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Bn=-90,zn=1;class kl extends at{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const r=new xt(Bn,zn,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);const s=new xt(Bn,zn,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new xt(Bn,zn,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new xt(Bn,zn,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const u=new xt(Bn,zn,e,t);u.layers=this.layers,u.up.set(0,1,0),u.lookAt(0,0,1),this.add(u);const l=new xt(Bn,zn,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[r,s,o,a,u,l]=this.children,c=e.getRenderTarget(),d=e.toneMapping,f=e.xr.enabled;e.toneMapping=$t,e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=d,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}class oo extends Mt{constructor(e,t,n,r,s,o,a,u,l,c){e=e!==void 0?e:[],t=t!==void 0?t:jn,super(e,t,n,r,s,o,a,u,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Wl extends yn{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];t.encoding!==void 0&&(oi("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Mn?Te:Sn),this.texture=new oo(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:bt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 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 pi(5,5,5),s=new Tn({name:"CubemapFromEquirect",uniforms:Zn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:pt,blending:sn});s.uniforms.tEquirect.value=t;const o=new At(r,s),a=t.minFilter;return t.minFilter===li&&(t.minFilter=bt),new kl(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}}const wr=new L,Xl=new L,ql=new Pe;class pn{constructor(e=new L(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}
44setFromCoplanarPoints(e,t,n){const r=wr.subVectors(n,t).cross(Xl.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(wr),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||ql.getNormalMatrix(e),r=this.coplanarPoint(wr).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 dn=new fi,Ii=new L;class Qr{constructor(e=new pn,t=new pn,n=new pn,r=new pn,s=new pn,o=new pn){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],s=n[1],o=n[2],a=n[3],u=n[4],l=n[5],c=n[6],d=n[7],f=n[8],p=n[9],_=n[10],g=n[11],m=n[12],h=n[13],y=n[14],M=n[15];return t[0].setComponents(a-r,d-u,g-f,M-m).normalize(),t[1].setComponents(a+r,d+u,g+f,M+m).normalize(),t[2].setComponents(a+s,d+l,g+p,M+h).normalize(),t[3].setComponents(a-s,d-l,g-p,M-h).normalize(),t[4].setComponents(a-o,d-c,g-_,M-y).normalize(),t[5].setComponents(a+o,d+c,g+_,M+y).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),dn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),dn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(dn)}intersectsSprite(e){return dn.center.set(0,0,0),dn.radius=.7071067811865476,dn.applyMatrix4(e.matrixWorld),this.intersectsSphere(dn)}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(Ii.x=r.normal.x>0?e.max.x:e.min.x,Ii.y=r.normal.y>0?e.max.y:e.min.y,Ii.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ii)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function lo(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),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 jl(i,e){const t=e.isWebGL2,n=new WeakMap;function r(l,c){const d=l.array,f=l.usage,p=i.createBuffer();i.bindBuffer(c,p),i.bufferData(c,d,f),l.onUploadCallback();let _;if(d instanceof Float32Array)_=i.FLOAT;else if(d instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)_=i.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=i.UNSIGNED_SHORT;else if(d instanceof Int16Array)_=i.SHORT;else if(d instanceof Uint32Array)_=i.UNSIGNED_INT;else if(d instanceof Int32Array)_=i.INT;else if(d instanceof Int8Array)_=i.BYTE;else if(d instanceof Uint8Array)_=i.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)_=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:_,bytesPerElement:d.BYTES_PER_ELEMENT,version:l.version}}function s(l,c,d){const f=c.array,p=c.updateRange;i.bindBuffer(d,l),p.count===-1?i.bufferSubData(d,0,f):(t?i.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):i.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const c=n.get(l);c&&(i.deleteBuffer(c.buffer),n.delete(l))}function u(l,c){if(l.isGLBufferAttribute){const f=n.get(l);(!f||f.version<l.version)&&n.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);const d=n.get(l);d===void 0?n.set(l,r(l,c)):d.version<l.version&&(s(d.buffer,l,c),d.version=l.version)}return{get:o,remove:a,update:u}}class es extends Nt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};
vendor: 4,029 bytes, lines 44-117
44const s=e/2,o=t/2,a=Math.floor(n),u=Math.floor(r),l=a+1,c=u+1,d=e/a,f=t/u,p=[],_=[],g=[],m=[];for(let h=0;h<c;h++){const y=h*f-o;for(let M=0;M<l;M++){const R=M*d-s;_.push(R,-y,0),g.push(0,0,1),m.push(M/a),m.push(1-h/u)}}for(let h=0;h<u;h++)for(let y=0;y<a;y++){const M=y+l*h,R=y+l*(h+1),T=y+1+l*(h+1),A=y+1+l*h;p.push(M,R,A),p.push(R,T,A)}this.setIndex(p),this.setAttribute("position",new ht(_,3)),this.setAttribute("normal",new ht(g,3)),this.setAttribute("uv",new ht(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new es(e.width,e.height,e.widthSegments,e.heightSegments)}}var Yl=`#ifdef USE_ALPHAMAP 45 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 46#endif`,Kl=`#ifdef USE_ALPHAMAP 47 uniform sampler2D alphaMap; 48#endif`,Zl=`#ifdef USE_ALPHATEST 49 if ( diffuseColor.a < alphaTest ) discard; 50#endif`,$l=`#ifdef USE_ALPHATEST 51 uniform float alphaTest; 52#endif`,Jl=`#ifdef USE_AOMAP 53 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 54 reflectedLight.indirectDiffuse *= ambientOcclusion; 55 #if defined( USE_ENVMAP ) && defined( STANDARD ) 56 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 57 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 58 #endif 59#endif`,Ql=`#ifdef USE_AOMAP 60 uniform sampler2D aoMap; 61 uniform float aoMapIntensity; 62#endif`,ec="vec3 transformed = vec3( position );",tc=`vec3 objectNormal = vec3( normal ); 63#ifdef USE_TANGENT 64 vec3 objectTangent = vec3( tangent.xyz ); 65#endif`,nc=`float G_BlinnPhong_Implicit( ) { 66 return 0.25; 67} 68float D_BlinnPhong( const in float shininess, const in float dotNH ) { 69 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 70} 71vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 72 vec3 halfDir = normalize( lightDir + viewDir ); 73 float dotNH = saturate( dot( normal, halfDir ) ); 74 float dotVH = saturate( dot( viewDir, halfDir ) ); 75 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 76 float G = G_BlinnPhong_Implicit( ); 77 float D = D_BlinnPhong( shininess, dotNH ); 78 return F * ( G * D ); 79} // validated`,ic=`#ifdef USE_IRIDESCENCE 80 const mat3 XYZ_TO_REC709 = mat3( 81 3.2404542, -0.9692660, 0.0556434, 82 -1.5371385, 1.8760108, -0.2040259, 83 -0.4985314, 0.0415560, 1.0572252 84 ); 85 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 86 vec3 sqrtF0 = sqrt( fresnel0 ); 87 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 88 } 89 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 90 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 91 } 92 float IorToFresnel0( float transmittedIor, float incidentIor ) { 93 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 94 } 95 vec3 evalSensitivity( float OPD, vec3 shift ) { 96 float phase = 2.0 * PI * OPD * 1.0e-9; 97 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 98 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 99 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 100 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 101 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 ) ); 102 xyz /= 1.0685e-7; 103 vec3 rgb = XYZ_TO_REC709 * xyz; 104 return rgb; 105 } 106 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 107 vec3 I; 108 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 109 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 110 float cosTheta2Sq = 1.0 - sinTheta2Sq; 111 if ( cosTheta2Sq < 0.0 ) { 112 return vec3( 1.0 ); 113 } 114 float cosTheta2 = sqrt( cosTheta2Sq ); 115 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 116 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 117 float R21 = R12;
118 float T121 = 1.0 - R12; 119 float phi12 = 0.0; 120 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 121 float phi21 = PI - phi12; 122 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 123 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 124 vec3 phi23 = vec3( 0.0 ); 125 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 126 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 127 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 128 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 129 vec3 phi = vec3( phi21 ) + phi23; 130 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 131 vec3 r123 = sqrt( R123 ); 132 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 133 vec3 C0 = R12 + Rs; 134 I = C0; 135 vec3 Cm = Rs - T121; 136 for ( int m = 1; m <= 2; ++ m ) { 137 Cm *= r123; 138 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 139 I += Cm * Sm; 140 } 141 return max( I, vec3( 0.0 ) ); 142 } 143#endif`,rc=`#ifdef USE_BUMPMAP 144 uniform sampler2D bumpMap; 145 uniform float bumpScale; 146 vec2 dHdxy_fwd() { 147 vec2 dSTdx = dFdx( vBumpMapUv ); 148 vec2 dSTdy = dFdy( vBumpMapUv ); 149 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 150 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 151 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 152 return vec2( dBx, dBy ); 153 } 154 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 155 vec3 vSigmaX = dFdx( surf_pos.xyz ); 156 vec3 vSigmaY = dFdy( surf_pos.xyz ); 157 vec3 vN = surf_norm; 158 vec3 R1 = cross( vSigmaY, vN ); 159 vec3 R2 = cross( vN, vSigmaX ); 160 float fDet = dot( vSigmaX, R1 ) * faceDirection; 161 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 162 return normalize( abs( fDet ) * surf_norm - vGrad ); 163 } 164#endif`,sc=`#if NUM_CLIPPING_PLANES > 0 165 vec4 plane; 166 #pragma unroll_loop_start 167 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 168 plane = clippingPlanes[ i ]; 169 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 170 } 171 #pragma unroll_loop_end 172 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 173 bool clipped = true; 174 #pragma unroll_loop_start 175 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 176 plane = clippingPlanes[ i ]; 177 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 178 } 179 #pragma unroll_loop_end 180 if ( clipped ) discard; 181 #endif 182#endif`,ac=`#if NUM_CLIPPING_PLANES > 0 183 varying vec3 vClipPosition; 184 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 185#endif`,oc=`#if NUM_CLIPPING_PLANES > 0 186 varying vec3 vClipPosition; 187#endif`,lc=`#if NUM_CLIPPING_PLANES > 0 188 vClipPosition = - mvPosition.xyz; 189#endif`,cc=`#if defined( USE_COLOR_ALPHA ) 190 diffuseColor *= vColor; 191#elif defined( USE_COLOR ) 192 diffuseColor.rgb *= vColor; 193#endif`,uc=`#if defined( USE_COLOR_ALPHA ) 194 varying vec4 vColor; 195#elif defined( USE_COLOR ) 196 varying vec3 vColor; 197#endif`,hc=`#if defined( USE_COLOR_ALPHA ) 198 varying vec4 vColor; 199#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 200 varying vec3 vColor; 201#endif`,dc=`#if defined( USE_COLOR_ALPHA ) 202 vColor = vec4( 1.0 ); 203#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 204 vColor = vec3( 1.0 ); 205#endif 206#ifdef USE_COLOR 207 vColor *= color; 208#endif 209#ifdef USE_INSTANCING_COLOR 210 vColor.xyz *= instanceColor.xyz; 211#endif`,fc=`#define PI 3.141592653589793 212#define PI2 6.283185307179586 213#define PI_HALF 1.5707963267948966 214#define RECIPROCAL_PI 0.3183098861837907 215#define RECIPROCAL_PI2 0.15915494309189535 216#define EPSILON 1e-6 217#ifndef saturate 218#define saturate( a ) clamp( a, 0.0, 1.0 ) 219#endif 220#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 221float pow2( const in float x ) { return x*x; } 222vec3 pow2( const in vec3 x ) { return x*x; } 223float pow3( const in float x ) { return x*x*x; } 224float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 225float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 226float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 227highp float rand( const in vec2 uv ) { 228 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 229 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 230 return fract( sin( sn ) * c ); 231} 232#ifdef HIGH_PRECISION 233 float precisionSafeLength( vec3 v ) { return length( v ); } 234#else 235 float precisionSafeLength( vec3 v ) { 236 float maxComponent = max3( abs( v ) ); 237 return length( v / maxComponent ) * maxComponent; 238 } 239#endif 240struct IncidentLight { 241 vec3 color; 242 vec3 direction; 243 bool visible; 244}; 245struct ReflectedLight { 246 vec3 directDiffuse; 247 vec3 directSpecular; 248 vec3 indirectDiffuse; 249 vec3 indirectSpecular; 250}; 251struct GeometricContext { 252 vec3 position; 253 vec3 normal; 254 vec3 viewDir; 255#ifdef USE_CLEARCOAT 256 vec3 clearcoatNormal; 257#endif 258}; 259vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 260 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 261} 262vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 263 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 264} 265mat3 transposeMat3( const in mat3 m ) { 266 mat3 tmp; 267 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 268 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 269 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 270 return tmp; 271} 272float luminance( const in vec3 rgb ) { 273 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 274 return dot( weights, rgb ); 275} 276bool isPerspectiveMatrix( mat4 m ) { 277 return m[ 2 ][ 3 ] == - 1.0; 278} 279vec2 equirectUv( in vec3 dir ) { 280 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 281 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 282 return vec2( u, v ); 283}
284vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 285 return RECIPROCAL_PI * diffuseColor; 286} 287vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 288 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 289 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 290} 291float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 292 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 293 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 294} // validated`,pc=`#ifdef ENVMAP_TYPE_CUBE_UV 295 #define cubeUV_minMipLevel 4.0 296 #define cubeUV_minTileSize 16.0 297 float getFace( vec3 direction ) { 298 vec3 absDirection = abs( direction ); 299 float face = - 1.0; 300 if ( absDirection.x > absDirection.z ) { 301 if ( absDirection.x > absDirection.y ) 302 face = direction.x > 0.0 ? 0.0 : 3.0; 303 else 304 face = direction.y > 0.0 ? 1.0 : 4.0; 305 } else { 306 if ( absDirection.z > absDirection.y ) 307 face = direction.z > 0.0 ? 2.0 : 5.0; 308 else 309 face = direction.y > 0.0 ? 1.0 : 4.0; 310 } 311 return face; 312 } 313 vec2 getUV( vec3 direction, float face ) { 314 vec2 uv; 315 if ( face == 0.0 ) { 316 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 317 } else if ( face == 1.0 ) { 318 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 319 } else if ( face == 2.0 ) { 320 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 321 } else if ( face == 3.0 ) { 322 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 323 } else if ( face == 4.0 ) { 324 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 325 } else { 326 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 327 } 328 return 0.5 * ( uv + 1.0 ); 329 } 330 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 331 float face = getFace( direction ); 332 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 333 mipInt = max( mipInt, cubeUV_minMipLevel ); 334 float faceSize = exp2( mipInt ); 335 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 336 if ( face > 2.0 ) { 337 uv.y += faceSize; 338 face -= 3.0; 339 } 340 uv.x += face * faceSize; 341 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 342 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 343 uv.x *= CUBEUV_TEXEL_WIDTH; 344 uv.y *= CUBEUV_TEXEL_HEIGHT; 345 #ifdef texture2DGradEXT 346 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 347 #else 348 return texture2D( envMap, uv ).rgb; 349 #endif 350 } 351 #define cubeUV_r0 1.0 352 #define cubeUV_v0 0.339 353 #define cubeUV_m0 - 2.0 354 #define cubeUV_r1 0.8 355 #define cubeUV_v1 0.276 356 #define cubeUV_m1 - 1.0 357 #define cubeUV_r4 0.4 358 #define cubeUV_v4 0.046 359 #define cubeUV_m4 2.0 360 #define cubeUV_r5 0.305 361 #define cubeUV_v5 0.016 362 #define cubeUV_m5 3.0 363 #define cubeUV_r6 0.21 364 #define cubeUV_v6 0.0038 365 #define cubeUV_m6 4.0 366 float roughnessToMip( float roughness ) { 367 float mip = 0.0; 368 if ( roughness >= cubeUV_r1 ) { 369 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 370 } else if ( roughness >= cubeUV_r4 ) { 371 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 372 } else if ( roughness >= cubeUV_r5 ) { 373 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 374 } else if ( roughness >= cubeUV_r6 ) { 375 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 376 } else { 377 mip = - 2.0 * log2( 1.16 * roughness ); } 378 return mip; 379 } 380 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 381 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 382 float mipF = fract( mip ); 383 float mipInt = floor( mip ); 384 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 385 if ( mipF == 0.0 ) { 386 return vec4( color0, 1.0 ); 387 } else { 388 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 389 return vec4( mix( color0, color1, mipF ), 1.0 ); 390 } 391 } 392#endif`,mc=`vec3 transformedNormal = objectNormal; 393#ifdef USE_INSTANCING 394 mat3 m = mat3( instanceMatrix ); 395 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 396 transformedNormal = m * transformedNormal; 397#endif 398transformedNormal = normalMatrix * transformedNormal; 399#ifdef FLIP_SIDED 400 transformedNormal = - transformedNormal; 401#endif 402#ifdef USE_TANGENT 403 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 404 #ifdef FLIP_SIDED 405 transformedTangent = - transformedTangent; 406 #endif 407#endif`,_c=`#ifdef USE_DISPLACEMENTMAP 408 uniform sampler2D displacementMap; 409 uniform float displacementScale; 410 uniform float displacementBias; 411#endif`,gc=`#ifdef USE_DISPLACEMENTMAP 412 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
412placementBias ); 413#endif`,vc=`#ifdef USE_EMISSIVEMAP 414 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 415 totalEmissiveRadiance *= emissiveColor.rgb; 416#endif`,xc=`#ifdef USE_EMISSIVEMAP 417 uniform sampler2D emissiveMap; 418#endif`,Mc="gl_FragColor = linearToOutputTexel( gl_FragColor );",Sc=`vec4 LinearToLinear( in vec4 value ) { 419 return value; 420} 421vec4 LinearTosRGB( in vec4 value ) { 422 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 ); 423}`,Ec=`#ifdef USE_ENVMAP 424 #ifdef ENV_WORLDPOS 425 vec3 cameraToFrag; 426 if ( isOrthographic ) { 427 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 428 } else { 429 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 430 } 431 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 432 #ifdef ENVMAP_MODE_REFLECTION 433 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 434 #else 435 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 436 #endif 437 #else 438 vec3 reflectVec = vReflect; 439 #endif 440 #ifdef ENVMAP_TYPE_CUBE 441 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 442 #else 443 vec4 envColor = vec4( 0.0 ); 444 #endif 445 #ifdef ENVMAP_BLENDING_MULTIPLY 446 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 447 #elif defined( ENVMAP_BLENDING_MIX ) 448 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 449 #elif defined( ENVMAP_BLENDING_ADD ) 450 outgoingLight += envColor.xyz * specularStrength * reflectivity; 451 #endif 452#endif`,yc=`#ifdef USE_ENVMAP 453 uniform float envMapIntensity; 454 uniform float flipEnvMap; 455 #ifdef ENVMAP_TYPE_CUBE 456 uniform samplerCube envMap; 457 #else 458 uniform sampler2D envMap; 459 #endif 460 461#endif`,Tc=`#ifdef USE_ENVMAP 462 uniform float reflectivity; 463 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 464 #define ENV_WORLDPOS 465 #endif 466 #ifdef ENV_WORLDPOS 467 varying vec3 vWorldPosition; 468 uniform float refractionRatio; 469 #else 470 varying vec3 vReflect; 471 #endif 472#endif`,bc=`#ifdef USE_ENVMAP 473 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 474 #define ENV_WORLDPOS 475 #endif 476 #ifdef ENV_WORLDPOS 477 478 varying vec3 vWorldPosition; 479 #else 480 varying vec3 vReflect; 481 uniform float refractionRatio; 482 #endif 483#endif`,Ac=`#ifdef USE_ENVMAP 484 #ifdef ENV_WORLDPOS 485 vWorldPosition = worldPosition.xyz; 486 #else 487 vec3 cameraToVertex; 488 if ( isOrthographic ) { 489 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 490 } else {
491 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 492 } 493 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 494 #ifdef ENVMAP_MODE_REFLECTION 495 vReflect = reflect( cameraToVertex, worldNormal ); 496 #else 497 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 498 #endif 499 #endif 500#endif`,wc=`#ifdef USE_FOG 501 vFogDepth = - mvPosition.z; 502#endif`,Rc=`#ifdef USE_FOG 503 varying float vFogDepth; 504#endif`,Cc=`#ifdef USE_FOG 505 #ifdef FOG_EXP2 506 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 507 #else 508 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 509 #endif 510 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 511#endif`,Lc=`#ifdef USE_FOG 512 uniform vec3 fogColor; 513 varying float vFogDepth; 514 #ifdef FOG_EXP2 515 uniform float fogDensity; 516 #else 517 uniform float fogNear; 518 uniform float fogFar; 519 #endif 520#endif`,Pc=`#ifdef USE_GRADIENTMAP 521 uniform sampler2D gradientMap; 522#endif 523vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 524 float dotNL = dot( normal, lightDirection ); 525 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 526 #ifdef USE_GRADIENTMAP 527 return vec3( texture2D( gradientMap, coord ).r ); 528 #else 529 vec2 fw = fwidth( coord ) * 0.5; 530 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 531 #endif 532}`,Uc=`#ifdef USE_LIGHTMAP 533 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 534 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 535 reflectedLight.indirectDiffuse += lightMapIrradiance; 536#endif`,Dc=`#ifdef USE_LIGHTMAP 537 uniform sampler2D lightMap; 538 uniform float lightMapIntensity; 539#endif`,Ic=`LambertMaterial material; 540material.diffuseColor = diffuseColor.rgb; 541material.specularStrength = specularStrength;`,Nc=`varying vec3 vViewPosition; 542struct LambertMaterial { 543 vec3 diffuseColor; 544 float specularStrength; 545}; 546void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 547 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 548 vec3 irradiance = dotNL * directLight.color; 549 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 550} 551void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 552 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 553} 554#define RE_Direct RE_Direct_Lambert 555#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Fc=`uniform bool receiveShadow; 556uniform vec3 ambientLightColor; 557uniform vec3 lightProbe[ 9 ]; 558vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 559 float x = normal.x, y = normal.y, z = normal.z; 560 vec3 result = shCoefficients[ 0 ] * 0.886227; 561 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 562 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 563 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 564 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 565 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 566 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 567 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 568 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 569 return result; 570} 571vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 572 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 573 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 574 return irradiance; 575} 576vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 577 vec3 irradiance = ambientLightColor; 578 return irradiance; 579} 580float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 581 #if defined ( LEGACY_LIGHTS ) 582 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 583 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 584 } 585 return 1.0; 586 #else 587 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 588 if ( cutoffDistance > 0.0 ) { 589 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 590 } 591 return distanceFalloff; 592 #endif 593} 594float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 595 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 596} 597#if NUM_DIR_LIGHTS > 0 598 struct DirectionalLight { 599 vec3 direction; 600 vec3 color; 601 }; 602 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 603 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 604 light.color = directionalLight.color; 605 light.direction = directionalLight.direction; 606 light.visible = true; 607 } 608#endif 609#if NUM_POINT_LIGHTS > 0 610 struct PointLight { 611 vec3 position; 612 vec3 color; 613 float distance; 614 float decay; 615 }; 616 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 617 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 618 vec3 lVector = pointLight.position - geometry.position; 619 light.direction = normalize( lVector ); 620 float lightDistance = length( lVector ); 621 light.color = pointLight.color; 622 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 623 light.visible = ( light.color != vec3( 0.0 ) ); 624 } 625#endif
626#if NUM_SPOT_LIGHTS > 0 627 struct SpotLight { 628 vec3 position; 629 vec3 direction; 630 vec3 color; 631 float distance; 632 float decay; 633 float coneCos; 634 float penumbraCos; 635 }; 636 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 637 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 638 vec3 lVector = spotLight.position - geometry.position; 639 light.direction = normalize( lVector ); 640 float angleCos = dot( light.direction, spotLight.direction ); 641 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 642 if ( spotAttenuation > 0.0 ) { 643 float lightDistance = length( lVector ); 644 light.color = spotLight.color * spotAttenuation; 645 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 646 light.visible = ( light.color != vec3( 0.0 ) ); 647 } else { 648 light.color = vec3( 0.0 ); 649 light.visible = false; 650 } 651 } 652#endif 653#if NUM_RECT_AREA_LIGHTS > 0 654 struct RectAreaLight { 655 vec3 color; 656 vec3 position; 657 vec3 halfWidth; 658 vec3 halfHeight; 659 }; 660 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 661 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 662#endif 663#if NUM_HEMI_LIGHTS > 0 664 struct HemisphereLight { 665 vec3 direction; 666 vec3 skyColor; 667 vec3 groundColor; 668 }; 669 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 670 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 671 float dotNL = dot( normal, hemiLight.direction ); 672 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 673 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 674 return irradiance; 675 } 676#endif`,Oc=`#if defined( USE_ENVMAP ) 677 vec3 getIBLIrradiance( const in vec3 normal ) { 678 #if defined( ENVMAP_TYPE_CUBE_UV ) 679 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 680 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 681 return PI * envMapColor.rgb * envMapIntensity; 682 #else 683 return vec3( 0.0 ); 684 #endif 685 } 686 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 687 #if defined( ENVMAP_TYPE_CUBE_UV ) 688 vec3 reflectVec = reflect( - viewDir, normal ); 689 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 690 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 691 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 692 return envMapColor.rgb * envMapIntensity; 693 #else 694 return vec3( 0.0 ); 695 #endif 696 } 697#endif`,Bc=`ToonMaterial material; 698material.diffuseColor = diffuseColor.rgb;`,zc=`varying vec3 vViewPosition; 699struct ToonMaterial { 700 vec3 diffuseColor; 701}; 702void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 703 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 704 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 705} 706void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 707 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 708} 709#define RE_Direct RE_Direct_Toon 710#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Gc=`BlinnPhongMaterial material; 711material.diffuseColor = diffuseColor.rgb; 712material.specularColor = specular; 713material.specularShininess = shininess; 714material.specularStrength = specularStrength;`,Hc=`varying vec3 vViewPosition; 715struct BlinnPhongMaterial { 716 vec3 diffuseColor; 717 vec3 specularColor; 718 float specularShininess; 719 float specularStrength; 720}; 721void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 722 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 723 vec3 irradiance = dotNL * directLight.color; 724 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 725 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 726} 727void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 728 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 729} 730#define RE_Direct RE_Direct_BlinnPhong 731#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Vc=`PhysicalMaterial material; 732material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 733vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 734float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 735material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 736material.roughness = min( material.roughness, 1.0 ); 737#ifdef IOR 738 material.ior = ior; 739 #ifdef USE_SPECULAR 740 float specularIntensityFactor = specularIntensity; 741 vec3 specularColorFactor = specularColor; 742 #ifdef USE_SPECULAR_COLORMAP 743 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 744 #endif 745 #ifdef USE_SPECULAR_INTENSITYMAP 746 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 747 #endif 748 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 749 #else 750 float specularIntensityFactor = 1.0; 751 vec3 specularColorFactor = vec3( 1.0 ); 752 material.specularF90 = 1.0; 753 #endif 754 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 755#else 756 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 757 material.specularF90 = 1.0; 758#endif 759#ifdef USE_CLEARCOAT 760 material.clearcoat = clearcoat; 761 material.clearcoatRoughness = clearcoatRoughness; 762 material.clearcoatF0 = vec3( 0.04 ); 763 material.clearcoatF90 = 1.0; 764 #ifdef USE_CLEARCOATMAP 765 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 766 #endif 767 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 768 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 769 #endif 770 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 771 material.clearcoatRoughness += geometryRoughness; 772 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 773#endif
774#ifdef USE_IRIDESCENCE 775 material.iridescence = iridescence; 776 material.iridescenceIOR = iridescenceIOR; 777 #ifdef USE_IRIDESCENCEMAP 778 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 779 #endif 780 #ifdef USE_IRIDESCENCE_THICKNESSMAP 781 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 782 #else 783 material.iridescenceThickness = iridescenceThicknessMaximum; 784 #endif 785#endif 786#ifdef USE_SHEEN 787 material.sheenColor = sheenColor; 788 #ifdef USE_SHEEN_COLORMAP 789 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 790 #endif 791 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 792 #ifdef USE_SHEEN_ROUGHNESSMAP 793 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 794 #endif 795#endif`,kc=`struct PhysicalMaterial { 796 vec3 diffuseColor; 797 float roughness; 798 vec3 specularColor; 799 float specularF90; 800 #ifdef USE_CLEARCOAT 801 float clearcoat; 802 float clearcoatRoughness; 803 vec3 clearcoatF0; 804 float clearcoatF90; 805 #endif 806 #ifdef USE_IRIDESCENCE 807 float iridescence; 808 float iridescenceIOR; 809 float iridescenceThickness; 810 vec3 iridescenceFresnel; 811 vec3 iridescenceF0; 812 #endif 813 #ifdef USE_SHEEN 814 vec3 sheenColor; 815 float sheenRoughness; 816 #endif 817 #ifdef IOR 818 float ior; 819 #endif 820 #ifdef USE_TRANSMISSION 821 float transmission; 822 float transmissionAlpha; 823 float thickness; 824 float attenuationDistance; 825 vec3 attenuationColor; 826 #endif 827}; 828vec3 clearcoatSpecular = vec3( 0.0 ); 829vec3 sheenSpecular = vec3( 0.0 ); 830vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 831 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 832 float x2 = x * x; 833 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 834 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 835} 836float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 837 float a2 = pow2( alpha ); 838 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 839 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 840 return 0.5 / max( gv + gl, EPSILON ); 841} 842float D_GGX( const in float alpha, const in float dotNH ) { 843 float a2 = pow2( alpha ); 844 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 845 return RECIPROCAL_PI * a2 / pow2( denom ); 846} 847#ifdef USE_CLEARCOAT 848 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 849 vec3 f0 = material.clearcoatF0; 850 float f90 = material.clearcoatF90; 851 float roughness = material.clearcoatRoughness; 852 float alpha = pow2( roughness ); 853 vec3 halfDir = normalize( lightDir + viewDir ); 854 float dotNL = saturate( dot( normal, lightDir ) ); 855 float dotNV = saturate( dot( normal, viewDir ) ); 856 float dotNH = saturate( dot( normal, halfDir ) ); 857 float dotVH = saturate( dot( viewDir, halfDir ) ); 858 vec3 F = F_Schlick( f0, f90, dotVH ); 859 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 860 float D = D_GGX( alpha, dotNH ); 861 return F * ( V * D ); 862 } 863#endif 864vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 865 vec3 f0 = material.specularColor; 866 float f90 = material.specularF90; 867 float roughness = material.roughness; 868 float alpha = pow2( roughness ); 869 vec3 halfDir = normalize( lightDir + viewDir ); 870 float dotNL = saturate( dot( normal, lightDir ) ); 871 float dotNV = saturate( dot( normal, viewDir ) ); 872 float dotNH = saturate( dot( normal, halfDir ) ); 873 float dotVH = saturate( dot( viewDir, halfDir ) ); 874 vec3 F = F_Schlick( f0, f90, dotVH ); 875 #ifdef USE_IRIDESCENCE 876 F = mix( F, material.iridescenceFresnel, material.iridescence ); 877 #endif 878 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 879 float D = D_GGX( alpha, dotNH ); 880 return F * ( V * D ); 881} 882vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 883 const float LUT_SIZE = 64.0; 884 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 885 const float LUT_BIAS = 0.5 / LUT_SIZE; 886 float dotNV = saturate( dot( N, V ) ); 887 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 888 uv = uv * LUT_SCALE + LUT_BIAS; 889 return uv; 890} 891float LTC_ClippedSphereFormFactor( const in vec3 f ) { 892 float l = length( f ); 893 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 894} 895vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 896 float x = dot( v1, v2 ); 897 float y = abs( x ); 898 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 899 float b = 3.4175940 + ( 4.1616724 + y ) * y; 900 float v = a / b; 901 float theta_sintheta = ( x >
901 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 902 return cross( v1, v2 ) * theta_sintheta; 903} 904vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 905 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 906 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 907 vec3 lightNormal = cross( v1, v2 ); 908 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 909 vec3 T1, T2; 910 T1 = normalize( V - N * dot( V, N ) ); 911 T2 = - cross( N, T1 ); 912 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 913 vec3 coords[ 4 ]; 914 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 915 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 916 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 917 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 918 coords[ 0 ] = normalize( coords[ 0 ] ); 919 coords[ 1 ] = normalize( coords[ 1 ] ); 920 coords[ 2 ] = normalize( coords[ 2 ] ); 921 coords[ 3 ] = normalize( coords[ 3 ] ); 922 vec3 vectorFormFactor = vec3( 0.0 ); 923 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 924 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 925 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 926 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 927 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 928 return vec3( result ); 929} 930#if defined( USE_SHEEN ) 931float D_Charlie( float roughness, float dotNH ) { 932 float alpha = pow2( roughness ); 933 float invAlpha = 1.0 / alpha; 934 float cos2h = dotNH * dotNH; 935 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 936 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 937} 938float V_Neubelt( float dotNV, float dotNL ) { 939 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 940} 941vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 942 vec3 halfDir = normalize( lightDir + viewDir ); 943 float dotNL = saturate( dot( normal, lightDir ) ); 944 float dotNV = saturate( dot( normal, viewDir ) ); 945 float dotNH = saturate( dot( normal, halfDir ) ); 946 float D = D_Charlie( sheenRoughness, dotNH ); 947 float V = V_Neubelt( dotNV, dotNL ); 948 return sheenColor * ( D * V ); 949} 950#endif 951float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 952 float dotNV = saturate( dot( normal, viewDir ) ); 953 float r2 = roughness * roughness; 954 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 955 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 956 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 957 return saturate( DG * RECIPROCAL_PI ); 958} 959vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 960 float dotNV = saturate( dot( normal, viewDir ) ); 961 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 962 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 963 vec4 r = roughness * c0 + c1; 964 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 965 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 966 return fab; 967} 968vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 969 vec2 fab = DFGApprox( normal, viewDir, roughness ); 970 return specularColor * fab.x + specularF90 * fab.y; 971} 972#ifdef USE_IRIDESCENCE 973void 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 ) { 974#else 975void 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 ) { 976#endif 977 vec2 fab = DFGApprox( normal, viewDir, roughness ); 978 #ifdef USE_IRIDESCENCE 979 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 980 #else 981 vec3 Fr = specularColor; 982 #endif 983 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 984 float Ess = fab.x + fab.y; 985 float Ems = 1.0 - Ess; 986 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 987 singleScatter += FssEss; 988 multiScatter += Fms * Ems; 989} 990#if NUM_RECT_AREA_LIGHTS > 0 991 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 992 vec3 normal = geometry.normal; 993 vec3 viewDir = geometry.viewDir; 994 vec3 position = geometry.position;
995 vec3 lightPos = rectAreaLight.position; 996 vec3 halfWidth = rectAreaLight.halfWidth; 997 vec3 halfHeight = rectAreaLight.halfHeight; 998 vec3 lightColor = rectAreaLight.color; 999 float roughness = material.roughness; 1000 vec3 rectCoords[ 4 ]; 1001 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1002 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1003 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1004 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1005 vec4 t1 = texture2D( ltc_1, uv ); 1006 vec4 t2 = texture2D( ltc_2, uv ); 1007 mat3 mInv = mat3( 1008 vec3( t1.x, 0, t1.y ), 1009 vec3( 0, 1, 0 ), 1010 vec3( t1.z, 0, t1.w ) 1011 ); 1012 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1013 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1014 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1015 } 1016#endif 1017void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1018 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1019 vec3 irradiance = dotNL * directLight.color; 1020 #ifdef USE_CLEARCOAT 1021 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1022 vec3 ccIrradiance = dotNLcc * directLight.color; 1023 clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); 1024 #endif 1025 #ifdef USE_SHEEN 1026 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1027 #endif 1028 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); 1029 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1030} 1031void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1032 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1033} 1034void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1035 #ifdef USE_CLEARCOAT 1036 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1037 #endif 1038 #ifdef USE_SHEEN 1039 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1040 #endif 1041 vec3 singleScattering = vec3( 0.0 ); 1042 vec3 multiScattering = vec3( 0.0 ); 1043 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1044 #ifdef USE_IRIDESCENCE 1045 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1046 #else 1047 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1048 #endif 1049 vec3 totalScattering = singleScattering + multiScattering; 1050 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1051 reflectedLight.indirectSpecular += radiance * singleScattering; 1052 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1053 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1054} 1055#define RE_Direct RE_Direct_Physical 1056#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1057#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1058#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1059float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1060 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1061}`,Wc=` 1062GeometricContext geometry; 1063geometry.position = - vViewPosition; 1064geometry.normal = normal; 1065geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1066#ifdef USE_CLEARCOAT 1067 geometry.clearcoatNormal = clearcoatNormal; 1068#endif
1069#ifdef USE_IRIDESCENCE 1070 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1071 if ( material.iridescenceThickness == 0.0 ) { 1072 material.iridescence = 0.0; 1073 } else { 1074 material.iridescence = saturate( material.iridescence ); 1075 } 1076 if ( material.iridescence > 0.0 ) { 1077 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1078 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1079 } 1080#endif 1081IncidentLight directLight; 1082#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1083 PointLight pointLight; 1084 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1085 PointLightShadow pointLightShadow; 1086 #endif 1087 #pragma unroll_loop_start 1088 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1089 pointLight = pointLights[ i ]; 1090 getPointLightInfo( pointLight, geometry, directLight ); 1091 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1092 pointLightShadow = pointLightShadows[ i ]; 1093 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1094 #endif 1095 RE_Direct( directLight, geometry, material, reflectedLight ); 1096 } 1097 #pragma unroll_loop_end 1098#endif 1099#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1100 SpotLight spotLight; 1101 vec4 spotColor; 1102 vec3 spotLightCoord; 1103 bool inSpotLightMap; 1104 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1105 SpotLightShadow spotLightShadow; 1106 #endif 1107 #pragma unroll_loop_start 1108 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1109 spotLight = spotLights[ i ]; 1110 getSpotLightInfo( spotLight, geometry, directLight ); 1111 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1112 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1113 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1114 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1115 #else 1116 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1117 #endif 1118 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1119 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1120 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1121 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1122 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1123 #endif 1124 #undef SPOT_LIGHT_MAP_INDEX 1125 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1126 spotLightShadow = spotLightShadows[ i ]; 1127 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1128 #endif 1129 RE_Direct( directLight, geometry, material, reflectedLight ); 1130 } 1131 #pragma unroll_loop_end 1132#endif 1133#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1134 DirectionalLight directionalLight; 1135 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1136 DirectionalLightShadow directionalLightShadow; 1137 #endif 1138 #pragma unroll_loop_start 1139 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1140 directionalLight = directionalLights[ i ]; 1141 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1142 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1143 directionalLightShadow = directionalLightShadows[ i ]; 1144 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1145 #endif 1146 RE_Direct( directLight, geometry, material, reflectedLight ); 1147 } 1148 #pragma unroll_loop_end 1149#endif 1150#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1151 RectAreaLight rectAreaLight; 1152 #pragma unroll_loop_start 1153 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1154 rectAreaLight = rectAreaLights[ i ]; 1155 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1156 } 1157 #pragma unroll_loop_end 1158#endif 1159#if defined( RE_IndirectDiffuse ) 1160 vec3 iblIrradiance = vec3( 0.0 ); 1161 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1162 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1163 #if ( NUM_HEMI_LIGHTS > 0 ) 1164 #pragma unroll_loop_start 1165 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1166 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1167 } 1168 #pragma unroll_loop_end 1169 #endif 1170#endif 1171#if defined( RE_IndirectSpecular ) 1172 vec3 radiance = vec3( 0.0 ); 1173 vec3 clearcoatRadiance = vec3( 0.0 ); 1174#endif`,Xc=`#if defined( RE_IndirectDiffuse ) 1175 #ifdef USE_LIGHTMAP 1176 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1177 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1178 irradiance += lightMapIrradiance; 1179 #endif 1180 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1181 iblIrradiance += getIBLIrradiance( geometry.normal ); 1182 #endif 1183#endif 1184#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1185 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1186 #ifdef USE_CLEARCOAT 1187 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1188 #endif 1189#endif`,qc=`#if defined( RE_IndirectDiffuse ) 1190 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1191#endif 1192#if defined( RE_IndirectSpecular ) 1193 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1194#endif`,jc=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1195 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1196#endif`,Yc=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1197 uniform float logDepthBufFC; 1198 varying float vFragDepth; 1199 varying float vIsPerspective; 1200#endif`,Kc=`#ifdef USE_LOGDEPTHBUF 1201 #ifdef USE_LOGDEPTHBUF_EXT 1202 varying float vFragDepth; 1203 varying float vIsPerspective; 1204 #else 1205 uniform float logDepthBufFC; 1206 #endif 1207#endif`,Zc=`#ifdef USE_LOGDEPTHBUF 1208 #ifdef USE_LOGDEPTHBUF_EXT 1209 vFragDepth = 1.0 + gl_Position.w; 1210 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1211 #else 1212 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1213 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1214 gl_Position.z *= gl_Position.w; 1215 } 1216 #endif 1217#endif`,$c=`#ifdef USE_MAP 1218 diffuseColor *= texture2D( map, vMapUv ); 1219#endif`,Jc=`#ifdef USE_MAP 1220 uniform sampler2D map; 1221#endif`,Qc=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1222 #if defined( USE_POINTS_UV ) 1223 vec2 uv = vUv; 1224 #else 1225 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1226 #endif 1227#endif 1228#ifdef USE_MAP 1229 diffuseColor *= texture2D( map, uv ); 1230#endif 1231#ifdef USE_ALPHAMAP 1232 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1233#endif`,eu=`#if defined( USE_POINTS_UV ) 1234 varying vec2 vUv; 1235#else 1236 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1237 uniform mat3 uvTransform; 1238 #endif 1239#endif 1240#ifdef USE_MAP 1241 uniform sampler2D map; 1242#endif 1243#ifdef USE_ALPHAMAP 1244 uniform sampler2D alphaMap; 1245#endif`,tu=`float metalnessFactor = metalness; 1246#ifdef USE_METALNESSMAP 1247 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1248 metalnessFactor *= texelMetalness.b; 1249#endif`,nu=`#ifdef USE_METALNESSMAP 1250 uniform sampler2D metalnessMap; 1251#endif`,iu=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1252 vColor *= morphTargetBaseInfluence; 1253 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1254 #if defined( USE_COLOR_ALPHA ) 1255 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1256 #elif defined( USE_COLOR ) 1257 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1258 #endif 1259 } 1260#endif`,ru=`#ifdef USE_MORPHNORMALS 1261 objectNormal *= morphTargetBaseInfluence; 1262 #ifdef MORPHTARGETS_TEXTURE 1263 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1264 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1265 } 1266 #else 1267 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1268 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1269 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1270 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1271 #endif 1272#endif`,su=`#ifdef USE_MORPHTARGETS 1273 uniform float morphTargetBaseInfluence; 1274 #ifdef MORPHTARGETS_TEXTURE 1275 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1276 uniform sampler2DArray morphTargetsTexture; 1277 uniform ivec2 morphTargetsTextureSize; 1278 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1279 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1280 int y = texelIndex / morphTargetsTextureSize.x; 1281 int x = texelIndex - y * morphTargetsTextureSize.x; 1282 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1283 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1284 } 1285 #else 1286 #ifndef USE_MORPHNORMALS 1287 uniform float morphTargetInfluences[ 8 ]; 1288 #else 1289 uniform float morphTargetInfluences[ 4 ]; 1290 #endif 1291 #endif 1292#endif`,au=`#ifdef USE_MORPHTARGETS 1293 transformed *= morphTargetBaseInfluence; 1294 #ifdef MORPHTARGETS_TEXTURE 1295 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1296 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1297 } 1298 #else 1299 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1300 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1301 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1302 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1303 #ifndef USE_MORPHNORMALS 1304 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1305 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1306 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1307 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1308 #endif 1309 #endif 1310#endif`,ou=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1311#ifdef FLAT_SHADED 1312 vec3 fdx = dFdx( vViewPosition ); 1313 vec3 fdy = dFdy( vViewPosition ); 1314 vec3 normal = normalize( cross( fdx, fdy ) ); 1315#else 1316 vec3 normal = normalize( vNormal ); 1317 #ifdef DOUBLE_SIDED 1318 normal *= faceDirection; 1319 #endif 1320#endif 1321#ifdef USE_NORMALMAP_TANGENTSPACE 1322 #ifdef USE_TANGENT 1323 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1324 #else 1325 mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv ); 1326 #endif 1327 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1328 tbn[0] *= faceDirection; 1329 tbn[1] *= faceDirection; 1330 #endif 1331#endif 1332#ifdef USE_CLEARCOAT_NORMALMAP 1333 #ifdef USE_TANGENT 1334 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1335 #else 1336 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1337 #endif 1338 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1339 tbn2[0] *= faceDirection; 1340 tbn2[1] *= faceDirection; 1341 #endif 1342#endif 1343vec3 geometryNormal = normal;`,lu=`#ifdef USE_NORMALMAP_OBJECTSPACE 1344 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1345 #ifdef FLIP_SIDED 1346 normal = - normal; 1347 #endif 1348 #ifdef DOUBLE_SIDED 1349 normal = normal * faceDirection; 1350 #endif 1351 normal = normalize( normalMatrix * normal ); 1352#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1353 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1354 mapN.xy *= normalScale; 1355 normal = normalize( tbn * mapN ); 1356#elif defined( USE_BUMPMAP )
1357 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1358#endif`,cu=`#ifndef FLAT_SHADED 1359 varying vec3 vNormal; 1360 #ifdef USE_TANGENT 1361 varying vec3 vTangent; 1362 varying vec3 vBitangent; 1363 #endif 1364#endif`,uu=`#ifndef FLAT_SHADED 1365 varying vec3 vNormal; 1366 #ifdef USE_TANGENT 1367 varying vec3 vTangent; 1368 varying vec3 vBitangent; 1369 #endif 1370#endif`,hu=`#ifndef FLAT_SHADED 1371 vNormal = normalize( transformedNormal ); 1372 #ifdef USE_TANGENT 1373 vTangent = normalize( transformedTangent ); 1374 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1375 #endif 1376#endif`,du=`#ifdef USE_NORMALMAP 1377 uniform sampler2D normalMap; 1378 uniform vec2 normalScale; 1379#endif 1380#ifdef USE_NORMALMAP_OBJECTSPACE 1381 uniform mat3 normalMatrix; 1382#endif 1383#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1384 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1385 vec3 q0 = dFdx( eye_pos.xyz ); 1386 vec3 q1 = dFdy( eye_pos.xyz ); 1387 vec2 st0 = dFdx( uv.st ); 1388 vec2 st1 = dFdy( uv.st ); 1389 vec3 N = surf_norm; 1390 vec3 q1perp = cross( q1, N ); 1391 vec3 q0perp = cross( N, q0 ); 1392 vec3 T = q1perp * st0.x + q0perp * st1.x; 1393 vec3 B = q1perp * st0.y + q0perp * st1.y; 1394 float det = max( dot( T, T ), dot( B, B ) ); 1395 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1396 return mat3( T * scale, B * scale, N ); 1397 } 1398#endif`,fu=`#ifdef USE_CLEARCOAT 1399 vec3 clearcoatNormal = geometryNormal; 1400#endif`,pu=`#ifdef USE_CLEARCOAT_NORMALMAP 1401 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1402 clearcoatMapN.xy *= clearcoatNormalScale; 1403 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1404#endif`,mu=`#ifdef USE_CLEARCOATMAP 1405 uniform sampler2D clearcoatMap; 1406#endif 1407#ifdef USE_CLEARCOAT_NORMALMAP 1408 uniform sampler2D clearcoatNormalMap; 1409 uniform vec2 clearcoatNormalScale; 1410#endif 1411#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1412 uniform sampler2D clearcoatRoughnessMap; 1413#endif`,_u=`#ifdef USE_IRIDESCENCEMAP 1414 uniform sampler2D iridescenceMap; 1415#endif 1416#ifdef USE_IRIDESCENCE_THICKNESSMAP 1417 uniform sampler2D iridescenceThicknessMap; 1418#endif`,gu=`#ifdef OPAQUE 1419diffuseColor.a = 1.0; 1420#endif 1421#ifdef USE_TRANSMISSION 1422diffuseColor.a *= material.transmissionAlpha + 0.1; 1423#endif 1424gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,vu=`vec3 packNormalToRGB( const in vec3 normal ) { 1425 return normalize( normal ) * 0.5 + 0.5; 1426} 1427vec3 unpackRGBToNormal( const in vec3 rgb ) { 1428 return 2.0 * rgb.xyz - 1.0; 1429} 1430const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1431const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1432const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1433const float ShiftRight8 = 1. / 256.; 1434vec4 packDepthToRGBA( const in float v ) { 1435 vec4 r = vec4( fract( v * PackFactors ), v ); 1436 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1437} 1438float unpackRGBAToDepth( const in vec4 v ) { 1439 return dot( v, UnpackFactors ); 1440} 1441vec2 packDepthToRG( in highp float v ) { 1442 return packDepthToRGBA( v ).yx; 1443} 1444float unpackRGToDepth( const in highp vec2 v ) { 1445 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1446} 1447vec4 pack2HalfToRGBA( vec2 v ) { 1448 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1449 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1450} 1451vec2 unpackRGBATo2Half( vec4 v ) { 1452 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1453} 1454float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1455 return ( viewZ + near ) / ( near - far ); 1456} 1457float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1458 return depth * ( near - far ) - near; 1459} 1460float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1461 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1462} 1463float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1464 return ( near * far ) / ( ( far - near ) * depth - far ); 1465}`,xu=`#ifdef PREMULTIPLIED_ALPHA 1466 gl_FragColor.rgb *= gl_FragColor.a; 1467#endif`,Mu=`vec4 mvPosition = vec4( transformed, 1.0 ); 1468#ifdef USE_INSTANCING 1469 mvPosition = instanceMatrix * mvPosition; 1470#endif 1471mvPosition = modelViewMatrix * mvPosition; 1472gl_Position = projectionMatrix * mvPosition;`,Su=`#ifdef DITHERING 1473 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1474#endif`,Eu=`#ifdef DITHERING 1475 vec3 dithering( vec3 color ) { 1476 float grid_position = rand( gl_FragCoord.xy ); 1477 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1478 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1479 return color + dither_shift_RGB; 1480 } 1481#endif`,yu=`float roughnessFactor = roughness; 1482#ifdef USE_ROUGHNESSMAP 1483 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1484 roughnessFactor *= texelRoughness.g; 1485#endif`,Tu=`#ifdef USE_ROUGHNESSMAP 1486 uniform sampler2D roughnessMap;
1487#endif`,bu=`#if NUM_SPOT_LIGHT_COORDS > 0 1488 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1489#endif 1490#if NUM_SPOT_LIGHT_MAPS > 0 1491 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1492#endif 1493#ifdef USE_SHADOWMAP 1494 #if NUM_DIR_LIGHT_SHADOWS > 0 1495 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1496 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1497 struct DirectionalLightShadow { 1498 float shadowBias; 1499 float shadowNormalBias; 1500 float shadowRadius; 1501 vec2 shadowMapSize; 1502 }; 1503 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1504 #endif 1505 #if NUM_SPOT_LIGHT_SHADOWS > 0 1506 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1507 struct SpotLightShadow { 1508 float shadowBias; 1509 float shadowNormalBias; 1510 float shadowRadius; 1511 vec2 shadowMapSize; 1512 }; 1513 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1514 #endif 1515 #if NUM_POINT_LIGHT_SHADOWS > 0 1516 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1517 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1518 struct PointLightShadow { 1519 float shadowBias; 1520 float shadowNormalBias; 1521 float shadowRadius; 1522 vec2 shadowMapSize; 1523 float shadowCameraNear; 1524 float shadowCameraFar; 1525 }; 1526 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1527 #endif 1528 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1529 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1530 } 1531 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1532 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1533 } 1534 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1535 float occlusion = 1.0; 1536 vec2 distribution = texture2DDistribution( shadow, uv ); 1537 float hard_shadow = step( compare , distribution.x ); 1538 if (hard_shadow != 1.0 ) { 1539 float distance = compare - distribution.x ; 1540 float variance = max( 0.00000, distribution.y * distribution.y ); 1541 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 ); 1542 } 1543 return occlusion; 1544 } 1545 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1546 float shadow = 1.0; 1547 shadowCoord.xyz /= shadowCoord.w; 1548 shadowCoord.z += shadowBias; 1549 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1550 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1551 if ( frustumTest ) { 1552 #if defined( SHADOWMAP_TYPE_PCF ) 1553 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1554 float dx0 = - texelSize.x * shadowRadius; 1555 float dy0 = - texelSize.y * shadowRadius; 1556 float dx1 = + texelSize.x * shadowRadius; 1557 float dy1 = + texelSize.y * shadowRadius; 1558 float dx2 = dx0 / 2.0; 1559 float dy2 = dy0 / 2.0; 1560 float dx3 = dx1 / 2.0; 1561 float dy3 = dy1 / 2.0; 1562 shadow = ( 1563 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1564 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1565 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1566 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1567 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1568 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1569 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1570 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1571 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1572 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1573 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1574 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1575 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1576 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1577 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1578 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1579 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1580 ) * ( 1.0 / 17.0 ); 1581 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1582 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1583 float dx = texelSize.x; 1584 float dy = texelSize.y; 1585 vec2 uv = shadowCoord.xy;
1586 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1587 uv -= f * texelSize; 1588 shadow = ( 1589 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1590 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1591 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1592 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1593 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1594 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1595 f.x ) + 1596 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1597 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1598 f.x ) + 1599 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1600 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1601 f.y ) + 1602 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1603 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1604 f.y ) + 1605 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1606 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1607 f.x ), 1608 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1609 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1610 f.x ), 1611 f.y ) 1612 ) * ( 1.0 / 9.0 ); 1613 #elif defined( SHADOWMAP_TYPE_VSM ) 1614 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1615 #else 1616 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1617 #endif 1618 } 1619 return shadow; 1620 } 1621 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1622 vec3 absV = abs( v ); 1623 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1624 absV *= scaleToCube; 1625 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1626 vec2 planar = v.xy; 1627 float almostATexel = 1.5 * texelSizeY; 1628 float almostOne = 1.0 - almostATexel; 1629 if ( absV.z >= almostOne ) { 1630 if ( v.z > 0.0 ) 1631 planar.x = 4.0 - v.x; 1632 } else if ( absV.x >= almostOne ) { 1633 float signX = sign( v.x ); 1634 planar.x = v.z * signX + 2.0 * signX; 1635 } else if ( absV.y >= almostOne ) { 1636 float signY = sign( v.y ); 1637 planar.x = v.x + 2.0 * signY + 2.0; 1638 planar.y = v.z * signY - 2.0; 1639 } 1640 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1641 } 1642 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1643 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1644 vec3 lightToPosition = shadowCoord.xyz; 1645 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1646 vec3 bd3D = normalize( lightToPosition ); 1647 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1648 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1649 return ( 1650 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1651 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1652 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1653 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1654 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1655 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1656 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1657 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1658 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1659 ) * ( 1.0 / 9.0 ); 1660 #else 1661 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1662 #endif 1663 } 1664#endif`,Au=`#if NUM_SPOT_LIGHT_COORDS > 0 1665 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1666 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1667#endif 1668#ifdef USE_SHADOWMAP 1669 #if NUM_DIR_LIGHT_SHADOWS > 0 1670 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1671 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1672 struct DirectionalLightShadow { 1673 float shadowBias; 1674 float shadowNormalBias; 1675 float shadowRadius; 1676 vec2 shadowMapSize; 1677 }; 1678 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1679 #endif
1680 #if NUM_SPOT_LIGHT_SHADOWS > 0 1681 struct SpotLightShadow { 1682 float shadowBias; 1683 float shadowNormalBias; 1684 float shadowRadius; 1685 vec2 shadowMapSize; 1686 }; 1687 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1688 #endif 1689 #if NUM_POINT_LIGHT_SHADOWS > 0 1690 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1691 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1692 struct PointLightShadow { 1693 float shadowBias; 1694 float shadowNormalBias; 1695 float shadowRadius; 1696 vec2 shadowMapSize; 1697 float shadowCameraNear; 1698 float shadowCameraFar; 1699 }; 1700 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1701 #endif 1702#endif`,wu=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1703 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1704 vec4 shadowWorldPosition; 1705#endif 1706#if defined( USE_SHADOWMAP ) 1707 #if NUM_DIR_LIGHT_SHADOWS > 0 1708 #pragma unroll_loop_start 1709 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1710 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1711 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1712 } 1713 #pragma unroll_loop_end 1714 #endif 1715 #if NUM_POINT_LIGHT_SHADOWS > 0 1716 #pragma unroll_loop_start 1717 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1718 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1719 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1720 } 1721 #pragma unroll_loop_end 1722 #endif 1723#endif 1724#if NUM_SPOT_LIGHT_COORDS > 0 1725 #pragma unroll_loop_start 1726 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1727 shadowWorldPosition = worldPosition; 1728 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1729 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1730 #endif 1731 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1732 } 1733 #pragma unroll_loop_end 1734#endif`,Ru=`float getShadowMask() { 1735 float shadow = 1.0; 1736 #ifdef USE_SHADOWMAP 1737 #if NUM_DIR_LIGHT_SHADOWS > 0 1738 DirectionalLightShadow directionalLight; 1739 #pragma unroll_loop_start 1740 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1741 directionalLight = directionalLightShadows[ i ]; 1742 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1743 } 1744 #pragma unroll_loop_end 1745 #endif 1746 #if NUM_SPOT_LIGHT_SHADOWS > 0 1747 SpotLightShadow spotLight; 1748 #pragma unroll_loop_start 1749 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1750 spotLight = spotLightShadows[ i ]; 1751 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1752 } 1753 #pragma unroll_loop_end 1754 #endif 1755 #if NUM_POINT_LIGHT_SHADOWS > 0 1756 PointLightShadow pointLight; 1757 #pragma unroll_loop_start 1758 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1759 pointLight = pointLightShadows[ i ]; 1760 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1761 } 1762 #pragma unroll_loop_end 1763 #endif 1764 #endif 1765 return shadow; 1766}`,Cu=`#ifdef USE_SKINNING 1767 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1768 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1769 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1770 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1771#endif`,Lu=`#ifdef USE_SKINNING 1772 uniform mat4 bindMatrix; 1773 uniform mat4 bindMatrixInverse; 1774 uniform highp sampler2D boneTexture; 1775 uniform int boneTextureSize; 1776 mat4 getBoneMatrix( const in float i ) { 1777 float j = i * 4.0; 1778 float x = mod( j, float( boneTextureSize ) ); 1779 float y = floor( j / float( boneTextureSize ) ); 1780 float dx = 1.0 / float( boneTextureSize ); 1781 float dy = 1.0 / float( boneTextureSize ); 1782 y = dy * ( y + 0.5 ); 1783 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1784 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1785 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1786 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1787 mat4 bone = mat4( v1, v2, v3, v4 ); 1788 return bone; 1789 } 1790#endif`,Pu=`#ifdef USE_SKINNING 1791 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1792 vec4 skinned = vec4( 0.0 ); 1793 skinned += boneMatX * skinVertex * skinWeight.x; 1794 skinned += boneMatY * skinVertex * skinWeight.y; 1795 skinned += boneMatZ * skinVertex * skinWeight.z; 1796 skinned += boneMatW * skinVertex * skinWeight.w; 1797 transformed = ( bindMatrixInverse * skinned ).xyz; 1798#endif`,Uu=`#ifdef USE_SKINNING 1799 mat4 skinMatrix = mat4( 0.0 ); 1800 skinMatrix += skinWeight.x * boneMatX; 1801 skinMatrix += skinWeight.y * boneMatY; 1802 skinMatrix += skinWeight.z * boneMatZ; 1803 skinMatrix += skinWeight.w * boneMatW; 1804 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1805 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1806 #ifdef USE_TANGENT 1807 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1808 #endif 1809#endif`,Du=`float specularStrength; 1810#ifdef USE_SPECULARMAP 1811 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 1812 specularStrength = texelSpecular.r; 1813#else 1814 specularStrength = 1.0; 1815#endif`,Iu=`#ifdef USE_SPECULARMAP 1816 uniform sampler2D specularMap; 1817#endif`,Nu=`#if defined( TONE_MAPPING ) 1818 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1819#endif`,Fu=`#ifndef saturate 1820#define saturate( a ) clamp( a, 0.0, 1.0 ) 1821#endif 1822uniform float toneMappingExposure; 1823vec3 LinearToneMapping( vec3 color ) { 1824 return toneMappingExposure * color; 1825} 1826vec3 ReinhardToneMapping( vec3 color ) { 1827 color *= toneMappingExposure; 1828 return saturate( color / ( vec3( 1.0 ) + color ) ); 1829} 1830vec3 OptimizedCineonToneMapping( vec3 color ) { 1831 color *= toneMappingExposure; 1832 color = max( vec3( 0.0 ), color - 0.004 ); 1833 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1834} 1835vec3 RRTAndODTFit( vec3 v ) { 1836 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1837 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1838 return a / b; 1839} 1840vec3 ACESFilmicToneMapping( vec3 color ) { 1841 const mat3 ACESInputMat = mat3( 1842 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1843 vec3( 0.04823, 0.01566, 0.83777 ) 1844 ); 1845 const mat3 ACESOutputMat = mat3( 1846 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1847 vec3( -0.07367, -0.00605, 1.07602 ) 1848 ); 1849 color *= toneMappingExposure / 0.6; 1850 color = ACESInputMat * color; 1851 color = RRTAndODTFit( color ); 1852 color = ACESOutputMat * color; 1853 return saturate( color ); 1854} 1855vec3 CustomToneMapping( vec3 color ) { return color; }`,Ou=`#ifdef USE_TRANSMISSION 1856 material.transmission = transmission; 1857 material.transmissionAlpha = 1.0; 1858 material.thickness = thickness; 1859 material.attenuationDistance = attenuationDistance; 1860 material.attenuationColor = attenuationColor; 1861 #ifdef USE_TRANSMISSIONMAP 1862 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 1863 #endif 1864 #ifdef USE_THICKNESSMAP 1865 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 1866 #endif 1867 vec3 pos = vWorldPosition; 1868 vec3 v = normalize( cameraPosition - pos ); 1869 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1870 vec4 transmission = getIBLVolumeRefraction( 1871 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1872 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1873 material.attenuationColor, material.attenuationDistance ); 1874 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1875 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1876#endif`,Bu=`#ifdef USE_TRANSMISSION 1877 uniform float transmission; 1878 uniform float thickness; 1879 uniform float attenuationDistance; 1880 uniform vec3 attenuationColor; 1881 #ifdef USE_TRANSMISSIONMAP 1882 uniform sampler2D transmissionMap; 1883 #endif 1884 #ifdef USE_THICKNESSMAP 1885 uniform sampler2D thicknessMap; 1886 #endif 1887 uniform vec2 transmissionSamplerSize; 1888 uniform sampler2D transmissionSamplerMap; 1889 uniform mat4 modelMatrix; 1890 uniform mat4 projectionMatrix; 1891 varying vec3 vWorldPosition; 1892 float w0( float a ) { 1893 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 1894 } 1895 float w1( float a ) { 1896 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 1897 } 1898 float w2( float a ){ 1899 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 1900 } 1901 float w3( float a ) { 1902 return ( 1.0 / 6.0 ) * ( a * a * a ); 1903 } 1904 float g0( float a ) { 1905 return w0( a ) + w1( a ); 1906 } 1907 float g1( float a ) { 1908 return w2( a ) + w3( a ); 1909 } 1910 float h0( float a ) { 1911 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 1912 } 1913 float h1( float a ) { 1914 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 1915 } 1916 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 1917 uv = uv * texelSize.zw + 0.5; 1918 vec2 iuv = floor( uv ); 1919 vec2 fuv = fract( uv ); 1920 float g0x = g0( fuv.x ); 1921 float g1x = g1( fuv.x ); 1922 float h0x = h0( fuv.x ); 1923 float h1x = h1( fuv.x ); 1924 float h0y = h0( fuv.y ); 1925 float h1y = h1( fuv.y ); 1926 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 1927 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 1928 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 1929 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 1930 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 1931 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 1932 } 1933 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 1934 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 1935 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 1936 vec2 fLodSizeInv = 1.0 / fLodSize; 1937 vec2 cLodSizeInv = 1.0 / cLodSize; 1938 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 1939 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 1940 return mix( fSample, cSample, fract( lod ) ); 1941 } 1942 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1943 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1944 vec3 modelScale; 1945 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1946 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1947 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1948 return normalize( refractionVector ) * thickness * modelScale; 1949 } 1950 float applyIorToRoughness( const in float roughness, const in float ior ) { 1951 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1952 } 1953 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1954 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1955 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 1956 } 1957 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1958 if ( isinf( attenuationDistance ) ) { 1959 return radiance; 1960 } else { 1961 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1962 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1963 } 1964 } 1965 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1966 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1967 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1968 const in vec3 attenuationColor, const in float attenuationDistance ) { 1969 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1970 vec3 refractedRayExit = position + transmissionRay; 1971 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1972 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1973 refractionCoords += 1.0; 1974 refractionCoords /= 2.0; 1975 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1976 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1977 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1978 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1979 } 1980#endif`,zu=`#ifdef USE_UV 1981 varying vec2 vUv; 1982#endif 1983#ifdef USE_MAP 1984 varying vec2 vMapUv; 1985#endif 1986#ifdef USE_ALPHAMAP
1987 varying vec2 vAlphaMapUv; 1988#endif 1989#ifdef USE_LIGHTMAP 1990 varying vec2 vLightMapUv; 1991#endif 1992#ifdef USE_AOMAP 1993 varying vec2 vAoMapUv; 1994#endif 1995#ifdef USE_BUMPMAP 1996 varying vec2 vBumpMapUv; 1997#endif 1998#ifdef USE_NORMALMAP 1999 varying vec2 vNormalMapUv; 2000#endif 2001#ifdef USE_EMISSIVEMAP 2002 varying vec2 vEmissiveMapUv; 2003#endif 2004#ifdef USE_METALNESSMAP 2005 varying vec2 vMetalnessMapUv; 2006#endif 2007#ifdef USE_ROUGHNESSMAP 2008 varying vec2 vRoughnessMapUv; 2009#endif 2010#ifdef USE_CLEARCOATMAP 2011 varying vec2 vClearcoatMapUv; 2012#endif 2013#ifdef USE_CLEARCOAT_NORMALMAP 2014 varying vec2 vClearcoatNormalMapUv; 2015#endif 2016#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2017 varying vec2 vClearcoatRoughnessMapUv; 2018#endif 2019#ifdef USE_IRIDESCENCEMAP 2020 varying vec2 vIridescenceMapUv; 2021#endif 2022#ifdef USE_IRIDESCENCE_THICKNESSMAP 2023 varying vec2 vIridescenceThicknessMapUv; 2024#endif 2025#ifdef USE_SHEEN_COLORMAP 2026 varying vec2 vSheenColorMapUv; 2027#endif 2028#ifdef USE_SHEEN_ROUGHNESSMAP 2029 varying vec2 vSheenRoughnessMapUv; 2030#endif 2031#ifdef USE_SPECULARMAP 2032 varying vec2 vSpecularMapUv; 2033#endif 2034#ifdef USE_SPECULAR_COLORMAP 2035 varying vec2 vSpecularColorMapUv; 2036#endif 2037#ifdef USE_SPECULAR_INTENSITYMAP 2038 varying vec2 vSpecularIntensityMapUv; 2039#endif 2040#ifdef USE_TRANSMISSIONMAP 2041 uniform mat3 transmissionMapTransform; 2042 varying vec2 vTransmissionMapUv; 2043#endif 2044#ifdef USE_THICKNESSMAP 2045 uniform mat3 thicknessMapTransform; 2046 varying vec2 vThicknessMapUv; 2047#endif`,Gu=`#ifdef USE_UV 2048 varying vec2 vUv; 2049#endif 2050#ifdef USE_MAP 2051 uniform mat3 mapTransform; 2052 varying vec2 vMapUv; 2053#endif 2054#ifdef USE_ALPHAMAP 2055 uniform mat3 alphaMapTransform; 2056 varying vec2 vAlphaMapUv; 2057#endif 2058#ifdef USE_LIGHTMAP 2059 uniform mat3 lightMapTransform; 2060 varying vec2 vLightMapUv; 2061#endif 2062#ifdef USE_AOMAP 2063 uniform mat3 aoMapTransform; 2064 varying vec2 vAoMapUv; 2065#endif 2066#ifdef USE_BUMPMAP 2067 uniform mat3 bumpMapTransform; 2068 varying vec2 vBumpMapUv; 2069#endif 2070#ifdef USE_NORMALMAP 2071 uniform mat3 normalMapTransform; 2072 varying vec2 vNormalMapUv; 2073#endif 2074#ifdef USE_DISPLACEMENTMAP 2075 uniform mat3 displacementMapTransform; 2076 varying vec2 vDisplacementMapUv; 2077#endif 2078#ifdef USE_EMISSIVEMAP 2079 uniform mat3 emissiveMapTransform; 2080 varying vec2 vEmissiveMapUv; 2081#endif 2082#ifdef USE_METALNESSMAP 2083 uniform mat3 metalnessMapTransform; 2084 varying vec2 vMetalnessMapUv; 2085#endif 2086#ifdef USE_ROUGHNESSMAP 2087 uniform mat3 roughnessMapTransform; 2088 varying vec2 vRoughnessMapUv; 2089#endif 2090#ifdef USE_CLEARCOATMAP 2091 uniform mat3 clearcoatMapTransform; 2092 varying vec2 vClearcoatMapUv; 2093#endif 2094#ifdef USE_CLEARCOAT_NORMALMAP 2095 uniform mat3 clearcoatNormalMapTransform; 2096 varying vec2 vClearcoatNormalMapUv; 2097#endif 2098#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2099 uniform mat3 clearcoatRoughnessMapTransform; 2100 varying vec2 vClearcoatRoughnessMapUv; 2101#endif 2102#ifdef USE_SHEEN_COLORMAP 2103 uniform mat3 sheenColorMapTransform; 2104 varying vec2 vSheenColorMapUv; 2105#endif 2106#ifdef USE_SHEEN_ROUGHNESSMAP 2107 uniform mat3 sheenRoughnessMapTransform; 2108 varying vec2 vSheenRoughnessMapUv; 2109#endif 2110#ifdef USE_IRIDESCENCEMAP 2111 uniform mat3 iridescenceMapTransform; 2112 varying vec2 vIridescenceMapUv; 2113#endif 2114#ifdef USE_IRIDESCENCE_THICKNESSMAP 2115 uniform mat3 iridescenceThicknessMapTransform; 2116 varying vec2 vIridescenceThicknessMapUv; 2117#endif 2118#ifdef USE_SPECULARMAP 2119 uniform mat3 specularMapTransform; 2120 varying vec2 vSpecularMapUv; 2121#endif 2122#ifdef USE_SPECULAR_COLORMAP 2123 uniform mat3 specularColorMapTransform; 2124 varying vec2 vSpecularColorMapUv; 2125#endif 2126#ifdef USE_SPECULAR_INTENSITYMAP 2127 uniform mat3 specularIntensityMapTransform; 2128 varying vec2 vSpecularIntensityMapUv; 2129#endif 2130#ifdef USE_TRANSMISSIONMAP 2131 uniform mat3 transmissionMapTransform; 2132 varying vec2 vTransmissionMapUv; 2133#endif 2134#ifdef USE_THICKNESSMAP 2135 uniform mat3 thicknessMapTransform; 2136 varying vec2 vThicknessMapUv; 2137#endif`,Hu=`#ifdef USE_UV 2138 vUv = vec3( uv, 1 ).xy; 2139#endif 2140#ifdef USE_MAP 2141 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2142#endif 2143#ifdef USE_ALPHAMAP 2144 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2145#endif 2146#ifdef USE_LIGHTMAP 2147 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2148#endif 2149#ifdef USE_AOMAP 2150 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2151#endif 2152#ifdef USE_BUMPMAP 2153 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2154#endif 2155#ifdef USE_NORMALMAP 2156 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2157#endif 2158#ifdef USE_DISPLACEMENTMAP 2159 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2160#endif 2161#ifdef USE_EMISSIVEMAP 2162 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2163#endif 2164#ifdef USE_METALNESSMAP 2165 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2166#endif 2167#ifdef USE_ROUGHNESSMAP 2168 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2169#endif 2170#ifdef USE_CLEARCOATMAP 2171 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2172#endif 2173#ifdef USE_CLEARCOAT_NORMALMAP 2174 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2175#endif 2176#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2177 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2178#endif
2179#ifdef USE_IRIDESCENCEMAP 2180 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2181#endif 2182#ifdef USE_IRIDESCENCE_THICKNESSMAP 2183 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2184#endif 2185#ifdef USE_SHEEN_COLORMAP 2186 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2187#endif 2188#ifdef USE_SHEEN_ROUGHNESSMAP 2189 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2190#endif 2191#ifdef USE_SPECULARMAP 2192 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2193#endif 2194#ifdef USE_SPECULAR_COLORMAP 2195 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2196#endif 2197#ifdef USE_SPECULAR_INTENSITYMAP 2198 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2199#endif 2200#ifdef USE_TRANSMISSIONMAP 2201 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2202#endif 2203#ifdef USE_THICKNESSMAP 2204 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2205#endif`,Vu=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2206 vec4 worldPosition = vec4( transformed, 1.0 ); 2207 #ifdef USE_INSTANCING 2208 worldPosition = instanceMatrix * worldPosition; 2209 #endif 2210 worldPosition = modelMatrix * worldPosition; 2211#endif`;const ku=`varying vec2 vUv; 2212uniform mat3 uvTransform; 2213void main() { 2214 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2215 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2216}`,Wu=`uniform sampler2D t2D; 2217uniform float backgroundIntensity; 2218varying vec2 vUv; 2219void main() { 2220 vec4 texColor = texture2D( t2D, vUv ); 2221 texColor.rgb *= backgroundIntensity; 2222 gl_FragColor = texColor; 2223 #include <tonemapping_fragment> 2224 #include <encodings_fragment> 2225}`,Xu=`varying vec3 vWorldDirection; 2226#include <common> 2227void main() { 2228 vWorldDirection = transformDirection( position, modelMatrix ); 2229 #include <begin_vertex> 2230 #include <project_vertex> 2231 gl_Position.z = gl_Position.w; 2232}`,qu=`#ifdef ENVMAP_TYPE_CUBE 2233 uniform samplerCube envMap; 2234#elif defined( ENVMAP_TYPE_CUBE_UV ) 2235 uniform sampler2D envMap; 2236#endif 2237uniform float flipEnvMap; 2238uniform float backgroundBlurriness; 2239uniform float backgroundIntensity; 2240varying vec3 vWorldDirection; 2241#include <cube_uv_reflection_fragment> 2242void main() { 2243 #ifdef ENVMAP_TYPE_CUBE 2244 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2245 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2246 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 2247 #else 2248 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2249 #endif 2250 texColor.rgb *= backgroundIntensity; 2251 gl_FragColor = texColor; 2252 #include <tonemapping_fragment> 2253 #include <encodings_fragment> 2254}`,ju=`varying vec3 vWorldDirection; 2255#include <common> 2256void main() { 2257 vWorldDirection = transformDirection( position, modelMatrix ); 2258 #include <begin_vertex> 2259 #include <project_vertex> 2260 gl_Position.z = gl_Position.w; 2261}`,Yu=`uniform samplerCube tCube; 2262uniform float tFlip; 2263uniform float opacity; 2264varying vec3 vWorldDirection; 2265void main() { 2266 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2267 gl_FragColor = texColor; 2268 gl_FragColor.a *= opacity; 2269 #include <tonemapping_fragment> 2270 #include <encodings_fragment> 2271}`,Ku=`#include <common> 2272#include <uv_pars_vertex> 2273#include <displacementmap_pars_vertex> 2274#include <morphtarget_pars_vertex> 2275#include <skinning_pars_vertex> 2276#include <logdepthbuf_pars_vertex> 2277#include <clipping_planes_pars_vertex> 2278varying vec2 vHighPrecisionZW; 2279void main() { 2280 #include <uv_vertex> 2281 #include <skinbase_vertex> 2282 #ifdef USE_DISPLACEMENTMAP 2283 #include <beginnormal_vertex> 2284 #include <morphnormal_vertex> 2285 #include <skinnormal_vertex> 2286 #endif 2287 #include <begin_vertex> 2288 #include <morphtarget_vertex> 2289 #include <skinning_vertex> 2290 #include <displacementmap_vertex> 2291 #include <project_vertex> 2292 #include <logdepthbuf_vertex> 2293 #include <clipping_planes_vertex> 2294 vHighPrecisionZW = gl_Position.zw; 2295}`,Zu=`#if DEPTH_PACKING == 3200 2296 uniform float opacity; 2297#endif 2298#include <common> 2299#include <packing> 2300#include <uv_pars_fragment> 2301#include <map_pars_fragment> 2302#include <alphamap_pars_fragment> 2303#include <alphatest_pars_fragment> 2304#include <logdepthbuf_pars_fragment> 2305#include <clipping_planes_pars_fragment> 2306varying vec2 vHighPrecisionZW; 2307void main() { 2308 #include <clipping_planes_fragment> 2309 vec4 diffuseColor = vec4( 1.0 ); 2310 #if DEPTH_PACKING == 3200 2311 diffuseColor.a = opacity; 2312 #endif 2313 #include <map_fragment> 2314 #include <alphamap_fragment> 2315 #include <alphatest_fragment> 2316 #include <logdepthbuf_fragment> 2317 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2318 #if DEPTH_PACKING == 3200 2319 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2320 #elif DEPTH_PACKING == 3201 2321 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2322 #endif 2323}`,$u=`#define DISTANCE 2324varying vec3 vWorldPosition; 2325#include <common> 2326#include <uv_pars_vertex> 2327#include <displacementmap_pars_vertex> 2328#include <morphtarget_pars_vertex> 2329#include <skinning_pars_vertex> 2330#include <clipping_planes_pars_vertex> 2331void main() { 2332 #include <uv_vertex> 2333 #include <skinbase_vertex> 2334 #ifdef USE_DISPLACEMENTMAP 2335 #include <beginnormal_vertex> 2336 #include <morphnormal_vertex> 2337 #include <skinnormal_vertex> 2338 #endif 2339 #include <begin_vertex> 2340 #include <morphtarget_vertex> 2341 #include <skinning_vertex> 2342 #include <displacementmap_vertex> 2343 #include <project_vertex> 2344 #include <worldpos_vertex> 2345 #include <clipping_planes_vertex> 2346 vWorldPosition = worldPosition.xyz; 2347}`,Ju=`#define DISTANCE 2348uniform vec3 referencePosition; 2349uniform float nearDistance; 2350uniform float farDistance; 2351varying vec3 vWorldPosition; 2352#include <common> 2353#include <packing> 2354#include <uv_pars_fragment> 2355#include <map_pars_fragment> 2356#include <alphamap_pars_fragment> 2357#include <alphatest_pars_fragment> 2358#include <clipping_planes_pars_fragment> 2359void main () { 2360 #include <clipping_planes_fragment> 2361 vec4 diffuseColor = vec4( 1.0 ); 2362 #include <map_fragment> 2363 #include <alphamap_fragment> 2364 #include <alphatest_fragment> 2365 float dist = length( vWorldPosition - referencePosition ); 2366 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2367 dist = saturate( dist ); 2368 gl_FragColor = packDepthToRGBA( dist ); 2369}`,Qu=`varying vec3 vWorldDirection; 2370#include <common> 2371void main() { 2372 vWorldDirection = transformDirection( position, modelMatrix ); 2373 #include <begin_vertex> 2374 #include <project_vertex> 2375}`,eh=`uniform sampler2D tEquirect; 2376varying vec3 vWorldDirection; 2377#include <common> 2378void main() { 2379 vec3 direction = normalize( vWorldDirection ); 2380 vec2 sampleUV = equirectUv( direction ); 2381 gl_FragColor = texture2D( tEquirect, sampleUV ); 2382 #include <tonemapping_fragment> 2383 #include <encodings_fragment> 2384}`,th=`uniform float scale; 2385attribute float lineDistance; 2386varying float vLineDistance; 2387#include <common> 2388#include <uv_pars_vertex> 2389#include <color_pars_vertex> 2390#include <fog_pars_vertex> 2391#include <morphtarget_pars_vertex> 2392#include <logdepthbuf_pars_vertex> 2393#include <clipping_planes_pars_vertex> 2394void main() { 2395 vLineDistance = scale * lineDistance; 2396 #include <uv_vertex> 2397 #include <color_vertex> 2398 #include <morphcolor_vertex> 2399 #include <begin_vertex> 2400 #include <morphtarget_vertex> 2401 #include <project_vertex> 2402 #include <logdepthbuf_vertex> 2403 #include <clipping_planes_vertex> 2404 #include <fog_vertex> 2405}`,nh=`uniform vec3 diffuse; 2406uniform float opacity; 2407uniform float dashSize; 2408uniform float totalSize; 2409varying float vLineDistance; 2410#include <common> 2411#include <color_pars_fragment> 2412#include <uv_pars_fragment> 2413#include <map_pars_fragment> 2414#include <fog_pars_fragment> 2415#include <logdepthbuf_pars_fragment> 2416#include <clipping_planes_pars_fragment> 2417void main() { 2418 #include <clipping_planes_fragment> 2419 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2420 discard; 2421 } 2422 vec3 outgoingLight = vec3( 0.0 ); 2423 vec4 diffuseColor = vec4( diffuse, opacity ); 2424 #include <logdepthbuf_fragment> 2425 #include <map_fragment> 2426 #include <color_fragment> 2427 outgoingLight = diffuseColor.rgb; 2428 #include <output_fragment> 2429 #include <tonemapping_fragment> 2430 #include <encodings_fragment> 2431 #include <fog_fragment> 2432 #include <premultiplied_alpha_fragment> 2433}`,ih=`#include <common> 2434#include <uv_pars_vertex> 2435#include <envmap_pars_vertex> 2436#include <color_pars_vertex> 2437#include <fog_pars_vertex> 2438#include <morphtarget_pars_vertex> 2439#include <skinning_pars_vertex> 2440#include <logdepthbuf_pars_vertex> 2441#include <clipping_planes_pars_vertex> 2442void main() { 2443 #include <uv_vertex> 2444 #include <color_vertex> 2445 #include <morphcolor_vertex> 2446 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2447 #include <beginnormal_vertex> 2448 #include <morphnormal_vertex> 2449 #include <skinbase_vertex> 2450 #include <skinnormal_vertex> 2451 #include <defaultnormal_vertex> 2452 #endif 2453 #include <begin_vertex> 2454 #include <morphtarget_vertex> 2455 #include <skinning_vertex> 2456 #include <project_vertex> 2457 #include <logdepthbuf_vertex> 2458 #include <clipping_planes_vertex> 2459 #include <worldpos_vertex> 2460 #include <envmap_vertex> 2461 #include <fog_vertex> 2462}`,rh=`uniform vec3 diffuse; 2463uniform float opacity; 2464#ifndef FLAT_SHADED 2465 varying vec3 vNormal; 2466#endif 2467#include <common> 2468#include <dithering_pars_fragment> 2469#include <color_pars_fragment> 2470#include <uv_pars_fragment> 2471#include <map_pars_fragment> 2472#include <alphamap_pars_fragment> 2473#include <alphatest_pars_fragment> 2474#include <aomap_pars_fragment> 2475#include <lightmap_pars_fragment> 2476#include <envmap_common_pars_fragment> 2477#include <envmap_pars_fragment> 2478#include <fog_pars_fragment> 2479#include <specularmap_pars_fragment> 2480#include <logdepthbuf_pars_fragment> 2481#include <clipping_planes_pars_fragment> 2482void main() { 2483 #include <clipping_planes_fragment> 2484 vec4 diffuseColor = vec4( diffuse, opacity ); 2485 #include <logdepthbuf_fragment> 2486 #include <map_fragment> 2487 #include <color_fragment> 2488 #include <alphamap_fragment> 2489 #include <alphatest_fragment> 2490 #include <specularmap_fragment> 2491 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2492 #ifdef USE_LIGHTMAP 2493 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2494 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2495 #else 2496 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2497 #endif 2498 #include <aomap_fragment> 2499 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2500 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2501 #include <envmap_fragment> 2502 #include <output_fragment> 2503 #include <tonemapping_fragment> 2504 #include <encodings_fragment> 2505 #include <fog_fragment> 2506 #include <premultiplied_alpha_fragment> 2507 #include <dithering_fragment> 2508}`,sh=`#define LAMBERT 2509varying vec3 vViewPosition; 2510#include <common> 2511#include <uv_pars_vertex> 2512#include <displacementmap_pars_vertex> 2513#include <envmap_pars_vertex> 2514#include <color_pars_vertex> 2515#include <fog_pars_vertex> 2516#include <normal_pars_vertex> 2517#include <morphtarget_pars_vertex> 2518#include <skinning_pars_vertex> 2519#include <shadowmap_pars_vertex> 2520#include <logdepthbuf_pars_vertex> 2521#include <clipping_planes_pars_vertex> 2522void main() { 2523 #include <uv_vertex> 2524 #include <color_vertex> 2525 #include <morphcolor_vertex> 2526 #include <beginnormal_vertex> 2527 #include <morphnormal_vertex> 2528 #include <skinbase_vertex> 2529 #include <skinnormal_vertex> 2530 #include <defaultnormal_vertex> 2531 #include <normal_vertex> 2532 #include <begin_vertex> 2533 #include <morphtarget_vertex> 2534 #include <skinning_vertex> 2535 #include <displacementmap_vertex> 2536 #include <project_vertex> 2537 #include <logdepthbuf_vertex> 2538 #include <clipping_planes_vertex> 2539 vViewPosition = - mvPosition.xyz; 2540 #include <worldpos_vertex> 2541 #include <envmap_vertex> 2542 #include <shadowmap_vertex> 2543 #include <fog_vertex> 2544}`,ah=`#define LAMBERT 2545uniform vec3 diffuse; 2546uniform vec3 emissive; 2547uniform float opacity; 2548#include <common> 2549#include <packing> 2550#include <dithering_pars_fragment> 2551#include <color_pars_fragment> 2552#include <uv_pars_fragment> 2553#include <map_pars_fragment> 2554#include <alphamap_pars_fragment> 2555#include <alphatest_pars_fragment> 2556#include <aomap_pars_fragment> 2557#include <lightmap_pars_fragment> 2558#include <emissivemap_pars_fragment> 2559#include <envmap_common_pars_fragment> 2560#include <envmap_pars_fragment> 2561#include <fog_pars_fragment> 2562#include <bsdfs> 2563#include <lights_pars_begin> 2564#include <normal_pars_fragment> 2565#include <lights_lambert_pars_fragment> 2566#include <shadowmap_pars_fragment> 2567#include <bumpmap_pars_fragment> 2568#include <normalmap_pars_fragment> 2569#include <specularmap_pars_fragment> 2570#include <logdepthbuf_pars_fragment> 2571#include <clipping_planes_pars_fragment> 2572void main() { 2573 #include <clipping_planes_fragment> 2574 vec4 diffuseColor = vec4( diffuse, opacity ); 2575 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2576 vec3 totalEmissiveRadiance = emissive; 2577 #include <logdepthbuf_fragment> 2578 #include <map_fragment> 2579 #include <color_fragment> 2580 #include <alphamap_fragment> 2581 #include <alphatest_fragment> 2582 #include <specularmap_fragment> 2583 #include <normal_fragment_begin> 2584 #include <normal_fragment_maps> 2585 #include <emissivemap_fragment> 2586 #include <lights_lambert_fragment> 2587 #include <lights_fragment_begin> 2588 #include <lights_fragment_maps> 2589 #include <lights_fragment_end> 2590 #include <aomap_fragment> 2591 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2592 #include <envmap_fragment> 2593 #include <output_fragment> 2594 #include <tonemapping_fragment> 2595 #include <encodings_fragment> 2596 #include <fog_fragment> 2597 #include <premultiplied_alpha_fragment> 2598 #include <dithering_fragment> 2599}`,oh=`#define MATCAP 2600varying vec3 vViewPosition; 2601#include <common> 2602#include <uv_pars_vertex> 2603#include <color_pars_vertex> 2604#include <displacementmap_pars_vertex> 2605#include <fog_pars_vertex> 2606#include <normal_pars_vertex> 2607#include <morphtarget_pars_vertex> 2608#include <skinning_pars_vertex> 2609#include <logdepthbuf_pars_vertex> 2610#include <clipping_planes_pars_vertex> 2611void main() { 2612 #include <uv_vertex> 2613 #include <color_vertex> 2614 #include <morphcolor_vertex> 2615 #include <beginnormal_vertex> 2616 #include <morphnormal_vertex> 2617 #include <skinbase_vertex> 2618 #include <skinnormal_vertex> 2619 #include <defaultnormal_vertex> 2620 #include <normal_vertex> 2621 #include <begin_vertex> 2622 #include <morphtarget_vertex> 2623 #include <skinning_vertex> 2624 #include <displacementmap_vertex> 2625 #include <project_vertex> 2626 #include <logdepthbuf_vertex> 2627 #include <clipping_planes_vertex> 2628 #include <fog_vertex> 2629 vViewPosition = - mvPosition.xyz; 2630}`,lh=`#define MATCAP 2631uniform vec3 diffuse; 2632uniform float opacity; 2633uniform sampler2D matcap; 2634varying vec3 vViewPosition; 2635#include <common> 2636#include <dithering_pars_fragment> 2637#include <color_pars_fragment> 2638#include <uv_pars_fragment> 2639#include <map_pars_fragment> 2640#include <alphamap_pars_fragment> 2641#include <alphatest_pars_fragment> 2642#include <fog_pars_fragment> 2643#include <normal_pars_fragment> 2644#include <bumpmap_pars_fragment> 2645#include <normalmap_pars_fragment> 2646#include <logdepthbuf_pars_fragment> 2647#include <clipping_planes_pars_fragment> 2648void main() { 2649 #include <clipping_planes_fragment> 2650 vec4 diffuseColor = vec4( diffuse, opacity ); 2651 #include <logdepthbuf_fragment> 2652 #include <map_fragment> 2653 #include <color_fragment> 2654 #include <alphamap_fragment> 2655 #include <alphatest_fragment> 2656 #include <normal_fragment_begin> 2657 #include <normal_fragment_maps> 2658 vec3 viewDir = normalize( vViewPosition ); 2659 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2660 vec3 y = cross( viewDir, x ); 2661 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2662 #ifdef USE_MATCAP
2663 vec4 matcapColor = texture2D( matcap, uv ); 2664 #else 2665 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2666 #endif 2667 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2668 #include <output_fragment> 2669 #include <tonemapping_fragment> 2670 #include <encodings_fragment> 2671 #include <fog_fragment> 2672 #include <premultiplied_alpha_fragment> 2673 #include <dithering_fragment> 2674}`,ch=`#define NORMAL 2675#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2676 varying vec3 vViewPosition; 2677#endif 2678#include <common> 2679#include <uv_pars_vertex> 2680#include <displacementmap_pars_vertex> 2681#include <normal_pars_vertex> 2682#include <morphtarget_pars_vertex> 2683#include <skinning_pars_vertex> 2684#include <logdepthbuf_pars_vertex> 2685#include <clipping_planes_pars_vertex> 2686void main() { 2687 #include <uv_vertex> 2688 #include <beginnormal_vertex> 2689 #include <morphnormal_vertex> 2690 #include <skinbase_vertex> 2691 #include <skinnormal_vertex> 2692 #include <defaultnormal_vertex> 2693 #include <normal_vertex> 2694 #include <begin_vertex> 2695 #include <morphtarget_vertex> 2696 #include <skinning_vertex> 2697 #include <displacementmap_vertex> 2698 #include <project_vertex> 2699 #include <logdepthbuf_vertex> 2700 #include <clipping_planes_vertex> 2701#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2702 vViewPosition = - mvPosition.xyz; 2703#endif 2704}`,uh=`#define NORMAL 2705uniform float opacity; 2706#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2707 varying vec3 vViewPosition; 2708#endif 2709#include <packing> 2710#include <uv_pars_fragment> 2711#include <normal_pars_fragment> 2712#include <bumpmap_pars_fragment> 2713#include <normalmap_pars_fragment> 2714#include <logdepthbuf_pars_fragment> 2715#include <clipping_planes_pars_fragment> 2716void main() { 2717 #include <clipping_planes_fragment> 2718 #include <logdepthbuf_fragment> 2719 #include <normal_fragment_begin> 2720 #include <normal_fragment_maps> 2721 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2722 #ifdef OPAQUE 2723 gl_FragColor.a = 1.0; 2724 #endif 2725}`,hh=`#define PHONG 2726varying vec3 vViewPosition; 2727#include <common> 2728#include <uv_pars_vertex> 2729#include <displacementmap_pars_vertex> 2730#include <envmap_pars_vertex> 2731#include <color_pars_vertex> 2732#include <fog_pars_vertex> 2733#include <normal_pars_vertex> 2734#include <morphtarget_pars_vertex> 2735#include <skinning_pars_vertex> 2736#include <shadowmap_pars_vertex> 2737#include <logdepthbuf_pars_vertex> 2738#include <clipping_planes_pars_vertex> 2739void main() { 2740 #include <uv_vertex> 2741 #include <color_vertex> 2742 #include <morphcolor_vertex> 2743 #include <beginnormal_vertex> 2744 #include <morphnormal_vertex> 2745 #include <skinbase_vertex> 2746 #include <skinnormal_vertex> 2747 #include <defaultnormal_vertex> 2748 #include <normal_vertex> 2749 #include <begin_vertex> 2750 #include <morphtarget_vertex> 2751 #include <skinning_vertex> 2752 #include <displacementmap_vertex> 2753 #include <project_vertex> 2754 #include <logdepthbuf_vertex> 2755 #include <clipping_planes_vertex> 2756 vViewPosition = - mvPosition.xyz; 2757 #include <worldpos_vertex> 2758 #include <envmap_vertex> 2759 #include <shadowmap_vertex> 2760 #include <fog_vertex> 2761}`,dh=`#define PHONG 2762uniform vec3 diffuse; 2763uniform vec3 emissive; 2764uniform vec3 specular; 2765uniform float shininess; 2766uniform float opacity; 2767#include <common> 2768#include <packing> 2769#include <dithering_pars_fragment> 2770#include <color_pars_fragment> 2771#include <uv_pars_fragment> 2772#include <map_pars_fragment> 2773#include <alphamap_pars_fragment> 2774#include <alphatest_pars_fragment> 2775#include <aomap_pars_fragment> 2776#include <lightmap_pars_fragment> 2777#include <emissivemap_pars_fragment> 2778#include <envmap_common_pars_fragment> 2779#include <envmap_pars_fragment> 2780#include <fog_pars_fragment> 2781#include <bsdfs> 2782#include <lights_pars_begin> 2783#include <normal_pars_fragment> 2784#include <lights_phong_pars_fragment> 2785#include <shadowmap_pars_fragment> 2786#include <bumpmap_pars_fragment> 2787#include <normalmap_pars_fragment> 2788#include <specularmap_pars_fragment> 2789#include <logdepthbuf_pars_fragment> 2790#include <clipping_planes_pars_fragment> 2791void main() { 2792 #include <clipping_planes_fragment> 2793 vec4 diffuseColor = vec4( diffuse, opacity ); 2794 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2795 vec3 totalEmissiveRadiance = emissive; 2796 #include <logdepthbuf_fragment> 2797 #include <map_fragment> 2798 #include <color_fragment> 2799 #include <alphamap_fragment> 2800 #include <alphatest_fragment> 2801 #include <specularmap_fragment> 2802 #include <normal_fragment_begin> 2803 #include <normal_fragment_maps> 2804 #include <emissivemap_fragment> 2805 #include <lights_phong_fragment> 2806 #include <lights_fragment_begin> 2807 #include <lights_fragment_maps> 2808 #include <lights_fragment_end> 2809 #include <aomap_fragment> 2810 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2811 #include <envmap_fragment> 2812 #include <output_fragment> 2813 #include <tonemapping_fragment> 2814 #include <encodings_fragment> 2815 #include <fog_fragment> 2816 #include <premultiplied_alpha_fragment> 2817 #include <dithering_fragment> 2818}`,fh=`#define STANDARD 2819varying vec3 vViewPosition; 2820#ifdef USE_TRANSMISSION 2821 varying vec3 vWorldPosition; 2822#endif 2823#include <common> 2824#include <uv_pars_vertex> 2825#include <displacementmap_pars_vertex> 2826#include <color_pars_vertex> 2827#include <fog_pars_vertex> 2828#include <normal_pars_vertex> 2829#include <morphtarget_pars_vertex> 2830#include <skinning_pars_vertex> 2831#include <shadowmap_pars_vertex> 2832#include <logdepthbuf_pars_vertex> 2833#include <clipping_planes_pars_vertex> 2834void main() { 2835 #include <uv_vertex> 2836 #include <color_vertex> 2837 #include <morphcolor_vertex> 2838 #include <beginnormal_vertex> 2839 #include <morphnormal_vertex> 2840 #include <skinbase_vertex> 2841 #include <skinnormal_vertex> 2842 #include <defaultnormal_vertex> 2843 #include <normal_vertex> 2844 #include <begin_vertex> 2845 #include <morphtarget_vertex> 2846 #include <skinning_vertex> 2847 #include <displacementmap_vertex> 2848 #include <project_vertex> 2849 #include <logdepthbuf_vertex> 2850 #include <clipping_planes_vertex> 2851 vViewPosition = - mvPosition.xyz; 2852 #include <worldpos_vertex> 2853 #include <shadowmap_vertex> 2854 #include <fog_vertex> 2855#ifdef USE_TRANSMISSION 2856 vWorldPosition = worldPosition.xyz; 2857#endif 2858}`,ph=`#define STANDARD 2859#ifdef PHYSICAL 2860 #define IOR 2861 #define USE_SPECULAR 2862#endif 2863uniform vec3 diffuse; 2864uniform vec3 emissive; 2865uniform float roughness; 2866uniform float metalness; 2867uniform float opacity; 2868#ifdef IOR 2869 uniform float ior; 2870#endif 2871#ifdef USE_SPECULAR 2872 uniform float specularIntensity; 2873 uniform vec3 specularColor; 2874 #ifdef USE_SPECULAR_COLORMAP 2875 uniform sampler2D specularColorMap; 2876 #endif 2877 #ifdef USE_SPECULAR_INTENSITYMAP 2878 uniform sampler2D specularIntensityMap; 2879 #endif 2880#endif 2881#ifdef USE_CLEARCOAT 2882 uniform float clearcoat; 2883 uniform float clearcoatRoughness; 2884#endif
2885#ifdef USE_IRIDESCENCE 2886 uniform float iridescence; 2887 uniform float iridescenceIOR; 2888 uniform float iridescenceThicknessMinimum; 2889 uniform float iridescenceThicknessMaximum; 2890#endif 2891#ifdef USE_SHEEN 2892 uniform vec3 sheenColor; 2893 uniform float sheenRoughness; 2894 #ifdef USE_SHEEN_COLORMAP 2895 uniform sampler2D sheenColorMap; 2896 #endif 2897 #ifdef USE_SHEEN_ROUGHNESSMAP 2898 uniform sampler2D sheenRoughnessMap; 2899 #endif 2900#endif 2901varying vec3 vViewPosition; 2902#include <common> 2903#include <packing> 2904#include <dithering_pars_fragment> 2905#include <color_pars_fragment> 2906#include <uv_pars_fragment> 2907#include <map_pars_fragment> 2908#include <alphamap_pars_fragment> 2909#include <alphatest_pars_fragment> 2910#include <aomap_pars_fragment> 2911#include <lightmap_pars_fragment> 2912#include <emissivemap_pars_fragment> 2913#include <iridescence_fragment> 2914#include <cube_uv_reflection_fragment> 2915#include <envmap_common_pars_fragment> 2916#include <envmap_physical_pars_fragment> 2917#include <fog_pars_fragment> 2918#include <lights_pars_begin> 2919#include <normal_pars_fragment> 2920#include <lights_physical_pars_fragment> 2921#include <transmission_pars_fragment> 2922#include <shadowmap_pars_fragment> 2923#include <bumpmap_pars_fragment> 2924#include <normalmap_pars_fragment> 2925#include <clearcoat_pars_fragment> 2926#include <iridescence_pars_fragment> 2927#include <roughnessmap_pars_fragment> 2928#include <metalnessmap_pars_fragment> 2929#include <logdepthbuf_pars_fragment> 2930#include <clipping_planes_pars_fragment> 2931void main() { 2932 #include <clipping_planes_fragment> 2933 vec4 diffuseColor = vec4( diffuse, opacity ); 2934 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2935 vec3 totalEmissiveRadiance = emissive; 2936 #include <logdepthbuf_fragment> 2937 #include <map_fragment> 2938 #include <color_fragment> 2939 #include <alphamap_fragment> 2940 #include <alphatest_fragment> 2941 #include <roughnessmap_fragment> 2942 #include <metalnessmap_fragment> 2943 #include <normal_fragment_begin> 2944 #include <normal_fragment_maps> 2945 #include <clearcoat_normal_fragment_begin> 2946 #include <clearcoat_normal_fragment_maps> 2947 #include <emissivemap_fragment> 2948 #include <lights_physical_fragment> 2949 #include <lights_fragment_begin> 2950 #include <lights_fragment_maps> 2951 #include <lights_fragment_end> 2952 #include <aomap_fragment> 2953 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2954 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2955 #include <transmission_fragment> 2956 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2957 #ifdef USE_SHEEN 2958 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2959 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2960 #endif 2961 #ifdef USE_CLEARCOAT 2962 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2963 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2964 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2965 #endif 2966 #include <output_fragment> 2967 #include <tonemapping_fragment> 2968 #include <encodings_fragment> 2969 #include <fog_fragment> 2970 #include <premultiplied_alpha_fragment> 2971 #include <dithering_fragment> 2972}`,mh=`#define TOON 2973varying vec3 vViewPosition; 2974#include <common> 2975#include <uv_pars_vertex> 2976#include <displacementmap_pars_vertex> 2977#include <color_pars_vertex> 2978#include <fog_pars_vertex> 2979#include <normal_pars_vertex> 2980#include <morphtarget_pars_vertex> 2981#include <skinning_pars_vertex> 2982#include <shadowmap_pars_vertex> 2983#include <logdepthbuf_pars_vertex> 2984#include <clipping_planes_pars_vertex> 2985void main() { 2986 #include <uv_vertex> 2987 #include <color_vertex> 2988 #include <morphcolor_vertex> 2989 #include <beginnormal_vertex> 2990 #include <morphnormal_vertex> 2991 #include <skinbase_vertex> 2992 #include <skinnormal_vertex> 2993 #include <defaultnormal_vertex> 2994 #include <normal_vertex> 2995 #include <begin_vertex> 2996 #include <morphtarget_vertex> 2997 #include <skinning_vertex> 2998 #include <displacementmap_vertex> 2999 #include <project_vertex> 3000 #include <logdepthbuf_vertex> 3001 #include <clipping_planes_vertex> 3002 vViewPosition = - mvPosition.xyz; 3003 #include <worldpos_vertex> 3004 #include <shadowmap_vertex> 3005 #include <fog_vertex> 3006}`,_h=`#define TOON 3007uniform vec3 diffuse; 3008uniform vec3 emissive; 3009uniform float opacity; 3010#include <common> 3011#include <packing> 3012#include <dithering_pars_fragment> 3013#include <color_pars_fragment> 3014#include <uv_pars_fragment> 3015#include <map_pars_fragment> 3016#include <alphamap_pars_fragment> 3017#include <alphatest_pars_fragment> 3018#include <aomap_pars_fragment> 3019#include <lightmap_pars_fragment> 3020#include <emissivemap_pars_fragment> 3021#include <gradientmap_pars_fragment> 3022#include <fog_pars_fragment> 3023#include <bsdfs> 3024#include <lights_pars_begin> 3025#include <normal_pars_fragment> 3026#include <lights_toon_pars_fragment> 3027#include <shadowmap_pars_fragment> 3028#include <bumpmap_pars_fragment> 3029#include <normalmap_pars_fragment> 3030#include <logdepthbuf_pars_fragment> 3031#include <clipping_planes_pars_fragment> 3032void main() { 3033 #include <clipping_planes_fragment> 3034 vec4 diffuseColor = vec4( diffuse, opacity ); 3035 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3036 vec3 totalEmissiveRadiance = emissive; 3037 #include <logdepthbuf_fragment> 3038 #include <map_fragment> 3039 #include <color_fragment> 3040 #include <alphamap_fragment> 3041 #include <alphatest_fragment> 3042 #include <normal_fragment_begin> 3043 #include <normal_fragment_maps> 3044 #include <emissivemap_fragment> 3045 #include <lights_toon_fragment> 3046 #include <lights_fragment_begin> 3047 #include <lights_fragment_maps> 3048 #include <lights_fragment_end> 3049 #include <aomap_fragment> 3050 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3051 #include <output_fragment> 3052 #include <tonemapping_fragment> 3053 #include <encodings_fragment> 3054 #include <fog_fragment> 3055 #include <premultiplied_alpha_fragment> 3056 #include <dithering_fragment> 3057}`,gh=`uniform float size; 3058uniform float scale; 3059#include <common> 3060#include <color_pars_vertex> 3061#include <fog_pars_vertex> 3062#include <morphtarget_pars_vertex> 3063#include <logdepthbuf_pars_vertex> 3064#include <clipping_planes_pars_vertex> 3065#ifdef USE_POINTS_UV 3066 varying vec2 vUv; 3067 uniform mat3 uvTransform; 3068#endif 3069void main() { 3070 #ifdef USE_POINTS_UV 3071 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3072 #endif 3073 #include <color_vertex> 3074 #include <morphcolor_vertex> 3075 #include <begin_vertex> 3076 #include <morphtarget_vertex> 3077 #include <project_vertex> 3078 gl_PointSize = size; 3079 #ifdef USE_SIZEATTENUATION 3080 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3081 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3082 #endif 3083 #include <logdepthbuf_vertex> 3084 #include <clipping_planes_vertex> 3085 #include <worldpos_vertex> 3086 #include <fog_vertex> 3087}`,vh=`uniform vec3 diffuse; 3088uniform float opacity; 3089#include <common> 3090#include <color_pars_fragment> 3091#include <map_particle_pars_fragment> 3092#include <alphatest_pars_fragment> 3093#include <fog_pars_fragment> 3094#include <logdepthbuf_pars_fragment> 3095#include <clipping_planes_pars_fragment> 3096void main() { 3097 #include <clipping_planes_fragment> 3098 vec3 outgoingLight = vec3( 0.0 ); 3099 vec4 diffuseColor = vec4( diffuse, opacity ); 3100 #include <logdepthbuf_fragment> 3101 #include <map_particle_fragment> 3102 #include <color_fragment> 3103 #include <alphatest_fragment> 3104 outgoingLight = diffuseColor.rgb; 3105 #include <output_fragment> 3106 #include <tonemapping_fragment> 3107 #include <encodings_fragment> 3108 #include <fog_fragment> 3109 #include <premultiplied_alpha_fragment> 3110}`,xh=`#include <common> 3111#include <fog_pars_vertex> 3112#include <morphtarget_pars_vertex> 3113#include <skinning_pars_vertex> 3114#include <logdepthbuf_pars_vertex> 3115#include <shadowmap_pars_vertex> 3116void main() { 3117 #include <beginnormal_vertex> 3118 #include <morphnormal_vertex> 3119 #include <skinbase_vertex> 3120 #include <skinnormal_vertex> 3121 #include <defaultnormal_vertex> 3122 #include <begin_vertex> 3123 #include <morphtarget_vertex> 3124 #include <skinning_vertex> 3125 #include <project_vertex> 3126 #include <logdepthbuf_vertex> 3127 #include <worldpos_vertex> 3128 #include <shadowmap_vertex> 3129 #include <fog_vertex> 3130}
3130`,Mh=`uniform vec3 color; 3131uniform float opacity; 3132#include <common> 3133#include <packing> 3134#include <fog_pars_fragment> 3135#include <bsdfs> 3136#include <lights_pars_begin> 3137#include <logdepthbuf_pars_fragment> 3138#include <shadowmap_pars_fragment> 3139#include <shadowmask_pars_fragment> 3140void main() { 3141 #include <logdepthbuf_fragment> 3142 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3143 #include <tonemapping_fragment> 3144 #include <encodings_fragment> 3145 #include <fog_fragment> 3146}`,Sh=`uniform float rotation; 3147uniform vec2 center; 3148#include <common> 3149#include <uv_pars_vertex> 3150#include <fog_pars_vertex> 3151#include <logdepthbuf_pars_vertex> 3152#include <clipping_planes_pars_vertex> 3153void main() { 3154 #include <uv_vertex> 3155 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3156 vec2 scale; 3157 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3158 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3159 #ifndef USE_SIZEATTENUATION 3160 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3161 if ( isPerspective ) scale *= - mvPosition.z; 3162 #endif 3163 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3164 vec2 rotatedPosition; 3165 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3166 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3167 mvPosition.xy += rotatedPosition; 3168 gl_Position = projectionMatrix * mvPosition; 3169 #include <logdepthbuf_vertex> 3170 #include <clipping_planes_vertex> 3171 #include <fog_vertex> 3172}`,Eh=`uniform vec3 diffuse; 3173uniform float opacity; 3174#include <common> 3175#include <uv_pars_fragment> 3176#include <map_pars_fragment> 3177#include <alphamap_pars_fragment> 3178#include <alphatest_pars_fragment> 3179#include <fog_pars_fragment> 3180#include <logdepthbuf_pars_fragment> 3181#include <clipping_planes_pars_fragment> 3182void main() { 3183 #include <clipping_planes_fragment> 3184 vec3 outgoingLight = vec3( 0.0 ); 3185 vec4 diffuseColor = vec4( diffuse, opacity ); 3186 #include <logdepthbuf_fragment> 3187 #include <map_fragment> 3188 #include <alphamap_fragment> 3189 #include <alphatest_fragment> 3190 outgoingLight = diffuseColor.rgb; 3191 #include <output_fragment> 3192 #include <tonemapping_fragment> 3193 #include <encodings_fragment> 3194 #include <fog_fragment> 3195}`,Ae={alphamap_fragment:Yl,alphamap_pars_fragment:Kl,alphatest_fragment:Zl,alphatest_pars_fragment:$l,aomap_fragment:Jl,aomap_pars_fragment:Ql,begin_vertex:ec,beginnormal_vertex:tc,bsdfs:nc,iridescence_fragment:ic,bumpmap_pars_fragment:rc,clipping_planes_fragment:sc,clipping_planes_pars_fragment:ac,clipping_planes_pars_vertex:oc,clipping_planes_vertex:lc,color_fragment:cc,color_pars_fragment:uc,color_pars_vertex:hc,color_vertex:dc,common:fc,cube_uv_reflection_fragment:pc,defaultnormal_vertex:mc,displacementmap_pars_vertex:_c,displacementmap_vertex:gc,emissivemap_fragment:vc,emissivemap_pars_fragment:xc,encodings_fragment:Mc,encodings_pars_fragment:Sc,envmap_fragment:Ec,envmap_common_pars_fragment:yc,envmap_pars_fragment:Tc,envmap_pars_vertex:bc,envmap_physical_pars_fragment:Oc,envmap_vertex:Ac,fog_vertex:wc,fog_pars_vertex:Rc,fog_fragment:Cc,fog_pars_fragment:Lc,gradientmap_pars_fragment:Pc,lightmap_fragment:Uc,lightmap_pars_fragment:Dc,lights_lambert_fragment:Ic,lights_lambert_pars_fragment:Nc,lights_pars_begin:Fc,lights_toon_fragment:Bc,lights_toon_pars_fragment:zc,lights_phong_fragment:Gc,lights_phong_pars_fragment:Hc,lights_physical_fragment:Vc,lights_physical_pars_fragment:kc,lights_fragment_begin:Wc,lights_fragment_maps:Xc,lights_fragment_end:qc,logdepthbuf_fragment:jc,logdepthbuf_pars_fragment:Yc,logdepthbuf_pars_vertex:Kc,logdepthbuf_vertex:Zc,map_fragment:$c,map_pars_fragment:Jc,map_particle_fragment:Qc,map_particle_pars_fragment:eu,metalnessmap_fragment:tu,metalnessmap_pars_fragment:nu,morphcolor_vertex:iu,morphnormal_vertex:ru,morphtarget_pars_vertex:su,morphtarget_vertex:au,normal_fragment_begin:ou,normal_fragment_maps:lu,normal_pars_fragment:cu,normal_pars_vertex:uu,normal_vertex:hu,normalmap_pars_fragment:du,clearcoat_normal_fragment_begin:fu,clearcoat_normal_fragment_maps:pu,clearcoat_pars_fragment:mu,iridescence_pars_fragment:_u,output_fragment:gu,packing:vu,premultiplied_alpha_fragment:xu,project_vertex:Mu,dithering_fragment:Su,dithering_pars_fragment:Eu,roughnessmap_fragment:yu,roughnessmap_pars_fragment:Tu,shadowmap_pars_fragment:bu,shadowmap_pars_vertex:Au,shadowmap_vertex:wu,shadowmask_pars_fragment:Ru,skinbase_vertex:Cu,skinning_pars_vertex:Lu,skinning_vertex:Pu,skinnormal_vertex:Uu,specularmap_fragment:Du,specularmap_pars_fragment:Iu,tonemapping_fragment:Nu,tonemapping_pars_fragment:Fu,transmission_fragment:Ou,transmission_pars_fragment:Bu,uv_pars_fragment:zu,uv_pars_vertex:Gu,uv_vertex:Hu,worldpos_vertex:Vu,background_vert:ku,background_frag:Wu,backgroundCube_vert:Xu,backgroundCube_frag:qu,cube_vert:ju,cube_frag:Yu,depth_vert:Ku,depth_frag:Zu,distanceRGBA_vert:$u,distanceRGBA_frag:Ju,equirect_vert:Qu,equirect_frag:eh,linedashed_vert:th,linedashed_frag:nh,meshbasic_vert:ih,meshbasic_frag:rh,meshlambert_vert:sh,meshlambert_frag:ah,meshmatcap_vert:oh,meshmatcap_frag:lh,meshnormal_vert:ch,meshnormal_frag:uh,meshphong_vert:hh,meshphong_frag:dh,meshphysical_vert:fh,meshphysical_frag:ph,meshtoon_vert:mh,meshtoon_frag:_h,points_vert:gh,points_frag:vh,shadow_vert:xh,shadow_frag:Mh,sprite_vert:Sh,sprite_frag:Eh},te={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaMapTransform:{value:new Pe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Pe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Pe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Pe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Pe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Pe},normalScale:{value:new Oe(1,1)}}
vendor: 7,100 bytes, line 3195
3195,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Pe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Pe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Pe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Pe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Pe}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Pe},alphaMap:{value:null},alphaTest:{value:0}}},zt={basic:{uniforms:ct([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.fog]),vertexShader:Ae.meshbasic_vert,fragmentShader:Ae.meshbasic_frag},lambert:{uniforms:ct([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 Ie(0)}}]),vertexShader:Ae.meshlambert_vert,fragmentShader:Ae.meshlambert_frag},phong:{uniforms:ct([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 Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30}}]),vertexShader:Ae.meshphong_vert,fragmentShader:Ae.meshphong_frag},standard:{uniforms:ct([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 Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ae.meshphysical_vert,fragmentShader:Ae.meshphysical_frag},toon:{uniforms:ct([te.common,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.gradientmap,te.fog,te.lights,{emissive:{value:new Ie(0)}}]),vertexShader:Ae.meshtoon_vert,fragmentShader:Ae.meshtoon_frag},matcap:{uniforms:ct([te.common,te.bumpmap,te.normalmap,te.displacementmap,te.fog,{matcap:{value:null}}]),vertexShader:Ae.meshmatcap_vert,fragmentShader:Ae.meshmatcap_frag},points:{uniforms:ct([te.points,te.fog]),vertexShader:Ae.points_vert,fragmentShader:Ae.points_frag},dashed:{uniforms:ct([te.common,te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ae.linedashed_vert,fragmentShader:Ae.linedashed_frag},depth:{uniforms:ct([te.common,te.displacementmap]),vertexShader:Ae.depth_vert,fragmentShader:Ae.depth_frag},normal:{uniforms:ct([te.common,te.bumpmap,te.normalmap,te.displacementmap,{opacity:{value:1}}]),vertexShader:Ae.meshnormal_vert,fragmentShader:Ae.meshnormal_frag},sprite:{uniforms:ct([te.sprite,te.fog]),vertexShader:Ae.sprite_vert,fragmentShader:Ae.sprite_frag},background:{uniforms:{uvTransform:{value:new Pe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ae.background_vert,fragmentShader:Ae.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ae.backgroundCube_vert,fragmentShader:Ae.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ae.cube_vert,fragmentShader:Ae.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ae.equirect_vert,fragmentShader:Ae.equirect_frag},distanceRGBA:{uniforms:ct([te.common,te.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ae.distanceRGBA_vert,fragmentShader:Ae.distanceRGBA_frag},shadow:{uniforms:ct([te.lights,te.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:Ae.shadow_vert,fragmentShader:Ae.shadow_frag}};zt.physical={uniforms:ct([zt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Pe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Pe},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Pe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Pe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Pe},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Pe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Pe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Pe},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Pe},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Pe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Pe}}]),vertexShader:Ae.meshphysical_vert,fragmentShader:Ae.meshphysical_frag};const Ni={r:0,b:0,g:0};function yh(i,e,t,n,r,s,o){const a=new Ie(0);let u=s===!0?0:1,l,c,d=null,f=0,p=null;function _(m,h){let y=!1,M=h.isScene===!0?h.background:null;switch(M&&M.isTexture&&(M=(h.backgroundBlurriness>0?t:e).get(M)),M===null?g(a,u):M&&M.isColor&&(g(M,1),y=!0),i.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":n.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":n.buffers.color.setClear(0,0,0,0,o),y=!0;break}(i.autoClear||y)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),M&&(M.isCubeTexture||M.mapping===Ki)?(c===void 0&&(c=new At(new pi(1,1,1),new Tn({name:"Backgroun
3195dCubeMaterial",uniforms:Zn(zt.backgroundCube.uniforms),vertexShader:zt.backgroundCube.vertexShader,fragmentShader:zt.backgroundCube.fragmentShader,side:pt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(A,P,k){this.matrixWorld.copyPosition(k.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=h.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=h.backgroundIntensity,c.material.toneMapped=M.colorSpace!==Te,(d!==M||f!==M.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,d=M,f=M.version,p=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new At(new es(2,2),new Tn({name:"BackgroundMaterial",uniforms:Zn(zt.background.uniforms),vertexShader:zt.background.vertexShader,fragmentShader:zt.background.fragmentShader,side:an,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=h.backgroundIntensity,l.material.toneMapped=M.colorSpace!==Te,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||f!==M.version||p!==i.toneMapping)&&(l.material.needsUpdate=!0,d=M,f=M.version,p=i.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,h){m.getRGB(Ni,so(i)),n.buffers.color.setClear(Ni.r,Ni.g,Ni.b,h,o)}return{getClearColor:function(){return a},setClearColor:function(m,h=1){a.set(m),u=h,g(a,u)},getClearAlpha:function(){return u},setClearAlpha:function(m){u=m,g(a,u)},render:_}}function Th(i,e,t,n){const r=i.getParameter(i.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},u=m(null);let l=u,c=!1;function d(z,G,ee,X,W){let Y=!1;if(o){const J=g(X,ee,G);l!==J&&(l=J,p(l.object)),Y=h(z,X,ee,W),Y&&y(z,X,ee,W)}else{const J=G.wireframe===!0;(l.geometry!==X.id||l.program!==ee.id||l.wireframe!==J)&&(l.geometry=X.id,l.program=ee.id,l.wireframe=J,Y=!0)}W!==null&&t.update(W,i.ELEMENT_ARRAY_BUFFER),(Y||c)&&(c=!1,k(z,G,ee,X),W!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(W).buffer))}function f(){return n.isWebGL2?i.createVertexArray():s.createVertexArrayOES()}function p(z){return n.isWebGL2?i.bindVertexArray(z):s.bindVertexArrayOES(z)}function _(z){return n.isWebGL2?i.deleteVertexArray(z):s.deleteVertexArrayOES(z)}function g(z,G,ee){const X=ee.wireframe===!0;let W=a[z.id];W===void 0&&(W={},a[z.id]=W);let Y=W[G.id];Y===void 0&&(Y={},W[G.id]=Y);let J=Y[X];return J===void 0&&(J=m(f()),Y[X]=J),J}function m(z){const G=[],ee=[],X=[];for(let W=0;W<r;W++)G[W]=0,ee[W]=0,X[W]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:ee,attributeDivisors:X,object:z,attributes:{},index:null}}function h(z,G,ee,X){const W=l.attributes,Y=G.attributes;let J=0;const he=ee.getAttributes();for(const oe in he)if(he[oe].location>=0){const j=W[oe];let ie=Y[oe];if(ie===void 0&&(oe==="instanceMatrix"&&z.instanceMatrix&&(ie=z.instanceMatrix),oe==="instanceColor"&&z.instanceColor&&(ie=z.instanceColor)),j===void 0||j.attribute!==ie||ie&&j.data!==ie.data)return!0;J++}return l.attributesNum!==J||l.index!==X}function y(z,G,ee,X){const W={},Y=G.attributes;let J=0;const he=ee.getAttributes();for(const oe in he)if(he[oe].location>=0){let j=Y[oe];j===void 0&&(oe==="instanceMatrix"&&z.instanceMatrix&&(j=z.instanceMatrix),oe==="instanceColor"&&z.instanceColor&&(j=z.instanceColor));const ie={};ie.attribute=j,j&&j.data&&(ie.data=j.data),W[oe]=ie,J++}l.attributes=W,l.attributesNum=J,l.index=X}function M(){const z=l.newAttributes;for(let G=0,ee=z.length;G<ee;G++)z[G]=0}function R(z){T(z,0)}function T(z,G){const ee=l.newAttributes,X=l.enabledAttributes,W=l.attributeDivisors;ee[z]=1,X[z]===0&&(i.enableVertexAttribArray(z),X[z]=1),W[z]!==G&&((n.isWebG
vendor: 6,066 bytes, line 3195
3195L2?i:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](z,G),W[z]=G)}function A(){const z=l.newAttributes,G=l.enabledAttributes;for(let ee=0,X=G.length;ee<X;ee++)G[ee]!==z[ee]&&(i.disableVertexAttribArray(ee),G[ee]=0)}function P(z,G,ee,X,W,Y){n.isWebGL2===!0&&(ee===i.INT||ee===i.UNSIGNED_INT)?i.vertexAttribIPointer(z,G,ee,W,Y):i.vertexAttribPointer(z,G,ee,X,W,Y)}function k(z,G,ee,X){if(n.isWebGL2===!1&&(z.isInstancedMesh||X.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;M();const W=X.attributes,Y=ee.getAttributes(),J=G.defaultAttributeValues;for(const he in Y){const oe=Y[he];if(oe.location>=0){let F=W[he];if(F===void 0&&(he==="instanceMatrix"&&z.instanceMatrix&&(F=z.instanceMatrix),he==="instanceColor"&&z.instanceColor&&(F=z.instanceColor)),F!==void 0){const j=F.normalized,ie=F.itemSize,se=t.get(F);if(se===void 0)continue;const C=se.buffer,ye=se.type,Se=se.bytesPerElement;if(F.isInterleavedBufferAttribute){const ne=F.data,xe=ne.stride,Ne=F.offset;if(ne.isInstancedInterleavedBuffer){for(let pe=0;pe<oe.locationSize;pe++)T(oe.location+pe,ne.meshPerAttribute);z.isInstancedMesh!==!0&&X._maxInstanceCount===void 0&&(X._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let pe=0;pe<oe.locationSize;pe++)R(oe.location+pe);i.bindBuffer(i.ARRAY_BUFFER,C);for(let pe=0;pe<oe.locationSize;pe++)P(oe.location+pe,ie/oe.locationSize,ye,j,xe*Se,(Ne+ie/oe.locationSize*pe)*Se)}else{if(F.isInstancedBufferAttribute){for(let ne=0;ne<oe.locationSize;ne++)T(oe.location+ne,F.meshPerAttribute);z.isInstancedMesh!==!0&&X._maxInstanceCount===void 0&&(X._maxInstanceCount=F.meshPerAttribute*F.count)}else for(let ne=0;ne<oe.locationSize;ne++)R(oe.location+ne);i.bindBuffer(i.ARRAY_BUFFER,C);for(let ne=0;ne<oe.locationSize;ne++)P(oe.location+ne,ie/oe.locationSize,ye,j,ie*Se,ie/oe.locationSize*ne*Se)}}else if(J!==void 0){const j=J[he];if(j!==void 0)switch(j.length){case 2:i.vertexAttrib2fv(oe.location,j);break;case 3:i.vertexAttrib3fv(oe.location,j);break;case 4:i.vertexAttrib4fv(oe.location,j);break;default:i.vertexAttrib1fv(oe.location,j)}}}}A()}function x(){Z();for(const z in a){const G=a[z];for(const ee in G){const X=G[ee];for(const W in X)_(X[W].object),delete X[W];delete G[ee]}delete a[z]}}function b(z){if(a[z.id]===void 0)return;const G=a[z.id];for(const ee in G){const X=G[ee];for(const W in X)_(X[W].object),delete X[W];delete G[ee]}delete a[z.id]}function q(z){for(const G in a){const ee=a[G];if(ee[z.id]===void 0)continue;const X=ee[z.id];for(const W in X)_(X[W].object),delete X[W];delete ee[z.id]}}function Z(){I(),c=!0,l!==u&&(l=u,p(l.object))}function I(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:d,reset:Z,resetDefaultState:I,dispose:x,releaseStatesOfGeometry:b,releaseStatesOfProgram:q,initAttributes:M,enableAttribute:R,disableUnusedAttributes:A}}function bh(i,e,t,n){const r=n.isWebGL2;let s;function o(l){s=l}function a(l,c){i.drawArrays(s,l,c),t.update(c,s,1)}function u(l,c,d){if(d===0)return;let f,p;if(r)f=i,p="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[p](s,l,c,d),t.update(c,s,d)}this.setMode=o,this.render=a,this.renderInstances=u}function Ah(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(P){if(P==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&i.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const u=s(a);u!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",u,"instead."),a=u);const l=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),f=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),g=i.getParameter(i.MAX_VERTEX_ATTRIBS),m=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),h=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),M=f>0,R=o||e.has("OES_texture_float"),T=M&&R,A=o?i.getParameter(i.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:d,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:h,maxFragmentUniforms:y,vertexTextures:M,floatFragmentTextures:R,floatVertexTextures:T,maxSamples:A}}function wh(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new pn,a=new Pe,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||n!==0||r;return r=f,n=d.length,p},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,f){t=c(d,f,0)},this.setState=function(d,f,p){const _=d.clippingPlanes,g=d.clipIntersection,m=d.clipShadows,h=i.get(d);if(!r||_===null||_.length===0||s&&!m)s?c(null):l();else{const y=s?0:n,M=y*4;let R=h.clippingState||null;u.value=R,R=c(_,f,M,p);for(let T=0;T!==M;++T)R[T]=t[T];h.clippingState=R,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function l(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(d,f,p,_){const g=d!==null?d.length:0;let m=null;if(g!==0){if(m=u.value,_!==!0||m===null){const h=p+g*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length<h)&&(m=new Float32Array(h));for(let M=0,R=p;M!==g;
vendor: 8,602 bytes, line 3195
3195++M,R+=4)o.copy(d[M]).applyMatrix4(y,a),o.normal.toArray(m,R),m[R+3]=o.constant}u.value=m,u.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function Rh(i){let e=new WeakMap;function t(o,a){return a===Br?o.mapping=jn:a===zr&&(o.mapping=Yn),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Br||a===zr)if(e.has(o)){const u=e.get(o).texture;return t(u,o.mapping)}else{const u=o.image;if(u&&u.height>0){const l=new Wl(u.height/2);return l.fromEquirectangularTexture(i,o),e.set(o,l),o.addEventListener("dispose",r),t(l.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const u=e.get(a);u!==void 0&&(e.delete(a),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ch extends ao{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,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,o){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=o,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,o=n+e,a=r+t,u=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=c*this.view.offsetY,u=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,u,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Vn=4,Qs=[.125,.215,.35,.446,.526,.582],_n=20,Rr=new Ch,ea=new Ie;let Cr=null;const mn=(1+Math.sqrt(5))/2,Gn=1/mn,ta=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,mn,Gn),new L(0,mn,-Gn),new L(Gn,0,mn),new L(-Gn,0,mn),new L(mn,Gn,0),new L(-mn,Gn,0)];class na{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){Cr=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sa(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ra(),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(Cr),e.scissorTest=!1,Fi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===jn||e.mapping===Yn?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Cr=this._renderer.getRenderTarget();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:bt,minFilter:bt,generateMipmaps:!1,type:ci,format:It,colorSpace:Ht,depthBuffer:!1},r=ia(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ia(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Lh(s)),this._blurMaterial=Ph(s,e,t)}return r}_compileMaterial(e){const t=new At(this._lodPlanes[0],e);this._renderer.compile(t,Rr)}_sceneToCubeUV(e,t,n,r){const a=new xt(90,1,t,n),u=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],c=this._renderer,d=c.autoClear,f=c.toneMapping;c.getClearColor(ea),c.toneMapping=$t,c.autoClear=!1;const p=new no({name:"PMREM.Background",side:pt,depthWrite:!1,depthTest:!1}),_=new At(new pi,p);let g=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(ea),g=!0);for(let h=0;h<6;h++){const y=h%3;y===0?(a.up.set(0,u[h],0),a.lookAt(l[h],0,0)):y===1?(a.up.set(0,0,u[h]),a.lookAt(0,l[h],0)):(a.up.set(0,u[h],0),a.lookAt(0,0,l[h]));const M=this._cubeSize;Fi(r,y*M,h>2?M:0,M,M),c.setRenderTarget(r),g&&c.render(_,a),c.render(e,a)}_.geometry.dispose(),_.material.dispose(),c.toneMapping=f,c.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===jn||e.mapping===Yn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=sa()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ra());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new At(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const u=this._cubeSize;Fi(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(o,Rr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=ta[(r-1)%ta.length];this._blur(e,r-1,r,s,o)}t.autoClear=n}_blur(e,t,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){const u=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const c=3,d=new At(this._lodPlanes[r],l),f=l.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*_n-1),g=s/_,m=isFinite(s)?1+Math.floor(c*g):_n;m>_n&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${_n}`);const h=[];let y=0;for(let P=0;P<_n;++P){const k=P/g,x=Math.exp(-k*k/2);h.push(x),P===0?y+=x:P<m&&(y+=2*x)}for(let P=0;P<h.length;P++)h[P]=h[P]/y;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=h,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:M}=this;f.dTheta.value=_,f.mipInt.value=M-n;const R=this._sizeLods[r],T=3*R*(r>M-Vn?r-M+Vn:0),A=4*(this._cubeSize-R);Fi(t,T,A,3*R,2*R),u.setRenderTarget(t),u.render(d,Rr)}}function Lh(i){const e=[],t=[],n=[];let r=i;const s=i-Vn+1+Qs.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let u=1/a;o>i-Vn?u=Qs[o-i+Vn-1]:o===0&&(u=0),n.push(u);const l=1/(a-2),c=-l,d=1+l,f=[c,c,d,c,d,d,c,c,d,d,c,d],p=6,_=6,g=3,m=2,h=1,y=new Float32Array(g*_*p),M=new Float32Array(m*_*p),R=new Float32Array(h*_*p);for(let A=0;A<p;A++){const P=A%3*2/3-1,k=A>2?0:-1,x=[P,k,0,P+2/3,k,0,P+2/3,k+1,0,P,k,0,P+2/3,k+1,0,P,k+1,0];y.set(x,g*_*A),M.set(f,m*_*A);const b=[A,A,A,A,A,A];R.set(b,h*_*A)}const T=new Nt;T.setAttribute("position",new Gt(y,g)),T.setAttribute("uv",new Gt(M,m)),T.setAttribute("faceIndex",new Gt(R,h)),e.push(T),r>Vn&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function ia(i,e,t){const n=new yn(i,e,t);return n.texture.mapping=Ki,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Ph(i,e,t){const n=new Float32Array(_n),r=new L(0,1,0);
vendor: 11,422 bytes, lines 3195-3345
3195return new Tn({name:"SphericalGaussianBlur",defines:{n:_n,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:ts(),fragmentShader:` 3196 3197 precision mediump float; 3198 precision mediump int; 3199 3200 varying vec3 vOutputDirection; 3201 3202 uniform sampler2D envMap; 3203 uniform int samples; 3204 uniform float weights[ n ]; 3205 uniform bool latitudinal; 3206 uniform float dTheta; 3207 uniform float mipInt; 3208 uniform vec3 poleAxis; 3209 3210 #define ENVMAP_TYPE_CUBE_UV 3211 #include <cube_uv_reflection_fragment> 3212 3213 vec3 getSample( float theta, vec3 axis ) { 3214 3215 float cosTheta = cos( theta ); 3216 // Rodrigues' axis-angle rotation 3217 vec3 sampleDirection = vOutputDirection * cosTheta 3218 + cross( axis, vOutputDirection ) * sin( theta ) 3219 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3220 3221 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3222 3223 } 3224 3225 void main() { 3226 3227 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3228 3229 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3230 3231 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3232 3233 } 3234 3235 axis = normalize( axis ); 3236 3237 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3238 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3239 3240 for ( int i = 1; i < n; i++ ) { 3241 3242 if ( i >= samples ) { 3243 3244 break; 3245 3246 } 3247 3248 float theta = dTheta * float( i ); 3249 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3250 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3251 3252 } 3253 3254 } 3255 `,blending:sn,depthTest:!1,depthWrite:!1})}function ra(){return new Tn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ts(),fragmentShader:` 3256 3257 precision mediump float; 3258 precision mediump int; 3259 3260 varying vec3 vOutputDirection; 3261 3262 uniform sampler2D envMap; 3263 3264 #include <common> 3265 3266 void main() { 3267 3268 vec3 outputDirection = normalize( vOutputDirection ); 3269 vec2 uv = equirectUv( outputDirection ); 3270 3271 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3272 3273 } 3274 `,blending:sn,depthTest:!1,depthWrite:!1})}function sa(){return new Tn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ts(),fragmentShader:` 3275 3276 precision mediump float; 3277 precision mediump int; 3278 3279 uniform float flipEnvMap; 3280 3281 varying vec3 vOutputDirection; 3282 3283 uniform samplerCube envMap; 3284 3285 void main() { 3286 3287 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3288 3289 } 3290 `,blending:sn,depthTest:!1,depthWrite:!1})}function ts(){return` 3291 3292 precision mediump float; 3293 precision mediump int; 3294 3295 attribute float faceIndex; 3296 3297 varying vec3 vOutputDirection; 3298 3299 // RH coordinate system; PMREM face-indexing convention 3300 vec3 getDirection( vec2 uv, float face ) { 3301 3302 uv = 2.0 * uv - 1.0; 3303 3304 vec3 direction = vec3( uv, 1.0 ); 3305 3306 if ( face == 0.0 ) { 3307 3308 direction = direction.zyx; // ( 1, v, u ) pos x 3309 3310 } else if ( face == 1.0 ) { 3311 3312 direction = direction.xzy; 3313 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3314 3315 } else if ( face == 2.0 ) { 3316 3317 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3318 3319 } else if ( face == 3.0 ) { 3320 3321 direction = direction.zyx; 3322 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3323 3324 } else if ( face == 4.0 ) { 3325 3326 direction = direction.xzy; 3327 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3328 3329 } else if ( face == 5.0 ) { 3330 3331 direction.z *= -1.0; // ( u, v, -1 ) neg z 3332 3333 } 3334 3335 return direction; 3336 3337 } 3338 3339 void main() { 3340 3341 vOutputDirection = getDirection( uv, faceIndex ); 3342 gl_Position = vec4( position, 1.0 ); 3343 3344 } 3345 `}function Uh(i){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const u=a.mapping,l=u===Br||u===zr,c=u===jn||u===Yn;if(l||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new na(i)),d=l?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(l&&d&&d.height>0||c&&d&&r(d)){t===null&&(t=new na(i));const f=l?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function r(a){let u=0;const l=6;for(let c=0;c<l;c++)a[c]!==void 0&&u++;return u===l}function s(a){const u=a.target;u.removeEventListener("dispose",s);const l=e.get(u);l!==void 0&&(e.delete(u),l.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function Dh(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(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Ih(i,e,t,n){const r={},s=new WeakMap;function o(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const _ in f.attributes)e.remove(f.attributes[_]);f.removeEventListener("dispose",o),delete r[f.id];const p=s.get(f);p&&(e.remove(p),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(d,f){return r[f.id]===!0||(f.addEventListener("dispose",o),r[f.id]=!0,t.memory.geometries++),f}function u(d){const f=d.attributes;for(const _ in f)e.update(f[_],i.ARRAY_BUFFER);const p=d.morphAttributes;for(const _ in p){const g=p[_];for(let m=0,h=g.length;m<h;m++)e.update(g[m],i.ARRAY_BUFFER)}}function l(d){const f=[],p=d.index,_=d.attributes.position;let g=0;if(p!==null){const y=p.array;g=p.version;for(let M=0,R=y.length;M<R;M+=3){const T=y[M+0],A=y[M+1],P=y[M+2];f.push(T,A,A,P,P,T)}}else{const y=_.array;g=_.version;for(let M=0,R=y.length/3-1;M<R;M+=3){const T=M+0,A=M+1,P=M+2;f.push(T,A,A,P,P,T)}}const m=new(Za(f)?ro:io)(f,1);m.version=g;const h=s.get(d);h&&e.remove(h),s.set(d,m)}function c(d){const f=s.get(d);if(f){const p=d.index;p!==null&&f.version<p.version&&l(d)}else l(d);return s.get(d)}return{get:a,update:u,getWireframeAttribute:c}}function Nh(i,e,t,n){const r=n.isWebGL2;let s;function o(f){s=f}let a,u;function l(f){a=f.type,u=f.bytesPerElement}function c(f,p){i.drawElements(s,p,a,f*u),t.update(p,s,1)}function d(f,p,_){if(_===0)return;let g,m;if(r)g=i,m="drawElementsInstanced";else if(g=e.get("ANGLE_instanced_arrays"),m="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[m](s,p,a,f*u,_),t.update(p,s,_)}this.setMode=o,this.setIndex=l,this.render=c,this.renderInstances=d}function Fh(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.frame++,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 Oh(i,e){return i[0]-e[0]}function Bh(i,e){return Math.abs(e[1])-Math.abs(i[1])}function zh(i,e,t){const n={},r=new Float32Array(8),s=new WeakMap,o=new Ve,a=[];for(let l=0;l<8;l++)a[l]=[l,0];function u(l,c,d){const f=l.morphTargetInfluences;if(e.isWebGL2===!0){const p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,_=p!==void 0?p.length:0;let g=s.get(c);if(g===void 0||g.count!==_){let z=function(){Z.dispose(),s.delete(c),c.removeEventListener("dispose",z)};g!==void 0&&g.texture.dispose();const y=c.morphAttributes.position!==void 0,M=c.morphAttributes.normal!==void 0,R=c.morphAttributes.color!==void 0,T=c.morphAttributes.position||[],A=c.morphAttributes.normal||[],P=c.morphAttributes.color||[];let k=0;y===!0&&(k=1),M===!0&&(k=2),R===!0&&(k=3);let x=c.attributes.position.count*k,b=1;x>e.maxTextureSize&&(b=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const q=new Float32Array(x*b*4*_),Z=new Qa(q,x,b,_);Z.type=vn,Z.needsUpdate=!0;const I=k*4;for(let G=0;G<_;G++){const ee=T[G],X=A[G],W=P[G],Y=x*b*4*G;for(let J=0;J<ee.count;J++){const he=J*I;y===!0&&(o.fromBufferAttribute(ee,J),q[Y+he+0]=o.x,q[Y+he+1]=o.y,q[Y+he+2]=o.z,q[Y+he+3]=0),M===!0&&(o.fromBufferAttribute(X,J),q[Y+he+4]=o.x,q[Y+he+5]=o.y,q[Y+he+6]=o.z,q[Y+he+7]=0),R===!0&&(o.fromBufferAttribute(W,J),q[Y+he+8]=o.x,q[Y+he+9]=o.y,q[Y+he+10]=o.z,q[Y+he+11]=W.itemSize===4?o.w:1)}}g={count:_,texture:Z,size:new Oe(x,b)},s.set(c,g),c.addEventListener("dispose",z)}let m=0;for(let y=0;y<f.length;y++)m+=f[y];const h=c.morphTargetsRelative?1:1-m;d.getUniforms().setValue(i,"morphTargetBaseInfluence",h),d.getUniforms().setValue(i,"morphTargetInfluences",f),d.getUniforms().setValue(i,"morphTargetsTexture",g.texture,t),d.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}else{const p=f===void 0?0:f.length;let _=n[c.id];if(_===void 0||_.length!==p){_=[];for(let M=0;M<p;M++)_[M]=[M,0];n[c.id]=_}for(let M=0;M<p;M++){const R=_[M];R[0]=M,R[1]=f[M]}_.sort(Bh);for(let M=0;M<8;M++)M<p&&_[M][1]?(a[M][0]=_[M][0],a[M][1]=_[M][1]):(a[M][0]=Number.MAX_SAFE_INTEGER,a[M][1]=0);a.sort(Oh);const g=c.morphAttributes.position,m=c.morphAttributes.normal;let h=0;for(let M=0;M<8;M++){const R=a[M],T=R[0],A=R[1];T!==Number.MAX_SAFE_INTEGER&&A?(g&&c.getAttribute("morphTarget"+M)!==g[T]&&c.setAttribute("morphTarget"+M,g[T]),m&&c.getAttribute("morphNormal"+M)!==m[T]&&c.setAttribute("morphNormal"+M,m[T]),r[M]=A,h+=A):(g&&c.hasAttribute("morphTarget"+M)===!0&&c.deleteAttribute("morphTarget"+M),m&&c.hasAttribute("morphNormal"+M)===!0&&c.deleteAttribute("morphNormal"+M),r[M]=0)}const y=c.morphTargetsRelative?1:1-h;d.getUniforms().setValue(i,"morphTargetBaseInfluence",y),d.getUniforms().setValue(i,"morphTargetInfluences",r)}}return{update:u}}function Gh(i,e,t,n){let r=new WeakMap;function s(u){const l=n.render.frame,c=u.geometry,d=e.get(u,c);return r.get(d)!==l&&(e.update(d),r.set(d,l)),u.isInstancedMesh&&(u.hasEventListener("dispose",a)===!1&&u.addEventListener("dispose",a),t.update(u.instanceMatrix,i.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,
vendor: 7,850 bytes, line 3345
3345i.ARRAY_BUFFER)),d}function o(){r=new WeakMap}function a(u){const l=u.target;l.removeEventListener("dispose",a),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:s,dispose:o}}const co=new Mt,uo=new Qa,ho=new Rl,fo=new oo,aa=[],oa=[],la=new Float32Array(16),ca=new Float32Array(9),ua=new Float32Array(4);function Jn(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=aa[r];if(s===void 0&&(s=new Float32Array(r),aa[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function Ze(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 $e(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function $i(i,e){let t=oa[e];t===void 0&&(t=new Int32Array(e),oa[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Hh(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Vh(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(Ze(t,e))return;i.uniform2fv(this.addr,e),$e(t,e)}}function kh(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(Ze(t,e))return;i.uniform3fv(this.addr,e),$e(t,e)}}function Wh(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(Ze(t,e))return;i.uniform4fv(this.addr,e),$e(t,e)}}function Xh(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ze(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),$e(t,e)}else{if(Ze(t,n))return;ua.set(n),i.uniformMatrix2fv(this.addr,!1,ua),$e(t,n)}}function qh(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ze(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),$e(t,e)}else{if(Ze(t,n))return;ca.set(n),i.uniformMatrix3fv(this.addr,!1,ca),$e(t,n)}}function jh(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ze(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),$e(t,e)}else{if(Ze(t,n))return;la.set(n),i.uniformMatrix4fv(this.addr,!1,la),$e(t,n)}}function Yh(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Kh(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(Ze(t,e))return;i.uniform2iv(this.addr,e),$e(t,e)}}function Zh(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(Ze(t,e))return;i.uniform3iv(this.addr,e),$e(t,e)}}function $h(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(Ze(t,e))return;i.uniform4iv(this.addr,e),$e(t,e)}}function Jh(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Qh(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(Ze(t,e))return;i.uniform2uiv(this.addr,e),$e(t,e)}}function ed(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(Ze(t,e))return;i.uniform3uiv(this.addr,e),$e(t,e)}}function td(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(Ze(t,e))return;i.uniform4uiv(this.addr,e),$e(t,e)}}function nd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2D(e||co,r)}function id(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||ho,r)}function rd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||fo,r)}function sd(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||uo,r)}function ad(i){switch(i){case 5126:return Hh;case 35664:return Vh;case 35665:return kh;case 35666:return Wh;case 35674:return Xh;case 35675:return qh;case 35676:return jh;case 5124:case 35670:return Yh;case 35667:case 35671:return Kh;case 35668:case 35672:return Zh;case 35669:case 35673:return $h;case 5125:return Jh;case 36294:return Qh;case 36295:return ed;case 36296:return td;case 35678:case 36198:case 36298:case 36306:case 35682:return nd;case 35679:case 36299:case 36307:return id;case 35680:case 36300:case 36308:case 36293:return rd;case 36289:case 36303:case 36311:case 36292:return sd}}function od(i,e){i.uniform1fv(this.addr,e)}function ld(i,e){const t=Jn(e,this.size,2);i.uniform2fv(this.addr,t)}function cd(i,e){const t=Jn(e,this.size,3);i.uniform3fv(this.addr,t)}function ud(i,e){const t=Jn(e,this.size,4);i.uniform4fv(this.addr,t)}function hd(i,e){const t=Jn(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function dd(i,e){const t=Jn(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function fd(i,e){const t=Jn(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function pd(i,e){i.uniform1iv(this.addr,e)}function md(i,e){i.uniform2iv(this.addr,e)}function _d(i,e){i.uniform3iv(this.addr,e)}function gd(i,e){i.uniform4iv(this.addr,e)}function vd(i,e){i.uniform1uiv(this.addr,e)}function xd(i,e){i.uniform2uiv(this.addr,e)}function Md(i,e){i.uniform3uiv(this.addr,e)}function Sd(i,e){i.uniform4uiv(this.addr,e)}function Ed(i,e,t){const n=this.cache,r=e.length,s=$i(t,r);Ze(n,s)||(i.uniform1iv(this.addr,s),$e(n,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||co,s[o])}function yd(i,e,t){const n=this.cache,r=e.length,s=$i(t,r);Ze(n,s)||(i.uniform1iv(this.addr,s),$e(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||ho,s[o])}function Td(i,e,t){const n=this.cache,r=e.length,s=$i(t,r);Ze(n,s)||(i.uniform1iv(this.addr,s),$e(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||fo,s[o])}function bd(i,e,t){const n=this.cache,r=e.length,s=$i(t,r);Ze(n,s)||(i.uniform1iv(this.addr,s),$e(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||uo,s[o])}function Ad(i){switch(i){case 5126:return od;case 35664:return ld;case 35665:return cd;case 35666:return ud;case 35674:return hd;case 35675:return dd;case 35676:return fd;case 5124:case 35670:return pd;case 35667:case 35671:return md;case 35668:case 35672:return _d;case 35669:case 35673:return gd;case 5125:return vd;case 36294:return xd;case 36295:return Md;case 36296:return Sd;case 35678:case 36198:case 36298:case 36306:case 35682:return Ed;case 35679:case 36299:case 36307:return yd;case 35680:case 36300:case 36308:case 36293:return Td;case 36289:case 36303:case 36311:case 36292:return bd}}class wd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=ad(t.type)}}class Rd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=Ad(t.type)}}class Cd{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],n)}}}const Lr=/(\w+)(\])?(\[|\.)?/g;function ha(i,e){i.seq.push(e),i.map[e.id]=e}function Ld(i,e,t){const n=i.name,r=n.length;for(Lr.lastIndex=0;;){const s=Lr.exec(n),o=Lr.lastIndex;let a=s[1];const u=s[2]==="]",l=s[3];if(u&&(a=a|0),l===void 0||l==="["&&o+2===r){ha(t,l===void 0?new wd(a,i,e):new Rd(a,i,e));break}else{let d=t.map[a];d===void 0&&(d=new Cd(a),ha(t,d)),t=d}}}class qi{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),o=e.getUniformLocation(t,s.name);
3345Ld(s,o,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,o=t.length;s!==o;++s){const a=t[s],u=n[a.id];u.needsUpdate!==!1&&a.setValue(e,u.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&n.push(o)}return n}}function da(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}let Pd=0;function Ud(i,e){const t=i.split(` 3346`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` 3347`)}function Dd(i){switch(i){case Ht:return["Linear","( value )"];case Te:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),["Linear","( value )"]}}function fa(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 o=parseInt(s[1]);return t.toUpperCase()+` 3348 3349`+r+` 3350 3351`+Ud(i.getShaderSource(e),o)}else return r}function Id(i,e){const t=Dd(e);return"vec4 "+i+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Nd(i,e){let t;switch(e){case Yo:t="Linear";break;case Ko:t="Reinhard";break;case Zo:t="OptimizedCineon";break;case $o:t="ACESFilmic";break;case Jo:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Fd(i){return[i.extensionDerivatives||i.envMapCubeUVHeight||i.bumpMap||i.normalMapTangentSpace||i.clearcoatNormalMap||i.flatShading||i.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(i.extensionFragDepth||i.logarithmicDepthBuffer)&&i.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",i.extensionDrawBuffers&&i.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(i.extensionShaderTextureLOD||i.envMap||i.transmission)&&i.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(si).join(` 3352`)}function Od(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3353`)}function Bd(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),o=s.name;let a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function si(i){return i!==""}function pa(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 ma(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const zd=/^[ \t]*#include +<([\w\d./]+)>/gm;function Wr(i){return i.replace(zd,Gd)}function Gd(i,e){const t=Ae[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Wr(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 _a(i){return i.replace(Hd,Vd)}function Vd(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 ga(i){let e="precision "+i.precision+` float; 3354precision `+i.precision+" int;";return i.precision==="highp"?e+=` 3355#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3356#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3357#define LOW_PRECISION`),e}function kd(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Va?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Ao?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Kt&&(e="SHADOWMAP_TYPE_VSM"),e}function Wd(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case jn:case Yn:e="ENVMAP_TYPE_CUBE";break;case Ki:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Xd(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Yn:e="ENVMAP_MODE_REFRACTION";break}return e}function qd(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case $r:e="ENVMAP_BLENDING_MULTIPLY";break;case qo:e="ENVMAP_BLENDING_MIX";break;case jo:e="ENVMAP_BLENDING_ADD";break}return e}
vendor: 6,417 bytes, lines 3357-3364
3357function jd(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Yd(i,e,t,n){const r=i.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const u=kd(t),l=Wd(t),c=Xd(t),d=qd(t),f=jd(t),p=t.isWebGL2?"":Fd(t),_=Od(s),g=r.createProgram();let m,h,y=t.glslVersion?"#version "+t.glslVersion+` 3358`:"";t.isRawShaderMaterial?(m=[_].filter(si).join(` 3359`),m.length>0&&(m+=` 3360`),h=[p,_].filter(si).join(` 3361`),h.length>0&&(h+=` 3362`)):(m=[ga(t),"#define SHADER_NAME "+t.shaderName,_,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",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 "+c:"",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.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.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.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?"#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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3363`].filter(si).join(` 3364`),h=[p,ga(t),"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+c:"",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: 7,751 bytes, lines 3364-3375
3364Mip+".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.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",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.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?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#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 "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==$t?"#define TONE_MAPPING":"",t.toneMapping!==$t?Ae.tonemapping_pars_fragment:"",t.toneMapping!==$t?Nd("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ae.encodings_pars_fragment,Id("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3365`].filter(si).join(` 3366`)),o=Wr(o),o=pa(o,t),o=ma(o,t),a=Wr(a),a=pa(a,t),a=ma(a,t),o=_a(o),a=_a(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es 3367`,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3368`)+` 3369`+m,h=["#define varying in",t.glslVersion===Fs?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Fs?"":"#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(` 3370`)+` 3371`+h);const M=y+m+o,R=y+h+a,T=da(r,r.VERTEX_SHADER,M),A=da(r,r.FRAGMENT_SHADER,R);if(r.attachShader(g,T),r.attachShader(g,A),t.index0AttributeName!==void 0?r.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),i.debug.checkShaderErrors){const x=r.getProgramInfoLog(g).trim(),b=r.getShaderInfoLog(T).trim(),q=r.getShaderInfoLog(A).trim();let Z=!0,I=!0;if(r.getProgramParameter(g,r.LINK_STATUS)===!1)if(Z=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,g,T,A);else{const z=fa(r,T,"vertex"),G=fa(r,A,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,r.VALIDATE_STATUS)+` 3372 3373Program Info Log: `+x+` 3374`+z+` 3375`+G)}else x!==""?console.warn("THREE.WebGLProgram: Program Info Log:",x):(b===""||q==="")&&(I=!1);I&&(this.diagnostics={runnable:Z,programLog:x,vertexShader:{log:b,prefix:m},fragmentShader:{log:q,prefix:h}})}r.deleteShader(T),r.deleteShader(A);let P;this.getUniforms=function(){return P===void 0&&(P=new qi(r,g)),P};let k;return this.getAttributes=function(){return k===void 0&&(k=Bd(r,g)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=t.shaderName,this.id=Pd++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=T,this.fragmentShader=A,this}let Kd=0;class Zd{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),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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 $d(e),t.set(e,n)),n}}class $d{constructor(e){this.id=Kd++,this.code=e,this.usedTimes=0}}function Jd(i,e,t,n,r,s,o){const a=new eo,u=new Zd,l=[],c=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const _={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 g(x){return x===1?"uv1":x===2?"uv2":x===3?"uv3":"uv"}function m(x,b,q,Z,I){const z=Z.fog,G=I.geometry,ee=x.isMeshStandardMaterial?Z.environment:null,X=(x.isMeshStandardMaterial?t:e).get(x.envMap||ee),W=X&&X.mapping===Ki?X.image.height:null,Y=_[x.type];x.precision!==null&&(p=r.getMaxPrecision(x.precision),p!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",p,"instead."));const J=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,he=J!==void 0?J.length:0;let oe=0;G.morphAttributes.position!==void 0&&(oe=1),G.morphAttributes.normal!==void 0&&(oe=2),G.morphAttributes.color!==void 0&&(oe=3);let F,j,ie,se;if(Y){const Ge=zt[Y];F=Ge.vertexShader,j=Ge.fragmentShader}else F=x.vertexShader,j=x.fragmentShader,u.update(x),ie=u.getVertexShaderID(x),se=u.getFragmentShaderID(x);const C=i.getRenderTarget(),ye=I.isInstancedMesh===!0,Se=!!x.map,ne=!!x.matcap,xe=!!X,Ne=!!x.aoMap,pe=!!x.lightMap,Ce=!!x.bumpMap,Je=!!x.normalMap,nt=!!x.displacementMap,Qe=!!x.emissiveMap,Ke=!!x.metalnessMap,Fe=!!x.roughnessMap,ke=x.clearcoat>0,dt=x.iridescence>0,E=x.sheen>0,v=x.transmission>0,N=ke&&!!x.clearcoatMap,$=ke&&!!x.clearcoatNormalMap,Q=ke&&!!x.clearcoatRoughnessMap,re=dt&&!!x.iridescenceMap,Me=dt&&!!x.iridescenceThicknessMap,ce=E&&!!x.sheenColorMap,H=E&&!!x.sheenRoughnessMap,de=!!x.specularMap,me=!!x.specularColorMap,ge=!!x.specularIntensityMap,le=v&&!!x.transmissionMap,fe=v&&!!x.thicknessMap,Ue=!!x.gradientMap,Be=!!x.alphaMap,Xe=x.alph
3375aTest>0,w=!!x.extensions,O=!!G.attributes.uv1,K=!!G.attributes.uv2,ae=!!G.attributes.uv3;return{isWebGL2:c,shaderID:Y,shaderName:x.type,vertexShader:F,fragmentShader:j,defines:x.defines,customVertexShaderID:ie,customFragmentShaderID:se,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:p,instancing:ye,instancingColor:ye&&I.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:C===null?i.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:Ht,map:Se,matcap:ne,envMap:xe,envMapMode:xe&&X.mapping,envMapCubeUVHeight:W,aoMap:Ne,lightMap:pe,bumpMap:Ce,normalMap:Je,displacementMap:f&&nt,emissiveMap:Qe,normalMapObjectSpace:Je&&x.normalMapType===gl,normalMapTangentSpace:Je&&x.normalMapType===Ya,metalnessMap:Ke,roughnessMap:Fe,clearcoat:ke,clearcoatMap:N,clearcoatNormalMap:$,clearcoatRoughnessMap:Q,iridescence:dt,iridescenceMap:re,iridescenceThicknessMap:Me,sheen:E,sheenColorMap:ce,sheenRoughnessMap:H,specularMap:de,specularColorMap:me,specularIntensityMap:ge,transmission:v,transmissionMap:le,thicknessMap:fe,gradientMap:Ue,opaque:x.transparent===!1&&x.blending===Wn,alphaMap:Be,alphaTest:Xe,combine:x.combine,mapUv:Se&&g(x.map.channel),aoMapUv:Ne&&g(x.aoMap.channel),lightMapUv:pe&&g(x.lightMap.channel),bumpMapUv:Ce&&g(x.bumpMap.channel),normalMapUv:Je&&g(x.normalMap.channel),displacementMapUv:nt&&g(x.displacementMap.channel),emissiveMapUv:Qe&&g(x.emissiveMap.channel),metalnessMapUv:Ke&&g(x.metalnessMap.channel),roughnessMapUv:Fe&&g(x.roughnessMap.channel),clearcoatMapUv:N&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:$&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:re&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:H&&g(x.sheenRoughnessMap.channel),specularMapUv:de&&g(x.specularMap.channel),specularColorMapUv:me&&g(x.specularColorMap.channel),specularIntensityMapUv:ge&&g(x.specularIntensityMap.channel),transmissionMapUv:le&&g(x.transmissionMap.channel),thicknessMapUv:fe&&g(x.thicknessMap.channel),alphaMapUv:Be&&g(x.alphaMap.channel),vertexTangents:Je&&!!G.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUv1s:O,vertexUv2s:K,vertexUv3s:ae,pointsUvs:I.isPoints===!0&&!!G.attributes.uv&&(Se||Be),fog:!!z,useFog:x.fog===!0,fogExp2:z&&z.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:I.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:he,morphTextureStride:oe,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&q.length>0,shadowMapType:i.shadowMap.type,toneMapping:x.toneMapped?i.toneMapping:$t,useLegacyLights:i.useLegacyLights,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===Zt,flipSided:x.side===pt,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:w&&x.extensions.derivatives===!0,extensionFragDepth:w&&x.extensions.fragDepth===!0,extensionDrawBuffers:w&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:w&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:c||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||n.has("EXT_shader_texture_lod"),customProgramCacheKey:x.customProgramCacheKey()}}function h(x){const b=[];if(x.shaderID?b.push(x.shaderID):(b.push(x.customVertexShaderID),b.push(x.customFragmentShaderID)),x.defines!==void 0)for(const q in x.defines)b.push(q),b.push(x.defines[q]);return x.isRawShaderMaterial===!1&&(y(b,x),M(b,x),b.push(i.outputColorSpace)),b.push(x.customProgramCacheKey),b.join()}function y(x,b){x.push(b.precision),x.push(b.outputColorSpace),x.push(b.envMapMode),x.push(b.envMapCubeUVHeight),x.push(b.mapUv),x.push(b.alphaMapUv),x.push(b.lightMapUv),x.push(b.aoMapUv),x.push(b.bumpMapUv),x.push(b.normalMapUv),x.push(b.displacementMapUv),x.push(b.emissiveMapUv),x.push(b.metalnessMapUv),x.push(b.roughnessMapUv),x.push(b.clearcoatMapUv),x.push(b.clearcoatNormalMapUv),x.push(b.clearcoatRoughnessMapUv),x.push(b.iridescenceMapUv),x.push(b.iridescenceThicknessMapUv),x.push(b.sheenColorMapUv),x.push(b.sheenRoughnessMapUv),x.push(b.specularMapUv),x.push(b.specularColorMapUv),x.push(b.specularIntensityMapUv),x.push(b.transmissionMapUv),x.push(b.thicknessMapUv),x.push(b.combine),x.push(b.fogExp2),x.push(b.sizeAttenuation),x.push(b.morphTargetsCount),x.push(b.morphAttributeCount),x.push(b.numDirLights),x.push(b.numPointLights),x.push(b.numSpotLights),x.push(b.numSpotLightMaps),x.push(b.numHemiLights),x.push(b.numRectAreaLights),x.push(b.numDirLightShadows),x.push(b.numPointLightShadows),x.push(b.numSpotLightShadows),x.push(b.numSpotLightShadowsWithMaps),x.push(b.shadowMapType),x.push(b.toneMapping),x.push(b.numClippingPlanes),x.push(b.numClipIntersection),x.push(b.depthPacking)}function M(x,b){a.disableAll(),b.isWebGL2&&a.enable(0),b.supportsVertexTextures&&a.enable(1),b.instancing&&a.enable(2),b.instancingColor&&a.enable(3),b.matcap&&a.enable(4),b.envMap&&a.enable(5),b.normalMapObjectSpace&&a.enable(6),b.normalMapTangentSpace&&a.enable(7),b.clearcoat&&a.enable(8),b.iridescence&&a.enable(9),b.alphaTest&&a.enable(10),b.vertexColors&&a.enable(11),b.vertexAlphas&&a.enable(12),b.vertexUv1s&&a.enable(13),b.vertexUv2s&&a.enable(14),b.vertexUv3s&&a.enable(15),b.vertexTangents&&a.enable(16),x.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.skinning&&a.enable(4),b.morphTargets&&a.enable(5),b.morphNormals&&a.enable(6),b.morphColors&&a.enable(7),b.premultipliedAlpha&&a.enable(8),b.shadowMapEnabled&&a.enable(9),b.useLegacyLights&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),x.push(a.mask)}function R(x){const b=_[x.type];let q;if(b){const Z=zt[b];q=Gl.clone(Z.uniforms)}else q=x.uniforms;return q}function T(x,b){let q;for(let Z=0,I=l.length;Z<I;Z++){const z=l[Z];if(z.cacheKey===b){q=z,++q.usedTimes;break}}return q===void 0&&(q=new Yd(i,b,x,s),l.push(q)),q}function A(x){if(--x.usedTimes===0){const b=l.indexOf(x);l[b]=l[l.length-1],l.pop(),x.destroy()}}function P(x){u.remove(x)}function k(){u.dispose()}return{getParameters:m,getProgramCacheKey:h,getUniforms:R,acquireProgram:T,releaseProgram:A,releaseShaderCache:P,programs:l,dis
vendor: 9,702 bytes, lines 3375-3381
3375pose:k}}function Qd(){let i=new WeakMap;function e(s){let o=i.get(s);return o===void 0&&(o={},i.set(s,o)),o}function t(s){i.delete(s)}function n(s,o,a){i.get(s)[o]=a}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function ef(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 va(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 xa(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d,f,p,_,g,m){let h=i[e];return h===void 0?(h={id:d.id,object:d,geometry:f,material:p,groupOrder:_,renderOrder:d.renderOrder,z:g,group:m},i[e]=h):(h.id=d.id,h.object=d,h.geometry=f,h.material=p,h.groupOrder=_,h.renderOrder=d.renderOrder,h.z=g,h.group=m),e++,h}function a(d,f,p,_,g,m){const h=o(d,f,p,_,g,m);p.transmission>0?n.push(h):p.transparent===!0?r.push(h):t.push(h)}function u(d,f,p,_,g,m){const h=o(d,f,p,_,g,m);p.transmission>0?n.unshift(h):p.transparent===!0?r.unshift(h):t.unshift(h)}function l(d,f){t.length>1&&t.sort(d||ef),n.length>1&&n.sort(f||va),r.length>1&&r.sort(f||va)}function c(){for(let d=e,f=i.length;d<f;d++){const p=i[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:a,unshift:u,finish:c,sort:l}}function tf(){let i=new WeakMap;function e(n,r){const s=i.get(n);let o;return s===void 0?(o=new xa,i.set(n,[o])):r>=s.length?(o=new xa,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function nf(){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 L,color:new Ie};break;case"SpotLight":t={position:new L,direction:new L,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":t={color:new Ie,position:new L,halfWidth:new L,halfHeight:new L};break}return i[e.id]=t,t}}}function rf(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let sf=0;function af(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function of(i,e){const t=new nf,n=rf(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let c=0;c<9;c++)r.probe.push(new L);const s=new L,o=new We,a=new We;function u(c,d){let f=0,p=0,_=0;for(let q=0;q<9;q++)r.probe[q].set(0,0,0);let g=0,m=0,h=0,y=0,M=0,R=0,T=0,A=0,P=0,k=0;c.sort(af);const x=d===!0?Math.PI:1;for(let q=0,Z=c.length;q<Z;q++){const I=c[q],z=I.color,G=I.intensity,ee=I.distance,X=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)f+=z.r*G*x,p+=z.g*G*x,_+=z.b*G*x;else if(I.isLightProbe)for(let W=0;W<9;W++)r.probe[W].addScaledVector(I.sh.coefficients[W],G);else if(I.isDirectionalLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity*x),I.castShadow){const Y=I.shadow,J=n.get(I);J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radius,J.shadowMapSize=Y.mapSize,r.directionalShadow[g]=J,r.directionalShadowMap[g]=X,r.directionalShadowMatrix[g]=I.shadow.matrix,R++}r.directional[g]=W,g++}else if(I.isSpotLight){const W=t.get(I);W.position.setFromMatrixPosition(I.matrixWorld),W.color.copy(z).multiplyScalar(G*x),W.distance=ee,W.coneCos=Math.cos(I.angle),W.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),W.decay=I.decay,r.spot[h]=W;const Y=I.shadow;if(I.map&&(r.spotLightMap[P]=I.map,P++,Y.updateMatrices(I),I.castShadow&&k++),r.spotLightMatrix[h]=Y.matrix,I.castShadow){const J=n.get(I);J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radius,J.shadowMapSize=Y.mapSize,r.spotShadow[h]=J,r.spotShadowMap[h]=X,A++}h++}else if(I.isRectAreaLight){const W=t.get(I);W.color.copy(z).multiplyScalar(G),W.halfWidth.set(I.width*.5,0,0),W.halfHeight.set(0,I.height*.5,0),r.rectArea[y]=W,y++}else if(I.isPointLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity*x),W.distance=I.distance,W.decay=I.decay,I.castShadow){const Y=I.shadow,J=n.get(I);J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radius,J.shadowMapSize=Y.mapSize,J.shadowCameraNear=Y.camera.near,J.shadowCameraFar=Y.camera.far,r.pointShadow[m]=J,r.pointShadowMap[m]=X,r.pointShadowMatrix[m]=I.shadow.matrix,T++}r.point[m]=W,m++}else if(I.isHemisphereLight){const W=t.get(I);W.skyColor.copy(I.color).multiplyScalar(G*x),W.groundColor.copy(I.groundColor).multiplyScalar(G*x),r.hemi[M]=W,M++}}y>0&&(e.isWebGL2||i.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=te.LTC_FLOAT_1,r.rectAreaLTC2=te.LTC_FLOAT_2):i.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=te.LTC_HALF_1,r.rectAreaLTC2=te.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=_;const b=r.hash;(b.directionalLength!==g||b.pointLength!==m||b.spotLength!==h||b.rectAreaLength!==y||b.hemiLength!==M||b.numDirectionalShadows!==R||b.numPointShadows!==T||b.numSpotShadows!==A||b.numSpotMaps!==P)&&(r.directional.length=g,r.spot.length=h,r.rectArea.length=y,r.point.length=m,r.hemi.length=M,r.directionalShadow.length=R,r.directionalShadowMap.length=R,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=A,r.spotShadowMap.length=A,r.directionalShadowMatrix.length=R,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=A+P-k,r.spotLightMap.length=P,r.numSpotLightShadowsWithMaps=k,b.directionalLength=g,b.pointLength=m,b.spotLength=h,b.rectAreaLength=y,b.hemiLength=M,b.numDirectionalShadows=R,b.numPointShadows=T,b.numSpotShadows=A,b.numSpotMaps=P,r.version=sf++)}function l(c,d){let f=0,p=0,_=0,g=0,m=0;const h=d.matrixWorldInverse;for(let y=0,M=c.length;y<M;y++){const R=c[y];if(R.isDirectionalLight){const T=r.directional[f];T.direction.setFromMatrixPosition(R.matrixWorld),s.setFromMatrixPosition(R.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(h),f++}else if(R.isSpotLight){const T=r.spot[_];T.position.setFromMatrixPosition(R.matrixWorld),T.position.applyMatrix4(h),T.direction.setFromMatrixPosition(R.matrixWorld),s.setFromMatrixPosition(R.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(h),_++}else if(R.isRectAreaLight){const T=r.rectArea[g];T.position.setFromMatrixPosition(R.matrixWorld),T.position.applyMatrix4(h),a.identity(),o.copy(R.matrixWorld),o.premultiply(h),a.extractRotation(o),T.halfWidth.set(R.width*.5,0,0),T.halfHeight.set(0,R.height*.5,0),T.halfWidth.applyMatrix4(a),T.halfHeight.applyMatrix4(a),g++}else if(R.isPointLight){const T=r.point[p];T.position.setFromMatrixPosition(R.matrixWorld),T.position.applyMatrix4(h),p++}else if(R.isHemisphereLight){const T=r.hemi[m];T.direction.setFromMatrixPosition(R.matrixWorld),T.direction.transformDirection(h),m++}}}return{setup:u,setupView:l,state:r}}function Ma(i,e){const t=new of(i,e),n=[],r=[];function s(){n.length=0,r.length=0}function o(d){n.push(d)}function a(d){r.push(d)}function u(d){t.setup(n,d)}function l(d){t.setupView(n,d)}return{init:s,state:{lightsArray:n,shadowsArray:r,lights:t},setupLights:u,setupLightsView:l,pushLight:o,pushShadow:a}}function lf(i,e){let t=new WeakMap;function n(s,o=0){const a=t.get(s);let u;return a===void 0?(u=new Ma(i,e),t.set(s,[u])):o>=a.length?(u=new Ma(i,e),a.push(u)):u=a[o],u}function r(){t=new WeakMap}return{get:n,dispose:r}}class cf extends Jt{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 uf extends Jt{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const hf=`void main() { 3376 gl_Position = vec4( position, 1.0 ); 3377}`,df=`uniform sampler2D shadow_pass; 3378uniform vec2 resolution; 3379uniform float radius; 3380#include <packing> 3381void main() {
3382 const float samples = float( VSM_SAMPLES ); 3383 float mean = 0.0; 3384 float squared_mean = 0.0; 3385 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3386 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3387 for ( float i = 0.0; i < samples; i ++ ) { 3388 float uvOffset = uvStart + i * uvStride; 3389 #ifdef HORIZONTAL_PASS 3390 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3391 mean += distribution.x; 3392 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3393 #else 3394 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3395 mean += depth; 3396 squared_mean += depth * depth; 3397 #endif 3398 } 3399 mean = mean / samples; 3400 squared_mean = squared_mean / samples; 3401 float std_dev = sqrt( squared_mean - mean * mean ); 3402 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3403}`;function ff(i,e,t){let n=new Qr;const r=new Oe,s=new Oe,o=new Ve,a=new cf({depthPacking:_l}),u=new uf,l={},c=t.maxTextureSize,d={[an]:pt,[pt]:an,[Zt]:Zt},f=new Tn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:hf,fragmentShader:df}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const _=new Nt;_.setAttribute("position",new Gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new At(_,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Va;let h=this.type;this.render=function(T,A,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const k=i.getRenderTarget(),x=i.getActiveCubeFace(),b=i.getActiveMipmapLevel(),q=i.state;q.setBlending(sn),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const Z=h!==Kt&&this.type===Kt,I=h===Kt&&this.type!==Kt;for(let z=0,G=T.length;z<G;z++){const ee=T[z],X=ee.shadow;if(X===void 0){console.warn("THREE.WebGLShadowMap:",ee,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;r.copy(X.mapSize);const W=X.getFrameExtents();if(r.multiply(W),s.copy(X.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/W.x),r.x=s.x*W.x,X.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/W.y),r.y=s.y*W.y,X.mapSize.y=s.y)),X.map===null||Z===!0||I===!0){const J=this.type!==Kt?{minFilter:ut,magFilter:ut}:{};X.map!==null&&X.map.dispose(),X.map=new yn(r.x,r.y,J),X.map.texture.name=ee.name+".shadowMap",X.camera.updateProjectionMatrix()}i.setRenderTarget(X.map),i.clear();const Y=X.getViewportCount();for(let J=0;J<Y;J++){const he=X.getViewport(J);o.set(s.x*he.x,s.y*he.y,s.x*he.z,s.y*he.w),q.viewport(o),X.updateMatrices(ee,J),n=X.getFrustum(),R(A,P,X.camera,ee,this.type)}X.isPointLightShadow!==!0&&this.type===Kt&&y(X,P),X.needsUpdate=!1}h=this.type,m.needsUpdate=!1,i.setRenderTarget(k,x,b)};function y(T,A){const P=e.update(g);f.defines.VSM_SAMPLES!==T.blurSamples&&(f.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new yn(r.x,r.y)),f.uniforms.shadow_pass.value=T.map.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(A,null,P,f,g,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(A,null,P,p,g,null)}function M(T,A,P,k){let x=null;const b=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(b!==void 0)x=b;else if(x=P.isPointLight===!0?u:a,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const q=x.uuid,Z=A.uuid;let I=l[q];I===void 0&&(I={},l[q]=I);let z=I[Z];z===void 0&&(z=x.clone(),I[Z]=z),x=z}if(x.visible=A.visible,x.wireframe=A.wireframe,k===Kt?x.side=A.shadowSide!==null?A.shadowSide:A.side:x.side=A.shadowSide!==null?A.shadowSide:d[A.side],x.alphaMap=A.alphaMap,x.alphaTest=A.alphaTest,x.map=A.map,x.clipShadows=A.clipSh
3403adows,x.clippingPlanes=A.clippingPlanes,x.clipIntersection=A.clipIntersection,x.displacementMap=A.displacementMap,x.displacementScale=A.displacementScale,x.displacementBias=A.displacementBias,x.wireframeLinewidth=A.wireframeLinewidth,x.linewidth=A.linewidth,P.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const q=i.properties.get(x);q.light=P}return x}function R(T,A,P,k,x){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&x===Kt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const Z=e.update(T),I=T.material;if(Array.isArray(I)){const z=Z.groups;for(let G=0,ee=z.length;G<ee;G++){const X=z[G],W=I[X.materialIndex];if(W&&W.visible){const Y=M(T,W,k,x);i.renderBufferDirect(P,null,Z,Y,T,X)}}}else if(I.visible){const z=M(T,I,k,x);i.renderBufferDirect(P,null,Z,z,T,null)}}const q=T.children;for(let Z=0,I=q.length;Z<I;Z++)R(q[Z],A,P,k,x)}}function pf(i,e,t){const n=t.isWebGL2;function r(){let w=!1;const O=new Ve;let K=null;const ae=new Ve(0,0,0,0);return{setMask:function(ue){K!==ue&&!w&&(i.colorMask(ue,ue,ue,ue),K=ue)},setLocked:function(ue){w=ue},setClear:function(ue,Ge,He,it,Qt){Qt===!0&&(ue*=it,Ge*=it,He*=it),O.set(ue,Ge,He,it),ae.equals(O)===!1&&(i.clearColor(ue,Ge,He,it),ae.copy(O))},reset:function(){w=!1,K=null,ae.set(-1,0,0,0)}}}function s(){let w=!1,O=null,K=null,ae=null;return{setTest:function(ue){ue?C(i.DEPTH_TEST):ye(i.DEPTH_TEST)},setMask:function(ue){O!==ue&&!w&&(i.depthMask(ue),O=ue)},setFunc:function(ue){if(K!==ue){switch(ue){case zo:i.depthFunc(i.NEVER);break;case Go:i.depthFunc(i.ALWAYS);break;case Ho:i.depthFunc(i.LESS);break;case Or:i.depthFunc(i.LEQUAL);break;case Vo:i.depthFunc(i.EQUAL);break;case ko:i.depthFunc(i.GEQUAL);break;case Wo:i.depthFunc(i.GREATER);break;case Xo:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=ue}},setLocked:function(ue){w=ue},setClear:function(ue){ae!==ue&&(i.clearDepth(ue),ae=ue)},reset:function(){w=!1,O=null,K=null,ae=null}}}function o(){let w=!1,O=null,K=null,ae=null,ue=null,Ge=null,He=null,it=null,Qt=null;return{setTest:function(qe){w||(qe?C(i.STENCIL_TEST):ye(i.STENCIL_TEST))},setMask:function(qe){O!==qe&&!w&&(i.stencilMask(qe),O=qe)},setFunc:function(qe,St,Ft){(K!==qe||ae!==St||ue!==Ft)&&(i.stencilFunc(qe,St,Ft),K=qe,ae=St,ue=Ft)},setOp:function(qe,St,Ft){(Ge!==qe||He!==St||it!==Ft)&&(i.stencilOp(qe,St,Ft),Ge=qe,He=St,it=Ft)},setLocked:function(qe){w=qe},setClear:function(qe){Qt!==qe&&(i.clearStencil(qe),Qt=qe)},reset:function(){w=!1,O=null,K=null,ae=null,ue=null,Ge=null,He=null,it=null,Qt=null}}}const a=new r,u=new s,l=new o,c=new WeakMap,d=new WeakMap;let f={},p={},_=new WeakMap,g=[],m=null,h=!1,y=null,M=null,R=null,T=null,A=null,P=null,k=null,x=!1,b=null,q=null,Z=null,I=null,z=null;const G=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ee=!1,X=0;const W=i.getParameter(i.VERSION);W.indexOf("WebGL")!==-1?(X=parseFloat(/^WebGL (\d)/.exec(W)[1]),ee=X>=1):W.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),ee=X>=2);let Y=null,J={};const he=i.getParameter(i.SCISSOR_BOX),oe=i.getParameter(i.VIEWPORT),F=new Ve().fromArray(he),j=new Ve().fromArray(oe);function ie(w,O,K,ae){const ue=new Uint8Array(4),Ge=i.createTexture();i.bindTexture(w,Ge),i.texParameteri(w,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(w,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let He=0;He<K;He++)n&&(w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY)?i.texImage3D(O,0,i.RGBA,1,1,ae,0,i.RGBA,i.UNSIGNED_BYTE,ue):i.texImage2D(O+He,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,ue);return Ge}const se={};se[i.TEXTURE_2D]=ie(i.TEXTURE_2D,i.TEXTURE_2D,1),se[i.TEXTURE_CUBE_MAP]=ie(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(se[i.TEXTURE_2D_ARRAY]=ie(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),se[i.TEXTURE_3D]=ie(i.TEXTURE_3D,i.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),u.setClear(1),l.setClear(0),C(i.DEPTH_TEST),u.setFunc(Or),nt(!1),Qe(ss),C(i.CULL_FACE),Ce(sn);function C(w){f[w]!==!0&&(i.enable(w),f[w]=!0)}function ye(w){f[w]!==!1&&(i.disable(w),f[w]=!1)}function Se(w,O){return p[w]!==O?(i.bindFramebuffer(w,O),p[w]=O,n&&(w===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=O),w===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=O)),!0):!1}function ne(w,O){let K=g,ae=!1;if(w)if(K=_.get(O),K===void 0&&(K=[],_.set(O,K)),w.isWebGLMultipleRenderTargets){const ue=w.texture;if(K.length!==ue.length||K[0]!==i.COLOR_ATTACHMENT0){for(let Ge=0,He=ue.length;Ge<He;Ge++)K[Ge]=i.COLOR_ATTACHMENT0+Ge;K.length=ue.length,ae=!0}}else K[0]!==i.COLOR_ATTACHMENT0&&(K[0]=i.COLOR_ATTACHMENT0,ae=!0);else K[0]!==i.BACK&&(K[0]=i.BACK,ae=!0);ae&&(t.isWebGL2?i.drawBuffers(K):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(K))}function xe(w){return m!==w?(i.useProgram(w),m=w,!0):!1}const Ne={[Hn]:i.FUNC_ADD,[Ro]:i.FUNC_SUBTRACT,[Co]:i.FUNC_REVERSE_SUBTRACT};if(n)Ne[cs]=i.MIN,Ne[us]=i.MAX;else{const w=e.get("EXT_blend_minmax");w!==null&&(Ne[cs]=w.MIN_EXT,Ne[us]=w.MAX_EXT)}const pe={[Lo]:i.ZERO,[Po]:i.ONE,[Uo]:i.SRC_COLOR,[ka]:i.SRC_ALPHA,[Bo]:i.SRC_ALPHA_SATURATE,[Fo]:i.DST_COLOR,[Io]:i.DST_ALPHA,[Do]:i.ONE_MINUS_SRC_COLOR,[Wa]:i.ONE_MINUS_SRC_ALPHA,[Oo]:i.ONE_MINUS_DST_COLOR,[No]:i.ONE_MINUS_DST_ALPHA};function Ce(w,O,K,ae,ue,Ge,He,it){if(w===sn){h===!0&&(ye(i.BLEND),h=!1);return}
vendor: 4,401 bytes, line 3403
3403if(h===!1&&(C(i.BLEND),h=!0),w!==wo){if(w!==y||it!==x){if((M!==Hn||A!==Hn)&&(i.blendEquation(i.FUNC_ADD),M=Hn,A=Hn),it)switch(w){case Wn:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case as:i.blendFunc(i.ONE,i.ONE);break;case os:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ls:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",w);break}else switch(w){case Wn:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case as:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case os:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ls:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",w);break}R=null,T=null,P=null,k=null,y=w,x=it}return}ue=ue||O,Ge=Ge||K,He=He||ae,(O!==M||ue!==A)&&(i.blendEquationSeparate(Ne[O],Ne[ue]),M=O,A=ue),(K!==R||ae!==T||Ge!==P||He!==k)&&(i.blendFuncSeparate(pe[K],pe[ae],pe[Ge],pe[He]),R=K,T=ae,P=Ge,k=He),y=w,x=!1}function Je(w,O){w.side===Zt?ye(i.CULL_FACE):C(i.CULL_FACE);let K=w.side===pt;O&&(K=!K),nt(K),w.blending===Wn&&w.transparent===!1?Ce(sn):Ce(w.blending,w.blendEquation,w.blendSrc,w.blendDst,w.blendEquationAlpha,w.blendSrcAlpha,w.blendDstAlpha,w.premultipliedAlpha),u.setFunc(w.depthFunc),u.setTest(w.depthTest),u.setMask(w.depthWrite),a.setMask(w.colorWrite);const ae=w.stencilWrite;l.setTest(ae),ae&&(l.setMask(w.stencilWriteMask),l.setFunc(w.stencilFunc,w.stencilRef,w.stencilFuncMask),l.setOp(w.stencilFail,w.stencilZFail,w.stencilZPass)),Fe(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits),w.alphaToCoverage===!0?C(i.SAMPLE_ALPHA_TO_COVERAGE):ye(i.SAMPLE_ALPHA_TO_COVERAGE)}function nt(w){b!==w&&(w?i.frontFace(i.CW):i.frontFace(i.CCW),b=w)}function Qe(w){w!==To?(C(i.CULL_FACE),w!==q&&(w===ss?i.cullFace(i.BACK):w===bo?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ye(i.CULL_FACE),q=w}function Ke(w){w!==Z&&(ee&&i.lineWidth(w),Z=w)}function Fe(w,O,K){w?(C(i.POLYGON_OFFSET_FILL),(I!==O||z!==K)&&(i.polygonOffset(O,K),I=O,z=K)):ye(i.POLYGON_OFFSET_FILL)}function ke(w){w?C(i.SCISSOR_TEST):ye(i.SCISSOR_TEST)}function dt(w){w===void 0&&(w=i.TEXTURE0+G-1),Y!==w&&(i.activeTexture(w),Y=w)}function E(w,O,K){K===void 0&&(Y===null?K=i.TEXTURE0+G-1:K=Y);let ae=J[K];ae===void 0&&(ae={type:void 0,texture:void 0},J[K]=ae),(ae.type!==w||ae.texture!==O)&&(Y!==K&&(i.activeTexture(K),Y=K),i.bindTexture(w,O||se[w]),ae.type=w,ae.texture=O)}function v(){const w=J[Y];w!==void 0&&w.type!==void 0&&(i.bindTexture(w.type,null),w.type=void 0,w.texture=void 0)}function N(){try{i.compressedTexImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function $(){try{i.compressedTexImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function Q(){try{i.texSubImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function re(){try{i.texSubImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function Me(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function ce(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function H(){try{i.texStorage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function de(){try{i.texStorage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function me(){try{i.texImage2D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function ge(){try{i.texImage3D.apply(i,arguments)}catch(w){console.error("THREE.WebGLState:",w)}}function le(w){F.equals(w)===!1&&(i.scissor(w.x,w.y,w.z,w.w),F.copy(w))}function fe(w){j.equals(w)===!1&&(i.viewport(w.x,w.y,w.z,w.w),j.copy(w))}function Ue(w,O){let K=d.get(O);K===void 0&&(K=new WeakMap,d.set(O,K));let ae=K.get(w);ae===void 0&&(ae=i.getUniformBlockIndex(O,w.name),K.set(w,ae))}function Be(w,O){const ae=d.get(O).get(w);c.get(O)!==ae&&(i.uniformBlockBinding(O,ae,w.__bindingPointIndex),c.set(O,ae))}function Xe(){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.colorMask(!0,!0,
3403!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),n===!0&&(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),f={},Y=null,J={},p={},_=new WeakMap,g=[],m=null,h=!1,y=null,M=null,R=null,T=null,A=null,P=null,k=null,x=!1,b=null,q=null,Z=null,I=null,z=null,F.set(0,0,i.canvas.width,i.canvas.height),j.set(0,0,i.canvas.width,i.canvas.height),a.reset(),u.reset(),l.reset()}return{buffers:{color:a,depth:u,stencil:l},enable:C,disable:ye,bindFramebuffer:Se,drawBuffers:ne,useProgram:xe,setBlending:Ce,setMaterial:Je,setFlipSided:nt,setCullFace:Qe,setLineWidth:Ke,setPolygonOffset:Fe,setScissorTest:ke,activeTexture:dt,bindTexture:E,unbindTexture:v,compressedTexImage2D:N,compressedTexImage3D:$,texImage2D:me,texImage3D:ge,updateUBOMapping:Ue,uniformBlockBinding:Be,texStorage2D:H,texStorage3D:de,texSubImage2D:Q,texSubImage3D:re,compressedTexSubImage2D:Me,compressedTexSubImage3D:ce,scissor:le,viewport:fe,reset:Xe}}function mf(i,e,t,n,r,s,o){const a=r.isWebGL2,u=r.maxTextures,l=r.maxCubemapSize,c=r.maxTextureSize,d=r.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let g;const m=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(E,v){return h?new OffscreenCanvas(E,v):Yi("canvas")}function M(E,v,N,$){let Q=1;if((E.width>$||E.height>$)&&(Q=$/Math.max(E.width,E.height)),Q<1||v===!0)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap){const re=v?Ml:Math.floor,Me=re(Q*E.width),ce=re(Q*E.height);g===void 0&&(g=y(Me,ce));const H=N?y(Me,ce):g;return H.width=Me,H.height=ce,H.getContext("2d").drawImage(E,0,0,Me,ce),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+E.width+"x"+E.height+") to ("+Me+"x"+ce+")."),H}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+E.width+"x"+E.height+")."),E;return E}function R(E){return Os(E.width)&&Os(E.height)}function T(E){return a?!1:E.wrapS!==Dt||E.wrapT!==Dt||E.minFilter!==ut&&E.minFilter!==bt}function A(E,v){return E.generateMipmaps&&v&&E.minFilter!==ut&&E.minFilter!==bt}function P(E){i.generateMipmap(E)}function k(E,v,N,$,Q=!1){if(a===!1)return v;if(E!==null){if(i[E]!==void 0)return i[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let re=v;return v===i.RED&&(N===i.FLOAT&&(re=i.R32F),N===i.HALF_FLOAT&&(re=i.R16F),N===i.UNSIGNED_BYTE&&(re=i.R8)),v===i.RG&&(N===i.FLOAT&&(re=i.RG32F),N===i.HALF_FLOAT&&(re=i.RG16F),N===i.UNSIGNED_BYTE&&(re=i.RG8)),v===i.RGBA&&(N===i.FLOAT&&(re=i.RGBA32F),N===i.HALF_FLOAT&&(re=i.RGBA16F),N===i.UNSIGNED_BYTE&&(re=$===Te&&Q===!1?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT_4_4_4_4&&(re=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(re=i.RGB5_A1)),(re===i.R16F||re===i.R32F||re===i.RG16F||re===i.RG32F||re===i.RGBA16F||re===i.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function x(E,v,N){return A(E,N)===!0||E.isFramebufferTexture&&E.minFilter!==ut&&E.minFilter!==bt?Math.log2(Math.max(v.width,v.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?v.mipmaps.length:1}function b(E){return E===ut||E===hs||E===nr?i.NEAREST:i.LINEAR}function q(E){const v=E.target;v.removeEventListener("dispose",q),I(v),v.isVideoTexture&&_.delete(v)}function Z(E){const v=E.target;v.removeEventListener("dispose",Z),G(v)}function I(E){const v=n.get(E);if(v.__webglInit===void 0)return;const N=E.source,$=m.get(N);if($){const Q=$[v.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&z(E),Object.keys($).length===0&&m.delete(N)}n.remove(E)}function z(E){const v=n.get(E);i.deleteTexture(v.__webglTexture);const N=E.source,$=m.get(N);delete $[v.__cacheKey],o.memory.textures--}function G(E){const v=E.texture,N=n.get(E),$=n.get(v);if($.__webglTexture!==void 0&&(i.deleteTexture($.__webglTexture),o.memory.textures--),E.depthTexture&&E.depthTexture.dispose(),E.isWebGLCubeRen
3403derTarget)for(let Q=0;Q<6;Q++)i.deleteFramebuffer(N.__webglFramebuffer[Q]),N.__webglDepthbuffer&&i.deleteRenderbuffer(N.__webglDepthbuffer[Q]);else{if(i.deleteFramebuffer(N.__webglFramebuffer),N.__webglDepthbuffer&&i.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&i.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let Q=0;Q<N.__webglColorRenderbuffer.length;Q++)N.__webglColorRenderbuffer[Q]&&i.deleteRenderbuffer(N.__webglColorRenderbuffer[Q]);N.__webglDepthRenderbuffer&&i.deleteRenderbuffer(N.__webglDepthRenderbuffer)}if(E.isWebGLMultipleRenderTargets)for(let Q=0,re=v.length;Q<re;Q++){const Me=n.get(v[Q]);Me.__webglTexture&&(i.deleteTexture(Me.__webglTexture),o.memory.textures--),n.remove(v[Q])}n.remove(v),n.remove(E)}let ee=0;function X(){ee=0}function W(){const E=ee;return E>=u&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+u),ee+=1,E}function Y(E){const v=[];return v.push(E.wrapS),v.push(E.wrapT),v.push(E.wrapR||0),v.push(E.magFilter),v.push(E.minFilter),v.push(E.anisotropy),v.push(E.internalFormat),v.push(E.format),v.push(E.type),v.push(E.generateMipmaps),v.push(E.premultiplyAlpha),v.push(E.flipY),v.push(E.unpackAlignment),v.push(E.colorSpace),v.join()}function J(E,v){const N=n.get(E);if(E.isVideoTexture&&ke(E),E.isRenderTargetTexture===!1&&E.version>0&&N.__version!==E.version){const $=E.image;if($===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ye(N,E,v);return}}t.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+v)}function he(E,v){const N=n.get(E);if(E.version>0&&N.__version!==E.version){ye(N,E,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+v)}function oe(E,v){const N=n.get(E);if(E.version>0&&N.__version!==E.version){ye(N,E,v);return}t.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+v)}function F(E,v){const N=n.get(E);if(E.version>0&&N.__version!==E.version){Se(N,E,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+v)}const j={[Gr]:i.REPEAT,[Dt]:i.CLAMP_TO_EDGE,[Hr]:i.MIRRORED_REPEAT},ie={[ut]:i.NEAREST,[hs]:i.NEAREST_MIPMAP_NEAREST,[nr]:i.NEAREST_MIPMAP_LINEAR,[bt]:i.LINEAR,[Qo]:i.LINEAR_MIPMAP_NEAREST,[li]:i.LINEAR_MIPMAP_LINEAR};function se(E,v,N){if(N?(i.texParameteri(E,i.TEXTURE_WRAP_S,j[v.wrapS]),i.texParameteri(E,i.TEXTURE_WRAP_T,j[v.wrapT]),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,j[v.wrapR]),i.texParameteri(E,i.TEXTURE_MAG_FILTER,ie[v.magFilter]),i.texParameteri(E,i.TEXTURE_MIN_FILTER,ie[v.minFilter])):(i.texParameteri(E,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(E,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),(E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY)&&i.texParameteri(E,i.TEXTURE_WRAP_R,i.CLAMP_TO_EDGE),(v.wrapS!==Dt||v.wrapT!==Dt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(E,i.TEXTURE_MAG_FILTER,b(v.magFilter)),i.texParameteri(E,i.TEXTURE_MIN_FILTER,b(v.minFilter)),v.minFilter!==ut&&v.minFilter!==bt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const $=e.get("EXT_texture_filter_anisotropic");if(v.magFilter===ut||v.minFilter!==nr&&v.minFilter!==li||v.type===vn&&e.has("OES_texture_float_linear")===!1||a===!1&&v.type===ci&&e.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||n.get(v).__currentAnisotropy)&&(i.texParameterf(E,$.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy)}}function C(E,v){let N=!1;E.__webglInit===void 0&&(E.__webglInit=!0,v.addEventListener("dispose",q));const $=v.source;let Q=m.get($);Q===void 0&&(Q={},m.set($,Q));const re=Y(v);if(re!==E.__cacheKey){Q[re]===void 0&&(Q[re]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,N=!0),Q[re].usedTimes++;const Me=Q[E.__cacheKey];Me!==void 0&&(Q[E.__cacheKey].usedTimes--,Me.usedTimes===0&&z(v)),E.__cacheKey=re,E.__webglTexture=Q[re].texture}return N}function ye(E,v,N){let $=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&($=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&($=i.TEXTURE_3D);const Q=C(E,v),re=v.source;t.bindTexture($,E.__webglTexture,i.TEXTURE0+N);const Me=n.get(re);if(re.version!==Me.__version||Q===!0){t.activeTexture(i.TEXTURE0+N),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const ce=T(v)&&R(v.image)===!1;let H=M(v.image,ce,!1,c);H=dt(v,H);const de=R(H)||a,me=s.convert(v.format,v.colorSpace);let ge=s.convert(v.type),le=k(v.internalFormat,me,ge,v.colorSpace);se($,v,de);let fe;const Ue=v.mipmaps,Be=a&&v.isVideoTexture!==!0,Xe=Me.__version===void 0||Q===!0,w=x(v,H,de);if(v.isDepthTexture)le=i.DEPTH_COMPONENT,a?v.type===vn?le=i.DEPTH_COMPONENT32F:v.type===gn?le=i.DEPTH_COMPONENT24:v.type===Xn?le=i.DEPTH24_STENCIL8:le=i.DEPTH_COMPONENT16:v.type===vn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===xn&&le===i.DEPTH_COMPONENT&&v.type!==qa&&v.type!==gn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=gn,ge=s.convert(v.type)),v.format===Kn&&le===i.DEPTH_COMPONENT&&(le=i.DEPTH_STENCIL,v.type!==Xn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=Xn,ge=s.convert(v.type))),Xe&&(Be?t.texStorage2D(i.TEXTURE_2D,1,le,H.width,H.height):t.texImage2D(i.TEXTURE_2D,0,le,H.width,H.height,0,me,ge,null));else if(v.isDataTexture)if(Ue.length>0&&de){Be&&Xe&&t.texStorage2D(i.TEXTURE_2D,w,le,Ue[0].width,Ue[0].height);for(let O=0,K=Ue.length;O<K;O++)fe=Ue[O],Be?t.texSubImage2D(i.TEXTURE_2D,O,0,0,fe.width,fe.height,me,ge,fe.data):t.texImage2D(i.TEXTURE_2D,O,le,fe.width,fe.height,0,me,ge,fe.data);v.generateMipmaps=!1}else Be?(Xe&&t.texStorage2D(i.TEXTURE_2D,w,le,H.width,H.height),t.texSubImage2D(i.TEXTURE_2D,0,0,0,H.width,H.height,me,ge,H.data)):t.texImage2D(i.TEXTURE_2D,0,le,H.width,H.height,0,me,ge,H.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Be&&Xe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,w,le,Ue[0].width,Ue[0].height,H.depth);for(let O=0,K=Ue.length;O<K;O++)fe=Ue[O],v.format!==It?me!==null?Be?t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,fe.width,fe.height,H.depth,me,fe.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,O,le,fe.width,fe.height,H.depth,0,fe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Be?t.texSubImage3D(i.TEXTURE_2D_ARRAY,O,0,0,0,fe.width,fe.height,H.depth,me,ge,fe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,O,le,fe.width,fe.height,H.depth,0,me,ge,fe.data)}else{Be&&Xe&&t.texStorage2D(i.TEXTURE_2D,w,le,Ue[0].width,Ue[0].height);for(let O=0,K=Ue.length;O<K;O++)fe=Ue[O],v.format!==It?me!==null?Be?t.compressedTexSubImage2D(i.TEXTURE_2D,O,0,0,fe.width,fe.height,me,fe.data):t.compressedTexImage2D(i.TEXTURE_2D,O,le,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Be?t.texSubImage2D(i.TEXTURE_2D,O,0,0,fe.width,fe.height,me,ge,fe.data):t.texImage2D(i.TEXTURE_2D,O,le,fe.width,fe.height,0,me,ge,fe.data)}else if(v.isDataArrayTexture)Be?(Xe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,w,le,H.width,H.height,H.depth),t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,H.width,H.height,H.depth,me,ge,H.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,le,H.width,H.height,H.depth,0,me,ge,H.data);else if(v.isData3DTexture)Be?(Xe&&t.texStorage3D(i.TEXTURE_3D,w,le,H.width,H.height,H.depth),t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,H.width,H.height,H.depth,me,ge,H.data)):t.texImage3D(i.TEXTURE_3D,0,le,H.width,H.height,H.depth,0,me,ge,H.data);else if(v.isFramebufferTexture){if(Xe)if(Be)t.texStorage2D(i.TEXTURE_2D,w,le,H.width,H.height);else{let O=H.width,K=H.height;for(let ae=0;ae<w;ae++)t.texImage2D(i.TEXTURE_2D,ae,le,O,K,0,me,ge,null),O>>=1,K>>=1}}else if(Ue.length>0&&de){Be&&Xe&&t.texStorage2D(i.TEXTURE_2D,w,le,Ue[0].width,Ue[0].height);for(let O=0,K=Ue.length;O<K;O++)fe=Ue[O],Be?t.texSubImage2D(i.TEXTURE_2D,O,0,0,me,ge,fe):t.texImage2D(i.TEXTURE_2D,O,le,me,ge,fe);v.generateMipmaps=!1}else Be?(Xe&&t.texStorage2D(i.TEXTURE_2D,w,le,H.width,H.height),t.texSubImage2D(i.TEXTURE_2D,0,0,0,me,ge,H)):t.texImage2D(i.TEXTURE_2D,0,le,me,ge,H);A(v,de)&&P($),Me.__version=re.version,v.onUpdate&&v.onUpdate(v)}E.__version=v.version}function Se(E,v,N){if(v.image.length!==6)return;const $=C(E,v),Q=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,E.__webglTexture,i.TEXTURE0+N);const re=n.get(Q);if(Q.version!==re.__version||$===!0){t.activeTexture(i.TEXTURE0+N),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);const Me=v.isCompressedTexture||v.image[0].isCompressedTexture,ce=v.image[0]&&v.image[0].isDataTexture,H=[];for(let O=0;O<6;O++)!Me&&!ce?H[O]=M(v.image[O],!1,!0,l):H[O]=ce?v.image[O].image:v.image[O],H[O]=dt(v,H[O]);const de=H[0],me=R(de)||a,ge=s.convert(v.format,v.colorSpace),le=s.convert(v.type),fe=k(v.internalFormat,ge,le,v.colorSpace),Ue=a&&v.isVideoTexture!==!0,Be=re.__version===void 0||$===!0;let Xe=x(v,de,me);se(i.TEXTURE_CUBE_MAP,v,me);let w;if(Me){Ue&&Be&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Xe,fe,de.width,de.height);for(let O=0;O<6;O++){w=H[O].mipmaps;for(let K=0;K<w.length;K++){const ae=w[K];v.format!==It?ge!==null?Ue?t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K,0,0,ae.width,ae.height,ge,ae.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K,fe,ae.width,ae.height,0,ae.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ue?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K,0,0,ae.width,ae.height,ge,le,ae.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K,fe,ae.width,ae.height,0,ge,le,ae.data)}}}else{w=v.mipmaps,Ue&&Be&&(w.length>0&&Xe++,t.texStorage2D(i.TEXTURE_CUBE_MAP,Xe,fe,H[0].width,H[0].height));for(let O=0;O<6;O++)if(ce){Ue?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,0,0,H[O].width,H[O].height,ge,le,H[O].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,fe,H[O].width,H[O].height,0,ge,le,H[O].data);for(let K=0;K<w.length;K++){const ue=w[K].image[O].image;Ue?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K+1,0,0,ue.width,ue.height,ge,le,ue.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K+1,fe,ue.width,ue.height,0,ge,le,ue.data)}}else{Ue?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,0,0,ge,le,H[O]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,0,fe,ge,le,H[O]);for(let K=0;K<w.length;K++){const ae=w[K];Ue?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K+1,0,0,ge,le,ae.image[O]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+O,K+1,fe,ge,le,ae.image[O])}}}A(v,me)&&P(i.TEXTURE_CUBE_MAP),re.__version=Q.version,v.onUpdate&&v.onUpdate(v)}E.__version=v.version}function ne(E,v,N,$,Q){const re=s.convert(N.format,N.colorSpace),Me=s.convert(N.type),ce=k(N.internalFormat,re,Me,N.colorSpace);n.get(v).__hasExternalTextures||(Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY?t.texImage3D(Q,0,ce,v.width,v.height,v.depth,0,re,Me,null):t.texImage2D(Q,0,ce,v.width,v.height,0,re,Me,null)),t.bindFramebuffer(i.FRAMEBUFFER,E),Fe(v)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$,Q,n.get(N).__webglTexture,0,Ke(v)):(Q===i.TEXTURE_2D||Q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,$,Q,n.get(N).__webglTexture,0),t.bindFramebuffer(i.FRAMEBUFFER,null)}function xe(E,v,N){if(i.bindRenderbuffer(i.RENDERBUFFER,E),v.depthBuffer&&!v.stencilBuffer){let $=i.DEPTH_COMPONENT16;if(N||Fe(v)){const Q=v.depthTexture;Q&&Q.isDepthTexture&&(Q.type===vn?$=i.DEPTH_COMPONENT32F:Q.type===gn&&($=i.DEPTH_COMPONENT24));const re=Ke(v);Fe(v)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,re,$,v.width,v.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,re,$,v.width,v.height)}else i.renderbufferStorage(i.RENDERBUFFER,$,v.width,v.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,E)}else if(v.depthBuffer&&v.stencilBuffer){const $=Ke(v);N&&Fe(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,$,i.DEPTH24_STENCIL8,v.width,v.height):Fe(v)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,$,i.DEPTH24_STENCIL8,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,E)}else{const $=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let Q=0;Q<$.length;Q++){const re=$[Q],Me=s.convert(re.format,re.colorSpace),ce=s.convert(re.type),H=k(re.internalFormat,Me,ce,re.colorSpace),de=Ke(v);N&&Fe(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,de,H,v.width,v.height):Fe(v)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,de,H,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,H,v.width,v.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}
3403function Ne(E,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,E),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(v.depthTexture).__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),J(v.depthTexture,0);const $=n.get(v.depthTexture).__webglTexture,Q=Ke(v);if(v.depthTexture.format===xn)Fe(v)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0,Q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,$,0);else if(v.depthTexture.format===Kn)Fe(v)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0,Q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function pe(E){const v=n.get(E),N=E.isWebGLCubeRenderTarget===!0;if(E.depthTexture&&!v.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");Ne(v.__webglFramebuffer,E)}else if(N){v.__webglDepthbuffer=[];for(let $=0;$<6;$++)t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[$]),v.__webglDepthbuffer[$]=i.createRenderbuffer(),xe(v.__webglDepthbuffer[$],E,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer=i.createRenderbuffer(),xe(v.__webglDepthbuffer,E,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ce(E,v,N){const $=n.get(E);v!==void 0&&ne($.__webglFramebuffer,E,E.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D),N!==void 0&&pe(E)}function Je(E){const v=E.texture,N=n.get(E),$=n.get(v);E.addEventListener("dispose",Z),E.isWebGLMultipleRenderTargets!==!0&&($.__webglTexture===void 0&&($.__webglTexture=i.createTexture()),$.__version=v.version,o.memory.textures++);const Q=E.isWebGLCubeRenderTarget===!0,re=E.isWebGLMultipleRenderTargets===!0,Me=R(E)||a;if(Q){N.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)N.__webglFramebuffer[ce]=i.createFramebuffer()}else{if(N.__webglFramebuffer=i.createFramebuffer(),re)if(r.drawBuffers){const ce=E.texture;for(let H=0,de=ce.length;H<de;H++){const me=n.get(ce[H]);me.__webglTexture===void 0&&(me.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&E.samples>0&&Fe(E)===!1){const ce=re?v:[v];N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let H=0;H<ce.length;H++){const de=ce[H];N.__webglColorRenderbuffer[H]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[H]);const me=s.convert(de.format,de.colorSpace),ge=s.convert(de.type),le=k(de.internalFormat,me,ge,de.colorSpace,E.isXRRenderTarget===!0),fe=Ke(E);i.renderbufferStorageMultisample(i.RENDERBUFFER,fe,le,E.width,E.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+H,i.RENDERBUFFER,N.__webglColorRenderbuffer[H])}i.bindRenderbuffer(i.RENDERBUFFER,null),E.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),xe(N.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Q){t.bindTexture(i.TEXTURE_CUBE_MAP,$.__webglTexture),se(i.TEXTURE_CUBE_MAP,v,Me);for(let ce=0;ce<6;ce++)ne(N.__webglFramebuffer[ce],E,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ce);A(v,Me)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(re){const ce=E.texture;for(let H=0,de=ce.length;H<de;H++){const me=ce[H],ge=n.get(me);t.bindTexture(i.TEXTURE_2D,ge.__webglTexture),se(i.TEXTURE_2D,me,Me),ne(N.__webglFramebuffer,E,me,i.COLOR_ATTACHMENT0+H,i.TEXTURE_2D),A(me,Me)&&P(i.TEXTURE_2D)}t.unbindTexture()}else{let ce=i.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(a?ce=E.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ce,$.__webglTexture),se(ce,v,Me),ne(N.__webglFramebuffer,E,v,i.COLOR_ATTACHMENT0,ce),A(v,Me)&&P(ce),t.unbindTexture()}E.depthBuffer&&pe(E)}
3403function nt(E){const v=R(E)||a,N=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let $=0,Q=N.length;$<Q;$++){const re=N[$];if(A(re,v)){const Me=E.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,ce=n.get(re).__webglTexture;t.bindTexture(Me,ce),P(Me),t.unbindTexture()}}}function Qe(E){if(a&&E.samples>0&&Fe(E)===!1){const v=E.isWebGLMultipleRenderTargets?E.texture:[E.texture],N=E.width,$=E.height;let Q=i.COLOR_BUFFER_BIT;const re=[],Me=E.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ce=n.get(E),H=E.isWebGLMultipleRenderTargets===!0;if(H)for(let de=0;de<v.length;de++)t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let de=0;de<v.length;de++){re.push(i.COLOR_ATTACHMENT0+de),E.depthBuffer&&re.push(Me);const me=ce.__ignoreDepthValues!==void 0?ce.__ignoreDepthValues:!1;if(me===!1&&(E.depthBuffer&&(Q|=i.DEPTH_BUFFER_BIT),E.stencilBuffer&&(Q|=i.STENCIL_BUFFER_BIT)),H&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ce.__webglColorRenderbuffer[de]),me===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[Me]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Me])),H){const ge=n.get(v[de]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ge,0)}i.blitFramebuffer(0,0,N,$,0,0,N,$,Q,i.NEAREST),p&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,re)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),H)for(let de=0;de<v.length;de++){t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.RENDERBUFFER,ce.__webglColorRenderbuffer[de]);const me=n.get(v[de]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+de,i.TEXTURE_2D,me,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}}function Ke(E){return Math.min(d,E.samples)}function Fe(E){const v=n.get(E);return a&&E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ke(E){const v=o.render.frame;_.get(E)!==v&&(_.set(E,v),E.update())}function dt(E,v){const N=E.colorSpace,$=E.format,Q=E.type;return E.isCompressedTexture===!0||E.format===Vr||N!==Ht&&N!==Sn&&(N===Te?a===!1?e.has("EXT_sRGB")===!0&&$===It?(E.format=Vr,E.minFilter=bt,E.generateMipmaps=!1):v=$a.sRGBToLinear(v):($!==It||Q!==En)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),v}this.allocateTextureUnit=W,this.resetTextureUnits=X,this.setTexture2D=J,this.setTexture2DArray=he,this.setTexture3D=oe,this.setTextureCube=F,this.rebindTextures=Ce,this.setupRenderTarget=Je,this.updateRenderTargetMipmap=nt,this.updateMultisampleRenderTarget=Qe,this.setupDepthRenderbuffer=pe,this.setupFrameBufferTexture=ne,this.useMultisampledRTT=Fe}function _f(i,e,t){const n=t.isWebGL2;function r(s,o=Sn){let a;if(s===En)return i.UNSIGNED_BYTE;if(s===il)return i.UNSIGNED_SHORT_4_4_4_4;if(s===rl)return i.UNSIGNED_SHORT_5_5_5_1;if(s===el)return i.BYTE;if(s===tl)return i.SHORT;if(s===qa)return i.UNSIGNED_SHORT;if(s===nl)return i.INT;if(s===gn)return i.UNSIGNED_INT;if(s===vn)return i.FLOAT;if(s===ci)return n?i.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===sl)return i.ALPHA;if(s===It)return i.RGBA;if(s===al)return i.LUMINANCE;if(s===ol)return i.LUMINANCE_ALPHA;if(s===xn)return i.DEPTH_COMPONENT;if(s===Kn)return i.DEPTH_STENCIL;if(s===Vr)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ll)return i.RED;if(s===cl)return i.RED_INTEGER;if(s===ul)return i.RG;if(s===hl)return i.RG_INTEGER;if(s===dl)return i.RGBA_INTEGER;if(s===ir||s===rr||s===sr||s===ar)if(o===Te)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===ir)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===rr)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===sr)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ar)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===ir)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===rr)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===sr)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ar)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===ds||s===fs||s===ps||s===ms)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===ds)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===fs)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ps)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===ms)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===fl)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===_s||s===gs)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===_s)return o===Te?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===vs||s===xs||s===Ms||s===Ss||s===Es||s===ys||s===Ts||s===bs||s===As||s===ws||s===Rs||s===Cs||s===Ls||s===Ps)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===vs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===xs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Ms)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ss)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Es)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ys)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Ts)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===bs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===As)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===ws)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Rs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Cs)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Ls)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Ps)return o===Te?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===or)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===or)return o===Te?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===pl||s===Us||s===Ds||s===Is)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===or)return a.COMPRESSED_RED_RGT
vendor: 6,210 bytes, line 3403
3403C1_EXT;if(s===Us)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ds)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Is)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Xn?n?i.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:r}}class gf extends xt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class kn extends at{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vf={type:"move"};class Pr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new kn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new kn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new kn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),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,o=null;const a=this._targetRay,u=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),h=this._getHandJoint(l,g);m!==null&&(h.matrix.fromArray(m.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,h.jointRadius=m.radius),h.visible=m!==null}const c=l.joints["index-finger-tip"],d=l.joints["thumb-tip"],f=c.position.distanceTo(d.position),p=.02,_=.005;l.inputState.pinching&&f>p+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=p-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vf)))}return a!==null&&(a.visible=r!==null),u!==null&&(u.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new kn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class xf extends Mt{constructor(e,t,n,r,s,o,a,u,l,c){if(c=c!==void 0?c:xn,c!==xn&&c!==Kn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&c===xn&&(n=gn),n===void 0&&c===Kn&&(n=Xn),super(null,r,s,o,a,u,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:ut,this.minFilter=u!==void 0?u:ut,this.flipY=!1,this.generateMipmaps=!1}}class Mf extends $n{constructor(e,t){super();const n=this;let r=null,s=1,o=null,a="local-floor",u=1,l=null,c=null,d=null,f=null,p=null,_=null;const g=t.getContextAttributes();let m=null,h=null;const y=[],M=[],R=new Set,T=new Map,A=new xt;A.layers.enable(1),A.viewport=new Ve;const P=new xt;P.layers.enable(2),P.viewport=new Ve;const k=[A,P],x=new gf;x.layers.enable(1),x.layers.enable(2);let b=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let j=y[F];return j===void 0&&(j=new Pr,y[F]=j),j.getTargetRaySpace()},this.getControllerGrip=function(F){let j=y[F];return j===void 0&&(j=new Pr,y[F]=j),j.getGripSpace()},this.getHand=function(F){let j=y[F];return j===void 0&&(j=new Pr,y[F]=j),j.getHandSpace()};function Z(F){const j=M.indexOf(F.inputSource);if(j===-1)return;const ie=y[j];ie!==void 0&&(ie.update(F.inputSource,F.frame,l||o),ie.dispatchEvent({type:F.type,data:F.inputSource}))}function I(){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",I),r.removeEventListener("inputsourceschange",z);for(let F=0;F<y.length;F++){const j=M[F];j!==null&&(M[F]=null,y[F].disconnect(j))}b=null,q=null,e.setRenderTarget(m),p=null,f=null,d=null,r=null,h=null,oe.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){s=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){a=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(F){l=F},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return d},this.getFrame=function(){return _}
3403,this.getSession=function(){return r},this.setSession=async function(F){if(r=F,r!==null){if(m=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",I),r.addEventListener("inputsourceschange",z),g.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const j={antialias:r.renderState.layers===void 0?g.antialias:!0,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,j),r.updateRenderState({baseLayer:p}),h=new yn(p.framebufferWidth,p.framebufferHeight,{format:It,type:En,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let j=null,ie=null,se=null;g.depth&&(se=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,j=g.stencil?Kn:xn,ie=g.stencil?Xn:gn);const C={colorFormat:t.RGBA8,depthFormat:se,scaleFactor:s};d=new XRWebGLBinding(r,t),f=d.createProjectionLayer(C),r.updateRenderState({layers:[f]}),h=new yn(f.textureWidth,f.textureHeight,{format:It,type:En,depthTexture:new xf(f.textureWidth,f.textureHeight,ie,void 0,void 0,void 0,void 0,void 0,void 0,j),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0});const ye=e.properties.get(h);ye.__ignoreDepthValues=f.ignoreDepthValues}h.isXRRenderTarget=!0,this.setFoveation(u),l=null,o=await r.requestReferenceSpace(a),oe.setContext(r),oe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function z(F){for(let j=0;j<F.removed.length;j++){const ie=F.removed[j],se=M.indexOf(ie);se>=0&&(M[se]=null,y[se].disconnect(ie))}for(let j=0;j<F.added.length;j++){const ie=F.added[j];let se=M.indexOf(ie);if(se===-1){for(let ye=0;ye<y.length;ye++)if(ye>=M.length){M.push(ie),se=ye;break}else if(M[ye]===null){M[ye]=ie,se=ye;break}if(se===-1)break}const C=y[se];C&&C.connect(ie)}}const G=new L,ee=new L;function X(F,j,ie){G.setFromMatrixPosition(j.matrixWorld),ee.setFromMatrixPosition(ie.matrixWorld);const se=G.distanceTo(ee),C=j.projectionMatrix.elements,ye=ie.projectionMatrix.elements,Se=C[14]/(C[10]-1),ne=C[14]/(C[10]+1),xe=(C[9]+1)/C[5],Ne=(C[9]-1)/C[5],pe=(C[8]-1)/C[0],Ce=(ye[8]+1)/ye[0],Je=Se*pe,nt=Se*Ce,Qe=se/(-pe+Ce),Ke=Qe*-pe;j.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(Ke),F.translateZ(Qe),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert();const Fe=Se+Qe,ke=ne+Qe,dt=Je-Ke,E=nt+(se-Ke),v=xe*ne/ke*Fe,N=Ne*ne/ke*Fe;F.projectionMatrix.makePerspective(dt,E,v,N,Fe,ke),F.projectionMatrixInverse.copy(F.projectionMatrix).invert()}function W(F,j){j===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(j.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(r===null)return;x.near=P.near=A.near=F.near,x.far=P.far=A.far=F.far,(b!==x.near||q!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,q=x.far);const j=F.parent,ie=x.cameras;W(x,j);for(let se=0;se<ie.length;se++)W(ie[se],j);ie.length===2?X(x,A,P):x.projectionMatrix.copy(A.projectionMatrix),Y(F,x,j)};function Y(F,j,ie){ie===null?F.matrix.copy(j.matrixWorld):(F.matrix.copy(ie.matrixWorld),F.matrix.invert(),F.matrix.multiply(j.matrixWorld)),F.matrix.decompose(F.position,F.quaternion,F.scale),F.updateMatrixWorld(!0);const se=F.children;for(let C=0,ye=se.length;C<ye;C++)se[C].updateMatrixWorld(!0);F.projectionMatrix.copy(j.projectionMatrix),F.projectionMatrixInverse.copy(j.projectionMatrixInverse),F.isPerspectiveCamera&&(F.fov=kr*2*Math.atan(1/F.projectionMatrix.elements[5]),F.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&p===null))return u},this.setFoveation=function(F){u=F,f!==null&&(f.fixedFoveation=F),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=F)},this.getPlanes=function(){return R};let J=null;function he(F,j){if(c=j.getViewerPose(l||o),_=j,c!==null){const ie=c.views;p!==null&&(e.setRenderTargetFramebuffer(h,p.framebuffer),e.setRenderTarget(h));let se=!1;ie.length!==x.cameras.length&&(x.cameras.length=0,se=!0);for(let C=0;C<ie.length;C++){const ye=ie[C];let Se=null;if(p!==null)Se=p.getViewport(ye);else{const xe=d.getViewSubImage(f,ye);Se=xe.viewport,C===0&&(e.setRenderTargetTextures(h,xe.colorTexture,f.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(h))}let ne=k[C];ne===void 0&&(ne=new xt,ne.layers.enable(C),ne.viewport=new Ve,k[C]=ne),ne.matrix.fromArray(ye.transform.matrix),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.projectionMatrix.fromArray(ye.projectionMatrix),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert(),ne.viewport.set(Se.x,Se.y,Se.width,Se.height),C===0&&(x.matrix.copy(ne.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),se===!0&&x.cameras.push(ne)}}for(let ie=0;ie<y.length;ie++){const se=M[ie],C=y[ie];se!==null&&C!==void 0&&C.update(se,j,l||o)}if(J&&J(F,j),j.detectedPlanes){n.dispatchEvent({type:"planesdetected",data:j.detectedPlanes});let ie=null;for(const se of R)j.detectedPlanes.has(se)||(ie===null&&(ie=[]),ie.push(se));if(ie!==null)for(const se of ie)R.delete(se),T.delete(se),n.dispatchEvent({type:"planeremoved",data:se});for(const se of j.detectedPlanes)if(!R.has(se))R.add(se),T.set(se,j.lastChangedTime),n.dispatchEvent({type:"planeadded",data:se});else{const C=T.get(se);se.lastChangedTime>C&&(T.set(se,se.lastChangedTime),n.dispatchEvent({type:"planechanged",data:se}))}}_=null}const oe=new lo;oe.setAnimationLoop(he),this.setAnimationLoop=function(F){J=F},this.dispose=function(){}}}function Sf(i,e){function t(m,h){m.matrixAutoUpdate===!0&&m.updateMatrix(),h.value.copy(m.matrix)}function n(m,h){h.color.getRGB(m.fogColor.value,so(i)),h.isFog?(m.fogNear.value=h.near,m.fogFar.value=h.far):h.isFogExp2&&(m.fogDensity.value=h.density)}function r(m,h,y,M,R){h.isMeshBasicMaterial||h.isMeshLambertMaterial?s(m,h):h.isMeshToonMaterial?(s(m,h),d(m,h)):h.isMeshPhongMaterial?(s(m,h),c(m,h)):h.isMeshStandardMaterial?(s(m,h),f(m,h),h.isMeshPhysicalMaterial&&p(m,h,R)):h.isMeshMat
vendor: 4,116 bytes, line 3403
3403capMaterial?(s(m,h),_(m,h)):h.isMeshDepthMaterial?s(m,h):h.isMeshDistanceMaterial?(s(m,h),g(m,h)):h.isMeshNormalMaterial?s(m,h):h.isLineBasicMaterial?(o(m,h),h.isLineDashedMaterial&&a(m,h)):h.isPointsMaterial?u(m,h,y,M):h.isSpriteMaterial?l(m,h):h.isShadowMaterial?(m.color.value.copy(h.color),m.opacity.value=h.opacity):h.isShaderMaterial&&(h.uniformsNeedUpdate=!1)}function s(m,h){m.opacity.value=h.opacity,h.color&&m.diffuse.value.copy(h.color),h.emissive&&m.emissive.value.copy(h.emissive).multiplyScalar(h.emissiveIntensity),h.map&&(m.map.value=h.map,t(h.map,m.mapTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap,t(h.alphaMap,m.alphaMapTransform)),h.bumpMap&&(m.bumpMap.value=h.bumpMap,t(h.bumpMap,m.bumpMapTransform),m.bumpScale.value=h.bumpScale,h.side===pt&&(m.bumpScale.value*=-1)),h.normalMap&&(m.normalMap.value=h.normalMap,t(h.normalMap,m.normalMapTransform),m.normalScale.value.copy(h.normalScale),h.side===pt&&m.normalScale.value.negate()),h.displacementMap&&(m.displacementMap.value=h.displacementMap,t(h.displacementMap,m.displacementMapTransform),m.displacementScale.value=h.displacementScale,m.displacementBias.value=h.displacementBias),h.emissiveMap&&(m.emissiveMap.value=h.emissiveMap,t(h.emissiveMap,m.emissiveMapTransform)),h.specularMap&&(m.specularMap.value=h.specularMap,t(h.specularMap,m.specularMapTransform)),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest);const y=e.get(h).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=h.reflectivity,m.ior.value=h.ior,m.refractionRatio.value=h.refractionRatio),h.lightMap){m.lightMap.value=h.lightMap;const M=i.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=h.lightMapIntensity*M,t(h.lightMap,m.lightMapTransform)}h.aoMap&&(m.aoMap.value=h.aoMap,m.aoMapIntensity.value=h.aoMapIntensity,t(h.aoMap,m.aoMapTransform))}function o(m,h){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,h.map&&(m.map.value=h.map,t(h.map,m.mapTransform))}function a(m,h){m.dashSize.value=h.dashSize,m.totalSize.value=h.dashSize+h.gapSize,m.scale.value=h.scale}function u(m,h,y,M){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,m.size.value=h.size*y,m.scale.value=M*.5,h.map&&(m.map.value=h.map,t(h.map,m.uvTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest)}function l(m,h){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,m.rotation.value=h.rotation,h.map&&(m.map.value=h.map,t(h.map,m.mapTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest)}function c(m,h){m.specular.value.copy(h.specular),m.shininess.value=Math.max(h.shininess,1e-4)}function d(m,h){h.gradientMap&&(m.gradientMap.value=h.gradientMap)}function f(m,h){m.metalness.value=h.metalness,h.metalnessMap&&(m.metalnessMap.value=h.metalnessMap,t(h.metalnessMap,m.metalnessMapTransform)),m.roughness.value=h.roughness,h.roughnessMap&&(m.roughnessMap.value=h.roughnessMap,t(h.roughnessMap,m.roughnessMapTransform)),e.get(h).envMap&&(m.envMapIntensity.value=h.envMapIntensity)}function p(m,h,y){m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===pt&&m.clearcoatNormalScale.value.negate())),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.
3403iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,h){h.matcap&&(m.matcap.value=h.matcap)}function g(m,h){const y=e.get(h).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Ef(i,e,t,n){let r={},s={},o=[];const a=t.isWebGL2?i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(y,M){const R=M.program;n.uniformBlockBinding(y,R)}function l(y,M){let R=r[y.id];R===void 0&&(_(y),R=c(y),r[y.id]=R,y.addEventListener("dispose",m));const T=M.program;n.updateUBOMapping(y,T);const A=e.render.frame;s[y.id]!==A&&(f(y),s[y.id]=A)}function c(y){const M=d();y.__bindingPointIndex=M;const R=i.createBuffer(),T=y.__size,A=y.usage;return i.bindBuffer(i.UNIFORM_BUFFER,R),i.bufferData(i.UNIFORM_BUFFER,T,A),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,M,R),R}function d(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(y){const M=r[y.id],R=y.uniforms,T=y.__cache;i.bindBuffer(i.UNIFORM_BUFFER,M);for(let A=0,P=R.length;A<P;A++){const k=R[A];if(p(k,A,T)===!0){const x=k.__offset,b=Array.isArray(k.value)?k.value:[k.value];let q=0;for(let Z=0;Z<b.length;Z++){const I=b[Z],z=g(I);typeof I=="number"?(k.__data[0]=I,i.bufferSubData(i.UNIFORM_BUFFER,x+q,k.__data)):I.isMatrix3?(k.__data[0]=I.elements[0],k.__data[1]=I.elements[1],k.__data[2]=I.elements[2],k.__data[3]=I.elements[0],k.__data[4]=I.elements[3],k.__data[5]=I.elements[4],k.__data[6]=I.elements[5],k.__data[7]=I.elements[0],k.__data[8]=I.elements[6],k.__data[9]=I.elements[7],k.__data[10]=I.elements[8],k.__data[11]=I.elements[0]):(I.toArray(k.__data,q),q+=z.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,x,k.__data)}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(y,M,R){const T=y.value;if(R[M]===void 0){if(typeof T=="number")R[M]=T;else{const A=Array.isArray(T)?T:[T],P=[];for(let k=0;k<A.length;k++)P.push(A[k].clone());R[M]=P}return!0}else if(typeof T=="number"){if(R[M]!==T)return R[M]=T,!0}else{const A=Array.isArray(R[M])?R[M]:[R[M]],P=Array.isArray(T)?T:[T];for(let k=0;k<A.length;k++){const x=A[k];if(x.equals(P[k])===!1)return x.copy(P[k]),!0}}return!1}function _(y){const M=y.uniforms;let R=0;const T=16;let A=0;for(let P=0,k=M.length;P<k;
3403P++){const x=M[P],b={boundary:0,storage:0},q=Array.isArray(x.value)?x.value:[x.value];for(let Z=0,I=q.length;Z<I;Z++){const z=q[Z],G=g(z);b.boundary+=G.boundary,b.storage+=G.storage}if(x.__data=new Float32Array(b.storage/Float32Array.BYTES_PER_ELEMENT),x.__offset=R,P>0){A=R%T;const Z=T-A;A!==0&&Z-b.boundary<0&&(R+=T-A,x.__offset=R)}R+=b.storage}return A=R%T,A>0&&(R+=T-A),y.__size=R,y.__cache={},this}function g(y){const M={boundary:0,storage:0};return typeof y=="number"?(M.boundary=4,M.storage=4):y.isVector2?(M.boundary=8,M.storage=8):y.isVector3||y.isColor?(M.boundary=16,M.storage=12):y.isVector4?(M.boundary=16,M.storage=16):y.isMatrix3?(M.boundary=48,M.storage=48):y.isMatrix4?(M.boundary=64,M.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),M}function m(y){const M=y.target;M.removeEventListener("dispose",m);const R=o.indexOf(M.__bindingPointIndex);o.splice(R,1),i.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function h(){for(const y in r)i.deleteBuffer(r[y]);o=[],r={},s={}}return{bind:u,update:l,dispose:h}}function yf(){const i=Yi("canvas");return i.style.display="block",i}class po{constructor(e={}){const{canvas:t=yf(),context:n=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=o;let p=null,_=null;const g=[],m=[];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=Te,this.useLegacyLights=!0,this.toneMapping=$t,this.toneMappingExposure=1;const h=this;let y=!1,M=0,R=0,T=null,A=-1,P=null;const k=new Ve,x=new Ve;let b=null,q=t.width,Z=t.height,I=1,z=null,G=null;const ee=new Ve(0,0,q,Z),X=new Ve(0,0,q,Z);let W=!1;const Y=new Qr;let J=!1,he=!1,oe=null;const F=new We,j=new L,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function se(){return T===null?I:1}let C=n;function ye(S,D){for(let B=0;B<S.length;B++){const U=S[B],V=t.getContext(U,D);if(V!==null)return V}return null}try{const S={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:u,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zr}`),t.addEventListener("webglcontextlost",fe,!1),t.addEventListener("webglcontextrestored",Ue,!1),t.addEventListener("webglcontextcreationerror",Be,!1),C===null){const D=["webgl2","webgl","experimental-webgl"];if(h.isWebGL1Renderer===!0&&D.shift(),C=ye(D,S),C===null)throw ye(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}C.getShaderPrecisionFormat===void 0&&(C.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let Se,ne,xe,Ne,pe,Ce,Je,nt,Qe,Ke,Fe,ke,dt,E,v,N,$,Q,re,Me,ce,H,de,me;function ge(){Se=new Dh(C),ne=new Ah(C,Se,e),Se.init(ne),H=new _f(C,Se,ne),xe=new pf(C,Se,ne),Ne=new Fh(C),pe=new Qd,Ce=new mf(C,Se,xe,pe,ne,H,Ne),Je=new Rh(h),nt=new Uh(h),Qe=new jl(C,ne),de=new Th(C,Se,Qe,ne),Ke=new Ih(C,Qe,Ne,de),Fe=new Gh(C,Ke,Qe,Ne),re=new zh(C,ne,Ce),N=new wh(pe),ke=new Jd(h,Je,nt,Se,ne,de,N),dt=new Sf(h,pe),E=new tf,v=new lf(Se,ne),Q=new yh(h,Je,nt,xe,Fe,f,u),$=new ff(h,Fe,ne),me=new Ef(C,Ne,ne,xe),Me=new bh(C,Se,Ne,ne),ce=new Nh(C,Se,Ne,ne),Ne.programs=ke.programs,h.capabilities=ne,h.extensions=Se,h.properties=pe,h.renderLists=E,h.shadowMap=$,h.state=xe,h.info=Ne}ge();const le=new Mf(h,C);this.xr=le,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){const S=Se.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=Se.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(S){S!==void 0&&(I=S,this.setSize(q,Z,!1))}
3403,this.getSize=function(S){return S.set(q,Z)},this.setSize=function(S,D,B=!0){if(le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=S,Z=D,t.width=Math.floor(S*I),t.height=Math.floor(D*I),B===!0&&(t.style.width=S+"px",t.style.height=D+"px"),this.setViewport(0,0,S,D)},this.getDrawingBufferSize=function(S){return S.set(q*I,Z*I).floor()},this.setDrawingBufferSize=function(S,D,B){q=S,Z=D,I=B,t.width=Math.floor(S*B),t.height=Math.floor(D*B),this.setViewport(0,0,S,D)},this.getCurrentViewport=function(S){return S.copy(k)},this.getViewport=function(S){return S.copy(ee)},this.setViewport=function(S,D,B,U){S.isVector4?ee.set(S.x,S.y,S.z,S.w):ee.set(S,D,B,U),xe.viewport(k.copy(ee).multiplyScalar(I).floor())},this.getScissor=function(S){return S.copy(X)},this.setScissor=function(S,D,B,U){S.isVector4?X.set(S.x,S.y,S.z,S.w):X.set(S,D,B,U),xe.scissor(x.copy(X).multiplyScalar(I).floor())},this.getScissorTest=function(){return W},this.setScissorTest=function(S){xe.setScissorTest(W=S)},this.setOpaqueSort=function(S){z=S},this.setTransparentSort=function(S){G=S},this.getClearColor=function(S){return S.copy(Q.getClearColor())},this.setClearColor=function(){Q.setClearColor.apply(Q,arguments)},this.getClearAlpha=function(){return Q.getClearAlpha()},this.setClearAlpha=function(){Q.setClearAlpha.apply(Q,arguments)},this.clear=function(S=!0,D=!0,B=!0){let U=0;S&&(U|=C.COLOR_BUFFER_BIT),D&&(U|=C.DEPTH_BUFFER_BIT),B&&(U|=C.STENCIL_BUFFER_BIT),C.clear(U)},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",fe,!1),t.removeEventListener("webglcontextrestored",Ue,!1),t.removeEventListener("webglcontextcreationerror",Be,!1),E.dispose(),v.dispose(),pe.dispose(),Je.dispose(),nt.dispose(),Fe.dispose(),de.dispose(),me.dispose(),ke.dispose(),le.dispose(),le.removeEventListener("sessionstart",ue),le.removeEventListener("sessionend",Ge),oe&&(oe.dispose(),oe=null),He.stop()};function fe(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function Ue(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const S=Ne.autoReset,D=$.enabled,B=$.autoUpdate,U=$.needsUpdate,V=$.type;ge(),Ne.autoReset=S,$.enabled=D,$.autoUpdate=B,$.needsUpdate=U,$.type=V}function Be(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Xe(S){const D=S.target;D.removeEventListener("dispose",Xe),w(D)}function w(S){O(S),pe.remove(S)}function O(S){const D=pe.get(S).programs;D!==void 0&&(D.forEach(function(B){ke.releaseProgram(B)}),S.isShaderMaterial&&ke.releaseShaderCache(S))}this.renderBufferDirect=function(S,D,B,U,V,_e){D===null&&(D=ie);const ve=V.isMesh&&V.matrixWorld.determinant()<0,Ee=Mo(S,D,B,U,V);xe.setMaterial(U,ve);let be=B.index,we=1;U.wireframe===!0&&(be=Ke.getWireframeAttribute(B),we=2);const Re=B.drawRange,Le=B.attributes.position;let ze=Re.start*we,ot=(Re.start+Re.count)*we;_e!==null&&(ze=Math.max(ze,_e.start*we),ot=Math.min(ot,(_e.start+_e.count)*we)),be!==null?(ze=Math.max(ze,0),ot=Math.min(ot,be.count)):Le!=null&&(ze=Math.max(ze,0),ot=Math.min(ot,Le.count));const wt=ot-ze;if(wt<0||wt===1/0)return;de.setup(V,U,Ee,B,be);let on,je=Me;if(be!==null&&(on=Qe.get(be),je=ce,je.setIndex(on)),V.isMesh)U.wireframe===!0?(xe.setLineWidth(U.wireframeLinewidth*se()),je.setMode(C.LINES)):je.setMode(C.TRIANGLES);else if(V.isLine){let De=U.linewidth;De===void 0&&(De=1),xe.setLineWidth(De*se()),V.isLineSegments?je.setMode(C.LINES):V.isLineLoop?je.setMode(C.LINE_LOOP):je.setMode(C.LINE_STRIP)}else V.isPoints?je.setMode(C.POINTS):V.isSprite&&je.setMode(C.TRIANGLES);if(V.isInstancedMesh)je.renderInstances(ze,wt,V.count);else if(B.isInstancedBufferGeometry){const De=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,Ji=Math.min(B.instanceCount,De);je.renderInstances(ze,wt,Ji)}else je.render(ze,wt)},this.compile=function(S,D){function B(U,V,_e){U.transparent===!0&&U.side===Zt&&U.forceSinglePass===!1?(U.side=pt,U.needsUpdate=!0,mi(U,V,_e),U.side=an,U.needsUpdate=!0,mi(U,V,_e),U.side=Zt):mi(U,V,_e)}
3403_=v.get(S),_.init(),m.push(_),S.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(_.pushLight(U),U.castShadow&&_.pushShadow(U))}),_.setupLights(h.useLegacyLights),S.traverse(function(U){const V=U.material;if(V)if(Array.isArray(V))for(let _e=0;_e<V.length;_e++){const ve=V[_e];B(ve,S,U)}else B(V,S,U)}),m.pop(),_=null};let K=null;function ae(S){K&&K(S)}function ue(){He.stop()}function Ge(){He.start()}const He=new lo;He.setAnimationLoop(ae),typeof self<"u"&&He.setContext(self),this.setAnimationLoop=function(S){K=S,le.setAnimationLoop(S),S===null?He.stop():He.start()},le.addEventListener("sessionstart",ue),le.addEventListener("sessionend",Ge),this.render=function(S,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(D),D=le.getCamera()),S.isScene===!0&&S.onBeforeRender(h,S,D,T),_=v.get(S,m.length),_.init(),m.push(_),F.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Y.setFromProjectionMatrix(F),he=this.localClippingEnabled,J=N.init(this.clippingPlanes,he),p=E.get(S,g.length),p.init(),g.push(p),it(S,D,0,h.sortObjects),p.finish(),h.sortObjects===!0&&p.sort(z,G),J===!0&&N.beginShadows();const B=_.state.shadowsArray;if($.render(B,S,D),J===!0&&N.endShadows(),this.info.autoReset===!0&&this.info.reset(),Q.render(p,S),_.setupLights(h.useLegacyLights),D.isArrayCamera){const U=D.cameras;for(let V=0,_e=U.length;V<_e;V++){const ve=U[V];Qt(p,S,ve,ve.viewport)}}else Qt(p,S,D);T!==null&&(Ce.updateMultisampleRenderTarget(T),Ce.updateRenderTargetMipmap(T)),S.isScene===!0&&S.onAfterRender(h,S,D),de.resetDefaultState(),A=-1,P=null,m.pop(),m.length>0?_=m[m.length-1]:_=null,g.pop(),g.length>0?p=g[g.length-1]:p=null};function it(S,D,B,U){if(S.visible===!1)return;if(S.layers.test(D.layers)){if(S.isGroup)B=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(D);else if(S.isLight)_.pushLight(S),S.castShadow&&_.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Y.intersectsSprite(S)){U&&j.setFromMatrixPosition(S.matrixWorld).applyMatrix4(F);const ve=Fe.update(S),Ee=S.material;Ee.visible&&p.push(S,ve,Ee,B,j.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Y.intersectsObject(S))){S.isSkinnedMesh&&S.skeleton.frame!==Ne.render.frame&&(S.skeleton.update(),S.skeleton.frame=Ne.render.frame);const ve=Fe.update(S),Ee=S.material;if(U&&(ve.boundingSphere===null&&ve.computeBoundingSphere(),j.copy(ve.boundingSphere.center).applyMatrix4(S.matrixWorld).applyMatrix4(F)),Array.isArray(Ee)){const be=ve.groups;for(let we=0,Re=be.length;we<Re;we++){const Le=be[we],ze=Ee[Le.materialIndex];ze&&ze.visible&&p.push(S,ve,ze,B,j.z,Le)}}else Ee.visible&&p.push(S,ve,Ee,B,j.z,null)}}const _e=S.children;for(let ve=0,Ee=_e.length;ve<Ee;ve++)it(_e[ve],D,B,U)}function Qt(S,D,B,U){const V=S.opaque,_e=S.transmissive,ve=S.transparent;_.setupLightsView(B),J===!0&&N.setGlobalState(h.clippingPlanes,B),_e.length>0&&qe(V,_e,D,B),U&&xe.viewport(k.copy(U)),V.length>0&&St(V,D,B),_e.length>0&&St(_e,D,B),ve.length>0&&St(ve,D,B),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function qe(S,D,B,U){if(oe===null){const Ee=ne.isWebGL2;oe=new yn(1024,1024,{generateMipmaps:!0,type:Se.has("EXT_color_buffer_half_float")?ci:En,minFilter:li,samples:Ee&&a===!0?4:0})}const V=h.getRenderTarget();h.setRenderTarget(oe),h.clear();const _e=h.toneMapping;h.toneMapping=$t,St(S,B,U),Ce.updateMultisampleRenderTarget(oe),Ce.updateRenderTargetMipmap(oe);let ve=!1;for(let Ee=0,be=D.length;Ee<be;Ee++){const we=D[Ee],Re=we.object,Le=we.geometry,ze=we.material,ot=we.group;if(ze.side===Zt&&Re.layers.test(U.layers)){const wt=ze.side;ze.side=pt,ze.needsUpdate=!0,Ft(Re,B,U,Le,ze,ot),ze.side=wt,ze.needsUpdate=!0,ve=!0}}ve===!0&&(Ce.updateMultisampleRenderTarget(oe),Ce.updateRenderTargetMipmap(oe)),h.setRenderTarget(V),h.toneMapping=_e}function St(S,D,B){const U=D.isScene===!0?D.overrideMaterial:null;for(let V=0,_e=S.length;V<_e;V++){const ve=S[V],Ee=ve.object,be=ve.geometry,we=U===null?ve.material:U,Re=ve.group;Ee.layers.test(B.layers)&&Ft(Ee,D,B,be,we,Re)}}function Ft(S,D,B,U,V,_e){S.onBeforeRender(h,D,B,U,V,_e),S.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),V.onBeforeRender(h,D,B,U,S,_e),V.transparent===!0&&V.side===Zt&&V.forceSinglePass===!1?(V.side=pt,V.needsUpdate=!0,h.renderBufferDirect(B,D,U,V,S,_e),V.side=an,V.needsUpdate=!0,h.renderBufferDirect(B,D,U,V,S,_e),V.side=Zt):h.renderBufferDirect(B,D,U,V,S,_e),S.onAfterRender(h,D,B,U,V,_e)}function mi(S,D,B){D.isScene!==!0&&(D=ie);const U=pe.get(S),V=_.state.lights,_e=_.state.shadowsArray,ve=V.state.ver
vendor: 5,622 bytes, line 3403
3403sion,Ee=ke.getParameters(S,V.state,_e,D,B),be=ke.getProgramCacheKey(Ee);let we=U.programs;U.environment=S.isMeshStandardMaterial?D.environment:null,U.fog=D.fog,U.envMap=(S.isMeshStandardMaterial?nt:Je).get(S.envMap||U.environment),we===void 0&&(S.addEventListener("dispose",Xe),we=new Map,U.programs=we);let Re=we.get(be);if(Re!==void 0){if(U.currentProgram===Re&&U.lightsStateVersion===ve)return ns(S,Ee),Re}else Ee.uniforms=ke.getUniforms(S),S.onBuild(B,Ee,h),S.onBeforeCompile(Ee,h),Re=ke.acquireProgram(Ee,be),we.set(be,Re),U.uniforms=Ee.uniforms;const Le=U.uniforms;(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Le.clippingPlanes=N.uniform),ns(S,Ee),U.needsLights=Eo(S),U.lightsStateVersion=ve,U.needsLights&&(Le.ambientLightColor.value=V.state.ambient,Le.lightProbe.value=V.state.probe,Le.directionalLights.value=V.state.directional,Le.directionalLightShadows.value=V.state.directionalShadow,Le.spotLights.value=V.state.spot,Le.spotLightShadows.value=V.state.spotShadow,Le.rectAreaLights.value=V.state.rectArea,Le.ltc_1.value=V.state.rectAreaLTC1,Le.ltc_2.value=V.state.rectAreaLTC2,Le.pointLights.value=V.state.point,Le.pointLightShadows.value=V.state.pointShadow,Le.hemisphereLights.value=V.state.hemi,Le.directionalShadowMap.value=V.state.directionalShadowMap,Le.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Le.spotShadowMap.value=V.state.spotShadowMap,Le.spotLightMatrix.value=V.state.spotLightMatrix,Le.spotLightMap.value=V.state.spotLightMap,Le.pointShadowMap.value=V.state.pointShadowMap,Le.pointShadowMatrix.value=V.state.pointShadowMatrix);const ze=Re.getUniforms(),ot=qi.seqWithValue(ze.seq,Le);return U.currentProgram=Re,U.uniformsList=ot,Re}function ns(S,D){const B=pe.get(S);B.outputColorSpace=D.outputColorSpace,B.instancing=D.instancing,B.skinning=D.skinning,B.morphTargets=D.morphTargets,B.morphNormals=D.morphNormals,B.morphColors=D.morphColors,B.morphTargetsCount=D.morphTargetsCount,B.numClippingPlanes=D.numClippingPlanes,B.numIntersection=D.numClipIntersection,B.vertexAlphas=D.vertexAlphas,B.vertexTangents=D.vertexTangents,B.toneMapping=D.toneMapping}function Mo(S,D,B,U,V){D.isScene!==!0&&(D=ie),Ce.resetTextureUnits();const _e=D.fog,ve=U.isMeshStandardMaterial?D.environment:null,Ee=T===null?h.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:Ht,be=(U.isMeshStandardMaterial?nt:Je).get(U.envMap||ve),we=U.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,Re=!!U.normalMap&&!!B.attributes.tangent,Le=!!B.morphAttributes.position,ze=!!B.morphAttributes.normal,ot=!!B.morphAttributes.color,wt=U.toneMapped?h.toneMapping:$t,on=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,je=on!==void 0?on.length:0,De=pe.get(U),Ji=_.state.lights;if(J===!0&&(he===!0||S!==P)){const mt=S===P&&U.id===A;N.setState(U,S,mt)}let et=!1;U.version===De.__version?(De.needsLights&&De.lightsStateVersion!==Ji.state.version||De.outputColorSpace!==Ee||V.isInstancedMesh&&De.instancing===!1||!V.isInstancedMesh&&De.instancing===!0||V.isSkinnedMesh&&De.skinning===!1||!V.isSkinnedMesh&&De.skinning===!0||De.envMap!==be||U.fog===!0&&De.fog!==_e||De.numClippingPlanes!==void 0&&(De.numClippingPlanes!==N.numPlanes||De.numIntersection!==N.numIntersection)||De.vertexAlphas!==we||De.vertexTangents!==Re||De.morphTargets!==Le||De.morphNormals!==ze||De.morphColors!==ot||De.toneMapping!==wt||ne.isWebGL2===!0&&De.morphTargetsCount!==je)&&(et=!0):(et=!0,De.__version=U.version);let ln=De.currentProgram;et===!0&&(ln=mi(U,D,V));let is=!1,Qn=!1,Qi=!1;const lt=ln.getUniforms(),cn=De.uniforms;if(xe.useProgram(ln.program)&&(is=!0,Qn=!0,Qi=!0),U.id!==A&&(A=U.id,Qn=!0),is||P!==S){if(lt.setValue(C,"projectionMatrix",S.projectionMatrix),ne.logarithmicDepthBuffer&<.setValue(C,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),P!==S&&(P=S,Qn=!0,Qi=!0),U.isShaderMaterial||U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshStandardMaterial||U.envMap){const mt=lt.map.cameraPosition;mt!==void 0&&mt.setValue(C,j.setFromMatrixPosition(S.matrixWorld))}(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&<.setValue(C,"isOrthographic",S.isOrthographicCamera===!0),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial||U.isShadowMaterial||V.isSkinnedMesh)&<.setValue(C,"viewMatrix",S.matrixWorldInverse)}if(V.isSkinnedMesh){lt.setOptional(C,V,"bindMatrix"),lt.setOptional(C,V,"bindMatrixInverse");const mt=V.skeleton;mt&&(ne.floatVertexTextures?(mt.boneTexture===null&&mt.computeBoneTexture(),lt.setValue(C,"boneTexture",mt.boneTexture,Ce),lt.setValue(C,"boneTextureSize",mt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const er=B.morphAttributes;if((er.position!==void 0||er.normal!==void 0||er.color!==void 0&&ne.isWebGL2===!0)&&re.update(V,B,ln),(Qn||De.receiveShadow!==V.receiveShadow)&&(De.receiveShadow=V.receiveShadow,lt.setValue(C,"receiveShadow",V.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(cn.envMap.value=be,cn.flipEnvMap.value=be.isCubeTexture&&be.isRenderTargetTexture===!1?-1:1),Qn&&(lt.setValue(C,"toneMappingExposure",h.toneMappingExposure),De.needsLights&&So(cn,Qi),_e&&U.fog===!0&&dt.refreshFogUniforms(cn,_e),dt.refreshMaterialUniforms(cn,U,I,Z,oe),qi.upload(C,De.uniformsList,cn,Ce)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(qi.upload(C,De.uniformsList,cn,Ce),U.uniformsNeedUpdate=!1),U.isS
3403priteMaterial&<.setValue(C,"center",V.center),lt.setValue(C,"modelViewMatrix",V.modelViewMatrix),lt.setValue(C,"normalMatrix",V.normalMatrix),lt.setValue(C,"modelMatrix",V.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const mt=U.uniformsGroups;for(let tr=0,yo=mt.length;tr<yo;tr++)if(ne.isWebGL2){const rs=mt[tr];me.update(rs,ln),me.bind(rs,ln)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return ln}function So(S,D){S.ambientLightColor.needsUpdate=D,S.lightProbe.needsUpdate=D,S.directionalLights.needsUpdate=D,S.directionalLightShadows.needsUpdate=D,S.pointLights.needsUpdate=D,S.pointLightShadows.needsUpdate=D,S.spotLights.needsUpdate=D,S.spotLightShadows.needsUpdate=D,S.rectAreaLights.needsUpdate=D,S.hemisphereLights.needsUpdate=D}function Eo(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(S,D,B){pe.get(S.texture).__webglTexture=D,pe.get(S.depthTexture).__webglTexture=B;const U=pe.get(S);U.__hasExternalTextures=!0,U.__hasExternalTextures&&(U.__autoAllocateDepthBuffer=B===void 0,U.__autoAllocateDepthBuffer||Se.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),U.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(S,D){const B=pe.get(S);B.__webglFramebuffer=D,B.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(S,D=0,B=0){T=S,M=D,R=B;let U=!0,V=null,_e=!1,ve=!1;if(S){const be=pe.get(S);be.__useDefaultFramebuffer!==void 0?(xe.bindFramebuffer(C.FRAMEBUFFER,null),U=!1):be.__webglFramebuffer===void 0?Ce.setupRenderTarget(S):be.__hasExternalTextures&&Ce.rebindTextures(S,pe.get(S.texture).__webglTexture,pe.get(S.depthTexture).__webglTexture);const we=S.texture;(we.isData3DTexture||we.isDataArrayTexture||we.isCompressedArrayTexture)&&(ve=!0);const Re=pe.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(V=Re[D],_e=!0):ne.isWebGL2&&S.samples>0&&Ce.useMultisampledRTT(S)===!1?V=pe.get(S).__webglMultisampledFramebuffer:V=Re,k.copy(S.viewport),x.copy(S.scissor),b=S.scissorTest}else k.copy(ee).multiplyScalar(I).floor(),x.copy(X).multiplyScalar(I).floor(),b=W;if(xe.bindFramebuffer(C.FRAMEBUFFER,V)&&ne.drawBuffers&&U&&xe.drawBuffers(S,V),xe.viewport(k),xe.scissor(x),xe.setScissorTest(b),_e){const be=pe.get(S.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+D,be.__webglTexture,B)}else if(ve){const be=pe.get(S.texture),we=D||0;C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,be.__webglTexture,B||0,we)}A=-1},this.readRenderTargetPixels=function(S,D,B,U,V,_e,ve){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ee=pe.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&ve!==void 0&&(Ee=Ee[ve]),Ee){xe.bindFramebuffer(C.FRAMEBUFFER,Ee);try{const be=S.texture,we=be.format,Re=be.type;if(we!==It&&H.convert(we)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Le=Re===ci&&(Se.has("EXT_color_buffer_half_float")||ne.isWebGL2&&Se.has("EXT_color_buffer_float"));if(Re!==En&&H.convert(Re)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Re===vn&&(ne.isWebGL2||Se.has("OES_texture_float")||Se.has("WEBGL_color_buffer_float")))&&!Le){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=S.width-U&&B>=0&&B<=S.height-V&&C.readPixels(D,B,U,V,H.convert(we),H.convert(Re),_e)}finally{const be=T!==null?pe.get(T).__webglFramebuffer:null;xe.bindFramebuffer(C.FRAMEBUFFER,be)}}},this.copyFramebufferToTexture=function(S,D,B=0){const U=Math.pow(2,-B),V=Math.floor(D.image.width*U),_e=Math.floor(D.image.height*U);Ce.setTexture2D(D,0),C.copyTexSubImage2D(C.TEXTURE_2D,B,0,0,S.x,S.y,V,_e),xe.unbindTexture()},this.copyTextureToTexture=function(S,D,B,U=0){const V=D.image.width,_e=D.image.height,ve=H.convert(B.format),Ee=H.convert(B.type);Ce.setTexture2D(B,0),C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,B.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,B.unpackAlignment),D.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,U,S.x,S.y,V,_e,ve,Ee,D.image.data):D.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,U,S.x,S.y,D.mipmaps[0].width,D.mipmaps[0].height,ve,D.mipmaps[0].data):C.texSubImage2D(C.TEXTURE_2D,U,S.x,S.y,ve,Ee,D.image),U===0&&B.generateMipmaps&&C.generateMipmap(C.TEXTURE_2D),xe.unbindTexture()},this.copyTextureToTexture3D=function(S,D,B,U,V=0){if(h.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const _e=S.max.x-S.min.x+1,ve=S.max.y-S.min.y+1,Ee=S.max.z-S.min.z+1,be=H.convert(U.format),we=H.convert(U.type);let Re;if(U.isData3DTexture)Ce.setTexture3D(U,0),Re=C.TEXTURE_3D;else if(U.isDataArrayTexture)Ce.setTexture2DArray(U,0),Re=C.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const Le=C.getParameter(C.UNPACK_ROW_LENGTH),ze=C.getParameter(C.UNPACK_IMAGE_HEIGHT),ot=C.getParameter(C.UNPACK_SKIP_PIXELS),wt=C.getParameter(C.UNPACK_SKIP_ROWS),on=C.getParameter(C.UNPACK_SKIP_IMAGES),je=B.isCompressedTexture?B.mipmaps[0]:B.image;C.pixelStorei(C.UNPACK_ROW_LENGTH,je.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,je.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,S.min.x),C.pixelStorei(C.UNPACK_SKIP_ROWS,S.min.y),C.pixelStorei(C.UNPACK_SKIP_IMAGES,S.min.z),B.isDataTexture||B.isData3DTexture?C.texSubImage3D(Re,V,D.x,D.y,D.z,_e,ve,Ee,be,we,je.data):B.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),C.compressedTexSubImage3D(Re,V,D.x,D.y,D.z,_e,ve,Ee,be,je.data)):C.texSubImage3D(Re,V,D.x,D.y,D.z,_e,ve,Ee,be,we,je),C.pixelStorei(C.UNPACK_ROW_LENGTH,Le),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ze),C.pixelStorei(C.UNPACK_SKIP_PIXELS,ot),C.pixelStorei(C.UNPACK_SKIP_ROWS,wt),C.pixelStorei(C.UNPACK_SKIP_IMAGES,on),V===0&&U.generateMipmaps&&C.generateMipmap(Re),xe.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?Ce.setTextureCube(S,0):S.isData3DTexture?Ce.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?Ce.setTexture2DArray(S,0):Ce.setTexture2D(S,0),xe.unbindTexture()},this.resetState=function(){M=0,R=0,T=null,xe.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace
vendor: 14,191 bytes, line 3403
3403===Te?Mn:ja}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Mn?Te:Ht}}class Tf extends po{}Tf.prototype.isWebGL1Renderer=!0;class bf extends at{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class ji extends Jt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ie(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Sa=new L,Ea=new L,ya=new We,Ur=new Jr,Oi=new fi;class Af extends at{constructor(e=new Nt,t=new ji){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Sa.fromBufferAttribute(t,r-1),Ea.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Sa.distanceTo(Ea);e.setAttribute("lineDistance",new ht(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Oi.copy(n.boundingSphere),Oi.applyMatrix4(r),Oi.radius+=s,e.ray.intersectsSphere(Oi)===!1)return;ya.copy(r).invert(),Ur.copy(e.ray).applyMatrix4(ya);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=a*a,l=new L,c=new L,d=new L,f=new L,p=this.isLineSegments?2:1,_=n.index,m=n.attributes.position;if(_!==null){const h=Math.max(0,o.start),y=Math.min(_.count,o.start+o.count);for(let M=h,R=y-1;M<R;M+=p){const T=_.getX(M),A=_.getX(M+1);if(l.fromBufferAttribute(m,T),c.fromBufferAttribute(m,A),Ur.distanceSqToSegment(l,c,f,d)>u)continue;f.applyMatrix4(this.matrixWorld);const k=e.ray.origin.distanceTo(f);k<e.near||k>e.far||t.push({distance:k,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{const h=Math.max(0,o.start),y=Math.min(m.count,o.start+o.count);for(let M=h,R=y-1;M<R;M+=p){if(l.fromBufferAttribute(m,M),c.fromBufferAttribute(m,M+1),Ur.distanceSqToSegment(l,c,f,d)>u)continue;f.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(f);A<e.near||A>e.far||t.push({distance:A,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object: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,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const Ta=new L,ba=new L;class Aa extends Af{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)Ta.fromBufferAttribute(t,r),ba.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Ta.distanceTo(ba);e.setAttribute("lineDistance",new ht(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ai extends Jt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ie(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const wa=new We,Xr=new Jr,Bi=new fi,zi=new L;class Dr extends at{constructor(e=new Nt,t=new ai){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Bi.copy(n.boundingSphere),Bi.applyMatrix4(r),Bi.radius+=s,e.ray.intersectsSphere(Bi)===!1)return;wa.copy(r).invert(),Xr.copy(e.ray).applyMatrix4(wa);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=a*a,l=n.index,d=n.attributes.position;if(l!==null){const f=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let _=f,g=p;_<g;_++){const m=l.getX(_);zi.fromBufferAttribute(d,m),Ra(zi,m,u,r,e,t,this)}}else{const f=Math.max(0,o.start),p=Math.min(d.count,o.start+o.count);for(let _=f,g=p;_<g;_++)zi.fromBufferAttribute(d,_),Ra(zi,_,u,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Ra(i,e,t,n,r,s,o){const a=Xr.distanceSqToPoint(i);if(a<t){const u=new L;Xr.closestPointToPoint(i,u),u.applyMatrix4(n);const l=r.ray.origin.distanceTo(u);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:u,index:e,face:null,object:o})}}class mo extends Jt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ie(16777215),this.specular=new Ie(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ie(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ya,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$r,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}const Ca={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class _o{constructor(e,t,n){const r=this;let s=!1,o=0,a=0,u;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(c){a++,s===!1&&r.onStart!==void 0&&r.onStart(c,o,a),s=!0},this.itemEnd=function(c){o++,r.onProgress!==void 0&&r.onProgress(c,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(c){r.onError!==void 0&&r.onError(c)},this.resolveURL=function(c){return u?u(c):c},this.setURLModifier=function(c){return u=c,this},this.addHandler=function(c,d){return l.push(c,d),this},this.removeHandler=function(c){const d=l.indexOf(c);return d!==-1&&l.splice(d,2),this},this.getHandler=function(c){for(let d=0,f=l.length;d<f;d+=2){const p=l[d],_=l[d+1];if(p.global&&(p.lastIndex=0),p.test(c))return _}return null}}}const wf=new _o;class go{constructor(e){this.manager=e!==void 0?e:wf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const Yt={};class Rf extends Error{constructor(e,t){super(e),this.response=t}}class Cf extends go{constructor(e){super(e)}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ca.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Yt[e]!==void 0){Yt[e].push({onLoad:t,onProgress:n,onError:r});return}Yt[e]=[],Yt[e].push({onLoad:t,onProgress:n,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,u=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const c=Yt[e],d=l.body.getReader(),f=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),p=f?parseInt(f):0,_=p!==0;let g=0;const m=new ReadableStream({start(h){y();function y(){d.read().then(({done:M,value:R})=>{if(M)h.close();else{g+=R.byteLength;const T=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:p});for(let A=0,P=c.length;A<P;A++){const k=c[A];k.onProgress&&k.onProgress(T)}h.enqueue(R),y()}})}}});return new Response(m)}else throw new Rf(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(u){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return l.json();default:if(a===void 0)return l.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),f=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(f);return l.arrayBuffer().then(_=>p.decode(_))}}}).then(l=>{Ca.add(e,l);const c=Yt[e];delete Yt[e];for(let d=0,f=c.length;d<f;d++){const p=c[d];p.onLoad&&p.onLoad(l)}}).catch(l=>{const c=Yt[e];if(c===void 0)throw this.manager.itemError(e),l;delete Yt[e];for(let d=0,f=c.length;d<f;d++){const p=c[d];p.onError&&p.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class vo extends at{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ie(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const Ir=new We,La=new L,Pa=new L;class Lf{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Qr,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new Ve(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;La.setFromMatrixPosition(e.matrixWorld),t.position.copy(La),Pa.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Pa),t.updateMatrixWorld(),Ir.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ir),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ir)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radiu
3403s=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Ua=new We,ri=new L,Nr=new L;class Pf extends Lf{constructor(){super(new xt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Oe(4,2),this._viewportCount=6,this._viewports=[new Ve(2,1,1,1),new Ve(0,1,1,1),new Ve(3,1,1,1),new Ve(1,1,1,1),new Ve(3,0,1,1),new Ve(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ri.setFromMatrixPosition(e.matrixWorld),n.position.copy(ri),Nr.copy(n.position),Nr.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Nr),n.updateMatrixWorld(),r.makeTranslation(-ri.x,-ri.y,-ri.z),Ua.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ua)}}class Uf extends vo{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Pf}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Df extends vo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zr}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zr);const If=/^[og]\s*(.+)?/,Nf=/^mtllib /,Ff=/^usemtl /,Of=/^usemap /,Da=/\s+/,Ia=new L,Fr=new L,Na=new L,Fa=new L,yt=new L,Gi=new Ie;function Bf(){const i={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(u){const l={index:typeof u=="number"?u:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return l.clone=this.clone.bind(l),l}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const r=n.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){const r=this.vertices,s=this.object.geometry.normals;Ia.fromArray(r,e),Fr.fromArray(r,t),Na.fromArray(r,n),yt.subVectors(Na,Fr),Fa.subVectors(Ia,Fr),yt.cross(Fa),yt.normalize(),s.push(yt.x,yt.y,yt.z),s.push(yt.x,yt.y,yt.z),s.push(yt.x,yt.y,yt.z)},addColor:function(e,t,n){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&s.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[n+0],r[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,s,o,a,u,l){const c=this.vertices.length;let d=this.parseVertexIndex(e,c),f=this.parseVertexIndex(t,c),p=this.parseVertexIndex(n,c);
3403if(this.addVertex(d,f,p),this.addColor(d,f,p),a!==void 0&&a!==""){const _=this.normals.length;d=this.parseNormalIndex(a,_),f=this.parseNormalIndex(u,_),p=this.parseNormalIndex(l,_),this.addNormal(d,f,p)}else this.addFaceNormal(d,f,p);if(r!==void 0&&r!==""){const _=this.uvs.length;d=this.parseUVIndex(r,_),f=this.parseUVIndex(s,_),p=this.parseUVIndex(o,_),this.addUV(d,f,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(let s=0,o=e.length;s<o;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return i.startObject("",!1),i}class zf extends go{constructor(e){super(e),this.materials=null}load(e,t,n,r){const s=this,o=new Cf(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(u){r?r(u):console.error(u),s.manager.itemError(e)}},n,r)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Bf;e.indexOf(`\r 3404`)!==-1&&(e=e.replace(/\r\n/g,` 3405`)),e.indexOf(`\\ 3406`)!==-1&&(e=e.replace(/\\\n/g,""));const n=e.split(` 3407`);let r=[];for(let a=0,u=n.length;a<u;a++){const l=n[a].trimStart();if(l.length===0)continue;const c=l.charAt(0);if(c!=="#")if(c==="v"){const d=l.split(Da);switch(d[0]){case"v":t.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),d.length>=7?(Gi.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),t.colors.push(Gi.r,Gi.g,Gi.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":t.uvs.push(parseFloat(d[1]),parseFloat(d[2]));break}}else if(c==="f"){const f=l.slice(1).trim().split(Da),p=[];for(let g=0,m=f.length;g<m;g++){const h=f[g];if(h.length>0){const y=h.split("/");p.push(y)}}const _=p[0];for(let g=1,m=p.length-1;g<m;g++){const h=p[g],y=p[g+1];t.addFace(_[0],h[0],y[0],_[1],h[1],y[1],_[2],h[2],y[2])}}else if(c==="l"){const d=l.substring(1).trim().split(" ");let f=[];const p=[];if(l.indexOf("/")===-1)f=d;else for(let _=0,g=d.length;_<g;_++){const m=d[_].split("/");m[0]!==""&&f.push(m[0]),m[1]!==""&&p.push(m[1])}t.addLineGeometry(f,p)}else if(c==="p"){const f=l.slice(1).trim().split(" ");t.addPointGeometry(f)}else if((r=If.exec(l))!==null){const d=(" "+r[0].slice(1).trim()).slice(1);t.startObject(d)}else if(Ff.test(l))t.object.startMaterial(l.substring(7).trim(),t.materialLibraries);else if(Nf.test(l))t.materialLibraries.push(l.substring(7).trim());else if(Of.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(c==="s"){if(r=l.split(" "),r.length>1){const f=r[1].trim().toLowerCase();t.object.smooth=f!=="0"&&f!=="off"}else t.object.smooth=!0;const d=t.object.currentMaterial();d&&(d.smooth=t.object.smooth)}else{if(l==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}}t.finalize();const s=new kn;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let a=0,u=t.objects.length;a<u;a++){const l=t.objects[a],c=l.geometry,d=l.materials,f=c.type==="Line",p=c.type==="Points";let _=!1;if(c.vertices.length===0)continue;const g=new Nt;g.setAttribute("position",new ht(c.vertices,3)),c.normals.length>0&&g.setAttribute("normal",new ht(c.normals,3)),c.colors.length>0&&(_=!0,g.setAttribute("color",new ht(c.colors,3))),c.hasUVIndices===!0&&g.setAttribute("uv",new ht(c.uvs,2));const m=[];for(let y=0,M=d.length;y<M;y++){const R=d[y],T=R.name+"_"+R.smooth+"_"+_;let A=t.materials[T];if(this.materials!==null){if(A=this.materials.create(R.name),f&&A&&!(A instanceof ji)){const P=new ji;Jt.prototype.copy.call(P,A),P.color.copy(A.color),A=P}else if(p&&A&&!(A instanceof ai)){const P=new ai({size:10,sizeAttenuation:!1});Jt.prototype.copy.call(P,A),P.color.copy(A.color),P.map=A.map,A=P}}
3407A===void 0&&(f?A=new ji:p?A=new ai({size:1,sizeAttenuation:!1}):A=new mo,A.name=R.name,A.flatShading=!R.smooth,A.vertexColors=_,t.materials[T]=A),m.push(A)}let h;if(m.length>1){for(let y=0,M=d.length;y<M;y++){const R=d[y];g.addGroup(R.groupStart,R.groupCount,y)}f?h=new Aa(g,m):p?h=new Dr(g,m):h=new At(g,m)}else f?h=new Aa(g,m[0]):p?h=new Dr(g,m[0]):h=new At(g,m[0]);h.name=l.name,s.add(h)}else if(t.vertices.length>0){const a=new ai({size:1,sizeAttenuation:!1}),u=new Nt;u.setAttribute("position",new ht(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(u.setAttribute("color",new ht(t.colors,3)),a.vertexColors=!0);const l=new Dr(u,a);s.add(l)}return s}}const Gf=16743340,xo=50625,Hf=2369329;let Oa=0,Ba=0,Bt=0;const Vf=.1,fn=Math.PI/4,Hi=Math.PI*.08,Vi=Math.PI*.17;let za=window.innerWidth/2,Ga=window.innerHeight/2;const qr=document.querySelector(".section-phase-01"),jr=document.querySelector(".section-phase-02"),Yr=document.querySelector(".section-phase-03"),Kr=document.querySelector(".section-phase-04"),Ha=function(i,e,t){const n=(i&16711680)>>16,r=(i&65280)>>8,s=i&255,o=(e&16711680)>>16,a=(e&65280)>>8,u=e&255,l=n+t*(o-n),c=r+t*(a-r),d=s+t*(u-s);return(l<<16)+(c<<8)+(d|0)},ki=(i,e,t)=>Ha(Hf,Ha(xo,Gf,e[i]),t),Tt=i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,Wi=(i,e)=>Math.max(Math.min((e-(i.offsetTop-i.offsetHeight))/i.offsetHeight,1),0),Xi=(i,e)=>1-Math.abs(Math.max(Math.min((e-(i.offsetTop-i.offsetHeight))/i.offsetHeight-1,1),-1));qr&&jr&&Yr&&Kr&&kf();function kf(){const i=document.createElement("div");i.setAttribute("class","phases_object"),document.body.appendChild(i);const e=new xt(45,window.innerWidth/window.innerHeight,1,1e4);e.position.z=80;const t=new bf,n=new Df(6710886,1);t.add(n);const r=new Uf(16777215,1);e.add(r),t.add(e);const s=new _o;new zf(s).load("https://coventures.vercel.app/co_box.obj",function(a){const u=new kn,l=a.children.map(g=>{if(g instanceof At){const m=new mo({color:xo,specular:3355443,shininess:50}),h=new At(g.geometry,m);return h.rotation.z=-fn,u.add(h),m}});t.add(u);const c=new po({antialias:!0,alpha:!0});c.setPixelRatio(window.devicePixelRatio),c.setSize(window.innerWidth,window.innerHeight),i.appendChild(c.domElement);function d(){za=window.innerWidth/2,Ga=window.innerHeight/2,e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix(),c.setSize(window.innerWidth,window.innerHeight)}function f(g){Oa=(g.clientX-za)/10,Ba=(g.clientY-Ga)/10}function p(){requestAnimationFrame(p),_()}p();function _(){e.position.x-=(Oa+e.position.x)*.02,e.position.y-=(-Ba+e.position.y)*.02;const m=window.scrollY-Bt;Bt+=m*Vf;const h=[Xi(qr,Bt),Xi(jr,Bt),Xi(Yr,Bt),Xi(Kr,Bt)].reduce((M,R)=>M+R,0),y=[Wi(qr,Bt),Wi(jr,Bt),Wi(Yr,Bt),Wi(Kr,Bt)];l[0]&&l[0].color.setHex(ki(0,y,h)),l[2]&&l[2].color.setHex(ki(1,y,h)),l[3]&&l[3].color.setHex(ki(2,y,h)),l[1]&&l[1].color.setHex(ki(3,y,h)),u.rotation.z=-fn+Tt(y[0])*fn+Tt(y[1])*fn+Tt(y[2])*fn+Tt(y[3])*fn,u.rotation.y=Tt(y[0])*Hi-Tt(y[1])*Hi+Tt(y[2])*Hi-Tt(y[3])*Hi,u.rotation.x=Tt(y[0])*Vi-(Tt(y[1])*Vi+fn)+Tt(y[2])*Vi-Tt(y[3])*Vi,e.lookAt(t.position),c.render(t,e)}document.addEventListener("mousemove",f),window.addEventListener("resize",d)})}
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.