vendor: 4,170 bytes, lines 1-5
1import{_ as il}from"./DJ4GJ9ow.js";import{_ as sl}from"./CLCWtx-t.js";import{_ as rl}from"./CDOjLp4_.js";import{_ as al,M as ol,o as In,c as hi,P as cl,b as Qi,w as js,a as Ii,J as xa,t as Ks,j as Zs,Q as ll,F as hl,k as ul,i as dl,d as fl}from"./DyqPQUfp.js";import{_ as pl}from"./BfcJNqls.js";/** 2 * @license 3 * Copyright 2010-2023 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Zr="159",ml=0,va=1,gl=2,lc=1,_l=2,on=3,un=0,Rt=1,Yt=2,yn=0,pi=1,Ma=2,Sa=3,ya=4,xl=5,Nn=100,vl=101,Ml=102,Ea=103,Ta=104,Sl=200,yl=201,El=202,Tl=203,Ur=204,Nr=205,Al=206,bl=207,wl=208,Rl=209,Cl=210,Ll=211,Pl=212,Il=213,Dl=214,Ul=0,Nl=1,Fl=2,Ls=3,Ol=4,Bl=5,Hl=6,zl=7,hc=0,Gl=1,kl=2,En=0,Vl=1,Wl=2,Xl=3,ql=4,Yl=5,Aa="attached",jl="detached",uc=300,_i=301,xi=302,Fr=303,Or=304,Bs=306,vi=1e3,Nt=1001,Ps=1002,ut=1003,Br=1004,Rs=1005,wt=1006,dc=1007,kn=1008,Tn=1009,Kl=1010,Zl=1011,$r=1012,fc=1013,Sn=1014,cn=1015,qi=1016,pc=1017,mc=1018,Hn=1020,$l=1021,Ft=1023,Jl=1024,Ql=1025,zn=1026,Mi=1027,eh=1028,gc=1029,th=1030,_c=1031,xc=1033,$s=33776,Js=33777,Qs=33778,er=33779,ba=35840,wa=35841,Ra=35842,Ca=35843,vc=36196,La=37492,Pa=37496,Ia=37808,Da=37809,Ua=37810,Na=37811,Fa=37812,Oa=37813,Ba=37814,Ha=37815,za=37816,Ga=37817,ka=37818,Va=37819,Wa=37820,Xa=37821,tr=36492,qa=36494,Ya=36495,nh=36283,ja=36284,Ka=36285,Za=36286,ih=2200,sh=2201,rh=2202,Yi=2300,Si=2301,nr=2302,ui=2400,di=2401,Is=2402,Jr=2500,ah=2501,oh=0,Mc=1,Hr=2,Sc=3e3,Gn=3001,ch=3200,lh=3201,yc=0,hh=1,Ot="",it="srgb",mt="srgb-linear",Qr="display-p3",Hs="display-p3-linear",Ds="linear",Je="srgb",Us="rec709",Ns="p3",Yn=7680,$a=519,uh=512,dh=513,fh=514,Ec=515,ph=516,mh=517,gh=518,_h=519,zr=35044,Ja="300 es",Gr=1035,ln=2e3,Fs=2001;class qn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const _t=["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"];let Qa=1234567;const ki=Math.PI/180,yi=180/Math.PI;function Vt(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(_t[s&255]+_t[s>>8&255]+_t[s>>16&255]+_t[s>>24&255]+"-"+_t[e&255]+_t[e>>8&255]+"-"+_t[e>>16&15|64]+_t[e>>24&255]+"-"+_t[t&63|128]+_t[t>>8&255]+"-"+_t[t>>16&255]+_t[t>>24&255]+_t[n&255]+_t[n>>8&255]+_t[n>>16&255]+_t[n>>24&255]).toLowerCase()}function vt(s,e,t){return Math.max(e,Math.min(t,s))}function ea(s,e){return(s%e+e)%e}function xh(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}
vendor: 19,660 bytes, line 5
5function vh(s,e,t){return s!==e?(t-s)/(e-s):0}function Vi(s,e,t){return(1-t)*s+t*e}function Mh(s,e,t,n){return Vi(s,e,1-Math.exp(-t*n))}function Sh(s,e=1){return e-Math.abs(ea(s,e*2)-e)}function yh(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Eh(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Th(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Ah(s,e){return s+Math.random()*(e-s)}function bh(s){return s*(.5-Math.random())}function wh(s){s!==void 0&&(Qa=s);let e=Qa+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Rh(s){return s*ki}function Ch(s){return s*yi}function kr(s){return(s&s-1)===0&&s!==0}function Lh(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Os(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Ph(s,e,t,n,i){const r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),p=r((n-e)/2),g=a((n-e)/2);switch(i){case"XYX":s.set(o*h,c*u,c*d,o*l);break;case"YZY":s.set(c*d,o*h,c*u,o*l);break;case"ZXZ":s.set(c*u,c*d,o*h,o*l);break;case"XZX":s.set(o*h,c*g,c*p,o*l);break;case"YXY":s.set(c*p,o*h,c*g,o*l);break;case"ZYZ":s.set(c*g,c*p,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function jt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function Ke(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Ih={DEG2RAD:ki,RAD2DEG:yi,generateUUID:Vt,clamp:vt,euclideanModulo:ea,mapLinear:xh,inverseLerp:vh,lerp:Vi,damp:Mh,pingpong:Sh,smoothstep:yh,smootherstep:Eh,randInt:Th,randFloat:Ah,randFloatSpread:bh,seededRandom:wh,degToRad:Rh,radToDeg:Ch,isPowerOfTwo:kr,ceilPowerOfTwo:Lh,floorPowerOfTwo:Os,setQuaternionFromProperEuler:Ph,normalize:Ke,denormalize:jt};class ke{constructor(e=0,t=0){ke.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(vt(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),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oe{constructor(e,t,n,i,r,a,o,c,l){Oe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[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,i=t.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],p=n[5],g=n[8],_=i[0],m=i[3],f=i[6],E=i[1],x=i[4],T=i[7],A=i[2],w=i[5],C=i[8];return r[0]=a*_+o*E+c*A,r[3]=a*m+o*x+c*w,r[6]=a*f+o*T+c*C,r[1]=l*_+h*E+u*A,r[4]=l*m+h*x+u*w,r[7]=l*f+h*T+u*C,r[2]=d*_+p*E+g*A,r[5]=d*m+p*x+g*w,r[8]=d*f+p*T+g*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,p=l*r-a*c,g=t*u+n*d+i*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*c)*_,e[5]=(i*r-o*t)*_,e[6]=p*_,e[7]=(n*c-l*t)*_,e[8]=(a*t-n*r)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,o){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ir.makeScale(e,t)),this}rotate(e){return this.premultiply(ir.makeRotation(-e)),this}translate(e,t){return this.premultiply(ir.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ir=new Oe;function Tc(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function ji(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Dh(){const s=ji("canvas");return s.style.display="block",s}const eo={};function Wi(s){s in eo||(eo[s]=!0,console.warn(s))}const to=new Oe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),no=new Oe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),es={[mt]:{transfer:Ds,primaries:Us,toReference:s=>s,fromReference:s=>s},[it]:{transfer:Je,primaries:Us,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[Hs]:{transfer:Ds,primaries:Ns,toReference:s=>s.applyMatrix3(no),fromReference:s=>s.applyMatrix3(to)},[Qr]:{transfer:Je,primaries:Ns,toReference:s=>s.convertSRGBToLinear().applyMatrix3(no),fromReference:s=>s.applyMatrix3(to).convertLinearToSRGB()}},Uh=new Set([mt,Hs]),qe={enabled:!0,_workingColorSpace:mt,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(s){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!s},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!Uh.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=es[e].toReference,i=es[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return es[s].primaries},getTransfer:function(s){return s===Ot?Ds:es[s].transfer}};function mi(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function sr(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let jn;class Ac{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{jn===void 0&&(jn=ji("canvas")),jn.width=e.width,jn.height=e.height;const n=jn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=jn}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=ji("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=mi(r[a]/255)*255;return n.putImageData(i,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(mi(t[n]/255)*255):t[n]=mi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Nh=0;class bc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Nh++}),this.uuid=Vt(),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:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(rr(i[a].image)):r.push(rr(i[a]))}else r=rr(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function rr(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?Ac.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Fh=0;class pt extends qn{constructor(e=pt.DEFAULT_IMAGE,t=pt.DEFAULT_MAPPING,n=Nt,i=Nt,r=wt,a=kn,o=Ft,c=Tn,l=pt.DEFAULT_ANISOTROPY,h=Ot){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Fh++}),this.uuid=Vt(),this.name="",this.source=new bc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Oe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof h=="string"?this.colorSpace=h:(Wi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=h===Gn?it:Ot),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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==uc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case vi:e.x=e.x-Math.floor(e.x);break;case Nt:e.x=e.x<0?0:1;break;case Ps: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 vi:e.y=e.y-Math.floor(e.y);break;case Nt:e.y=e.y<0?0:1;break;case Ps: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 Wi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===it?Gn:Sc}set encoding(e){Wi("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Gn?it:Ot}}pt.DEFAULT_IMAGE=null;pt.DEFAULT_MAPPING=uc;pt.DEFAULT_ANISOTROPY=1;class Ze{constructor(e=0,t=0,n=0,i=1){Ze.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],p=c[5],g=c[9],_=c[2],m=c[6],f=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(l+1)/2,T=(p+1)/2,A=(f+1)/2,w=(h+d)/4,C=(u+_)/4,B=(g+m)/4;return x>T&&x>A?x<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(x),i=w/n,r=C/n):T>A?T<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(T),n=w/i,r=B/i):A<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(A),n=C/r,i=B/r),this.set(n,i,r,t),this}let E=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(u-_)/E,this.z=(d-h
vendor: 2,890 bytes, line 5
5)/E,this.w=Math.acos((l+p+f-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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Oh extends qn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ze(0,0,e,t),this.scissorTest=!1,this.viewport=new Ze(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Wi("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace
vendor: 9,704 bytes, line 5
5=n.encoding===Gn?it:Ot),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:wt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new pt(i,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,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}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 bc(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 Vn extends Oh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class wc extends pt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ut,this.minFilter=ut,this.wrapR=Nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Bh extends pt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ut,this.minFilter=ut,this.wrapR=Nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Wt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3];const d=r[a+0],p=r[a+1],g=r[a+2],_=r[a+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=g,e[t+3]=_;return}if(u!==_||c!==d||l!==p||h!==g){let m=1-o;const f=c*d+l*p+h*g+u*_,E=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const A=Math.sqrt(x),w=Math.atan2(A,f*E);m=Math.sin(m*w)/A,o=Math.sin(o*w)/A}const T=o*E;if(c=c*m+d*T,l=l*m+p*T,h=h*m+g*T,u=u*m+_*T,m===1-o){const A=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=A,l*=A,h*=A,u*=A}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a],d=r[a+1],p=r[a+2],g=r[a+3];return e[t]=o*g+h*u+c*p-l*d,e[t+1]=c*g+h*d+l*u-o*p,e[t+2]=l*g+h*p+o*d-c*u,e[t+3]=h*g-o*u-c*d-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,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(r/2),d=c(n/2),p=c(i/2),g=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u-d*p*g;break;case"YXZ":this._x=d*h*u+l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u+d*p*g;break;case"ZXY":this._x=d*h*u-l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u-d*p*g;break;case"ZYX":this._x=d*h*u-l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u+d*p*g;break;case"YZX":this._x=d*h*u+l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u-d*p*g;break;case"XZY":this._x=d*h*u-l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(h-c)*p,this._y=(r-l)*p,this._z=(a-i)*p}else if(n>o&&n>u){const p=2*Math.sqrt(1+n-o-u);this._w=(h-c)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+l)/p}else if(o>u){const p=2*Math.sqrt(1+o-n-u);this._w=(r-l)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(c+h)/p}else{const p=2*Math.sqrt(1+u-n-o);this._w=(a-i)/p,this._x=(r+l)/p,this._y=(c+h)/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(vt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+i*l-r*c,this._y=i*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const c=1-o*o;if(c<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,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),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}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(io.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(io.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}
vendor: 24,133 bytes, line 5
5applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+c*l+a*u-o*h,this.y=n+c*h+o*l-r*u,this.z=i+c*u+r*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ar.copy(this).projectOnVector(e),this.sub(ar)}reflect(e){return this.sub(ar.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(vt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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 ar=new L,io=new Wt;class dn{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(Ht.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ht.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ht.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ht):Ht.fromBufferAttribute(r,a),Ht.applyMatrix4(e.matrixWorld),this.expandByPoint(Ht);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ts.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ts.copy(n.boundingBox)),ts.applyMatrix4(e.matrixWorld),this.union(ts)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[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,Ht),Ht.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Di),ns.subVectors(this.max,Di),Kn.subVectors(e.a,Di),Zn.subVectors(e.b,Di),$n.subVectors(e.c,Di),pn.subVectors(Zn,Kn),mn.subVectors($n,Zn),wn.subVectors(Kn,$n);let t=[0,-pn.z,pn.y,0,-mn.z,mn.y,0,-wn.z,wn.y,pn.z,0,-pn.x,mn.z,0,-mn.x,wn.z,0,-wn.x,-pn.y,pn.x,0,-mn.y,mn.x,0,-wn.y,wn.x,0];return!or(t,Kn,Zn,$n,ns)||(t=[1,0,0,0,1,0,0,0,1],!or(t,Kn,Zn,$n,ns))?!1:(is.crossVectors(pn,mn),t=[is.x,is.y,is.z],or(t,Kn,Zn,$n,ns))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ht).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ht).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(en[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),en[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),en[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),en[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),en[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),en[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),en[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),en[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(en),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 en=[new L,new L,new L,new L,new L,new L,new L,new L],Ht=new L,ts=new dn,Kn=new L,Zn=new L,$n=new L,pn=new L,mn=new L,wn=new L,Di=new L,ns=new L,is=new L,Rn=new L;function or(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Rn.fromArray(s,r);const o=i.x*Math.abs(Rn.x)+i.y*Math.abs(Rn.y)+i.z*Math.abs(Rn.z),c=e.dot(Rn),l=t.dot(Rn),h=n.dot(Rn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const Hh=new dn,Ui=new L,cr=new L;class Zt{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):Hh.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ui.subVectors(e,this.center);const t=Ui.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ui,i/n),this.radius+=i}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):(cr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ui.copy(e.center).add(cr)),this.expandByPoint(Ui.copy(e.center).sub(cr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const tn=new L,lr=new L,ss=new L,gn=new L,hr=new L,rs=new L,ur=new L;class zs{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,tn)),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=tn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tn.copy(this.origin).addScaledVector(this.direction,t),tn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){lr.copy(e).add(t).multiplyScalar(.5),ss.copy(t).sub(e).normalize(),gn.copy(this.origin).sub(lr);const r=e.distanceTo(t)*.5,a=-this.direction.dot(ss),o=gn.dot(this.direction),c=-gn.dot(ss),l=gn.lengthSq(),h=Math.abs(1-a*a);let u,d,p,g;if(h>0)if(u=a*c-o,d=a*o-c,g=r*h,u>=0)if(d>=-g)if(d<=g){const _=1/h;u*=_,d*=_,p=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),p=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),p=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),p=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(lr).addScaledVector(ss,d),p}intersectSphere(e,t){tn.subVectors(e.center,this.origin);const n=tn.dot(this.direction),i=tn.dot(tn)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,tn)!==null}intersectTriangle(e,t,n,i,r){hr.subVectors(t,e),rs.subVectors(n,e),ur.crossVectors(hr,rs);let a=this.direction.dot(ur),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;gn.subVectors(this.origin,e);const c=o*this.direction.dot(rs.crossVectors(gn,rs));if(c<0)return null;const l=o*this.direction.dot(hr.cross(gn));if(l<0||c+l>a)return null;const h=-o*gn.dot(ur);return h<0?null:this.at(h/a,r)}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 Be{constructor(e,t,n,i,r,a,o,c,l,h,u,d,p,g,_,m){Be.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l,h,u,d,p,g,_,m)}set(e,t,n,i,r,a,o,c,l,h,u,d,p,g,_,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=i,f[1]=r,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=h,f[10]=u,f[14]=d,f[3]=p,f[7]=g,f[11]=_,f[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 Be().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Jn.setFromMatrixColumn(e,0).length(),r=1/Jn.setFromMatrixColumn(e,1).length(),a=1/Jn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const d=a*h,p=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=p+g*l,t[5]=d-_*l,t[9]=-o*c,t[2]=_-d*l,t[6]=g+p*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,p=c*u,g=l*h,_=l*u;t[0]=d+_*o,t[4]=g*o-p,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=p*o-g,t[6]=_+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,p=c*u,g=l*h,_=l*u;t[0]=d-_*o,t[4]=-a*u,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*h,p=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=g*l-p,t[8]=d*l+_,t[1]=c*u,t[5]=_*l+d,t[9]=p*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,p=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=_-d*u,t[8]=g*u+p,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=p*u+g,t[10]=d-_*u}else if(e.order==="XZY"){const d=a*c,p=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+_,t[5]=a*h,t[9]=p*u-g,t[2]=g*u-p,t[6]=o*h,t[10]=_*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zh,e,Gh)}lookAt(e,t,n){const i=this.elements;return Lt.subVectors(e,t),Lt.lengthSq()===0&&(Lt.z=1),Lt.normalize(),_n.crossVectors(n,Lt),_n.lengthSq()===0&&(Math.abs(n.z)===1?Lt.x+=1e-4:Lt.z+=1e-4,Lt.normalize(),_n.crossVectors(n,Lt)),_n.normalize(),as.crossVectors(Lt,_n),i[0]=_n.x,i[4]=as.x,i[8]=Lt.x,i[1]=_n.y,i[5]=as.y,i[9]=Lt.y,i[2]=_n.z,i[6]=as.z,i[10]=Lt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],p=n[13],g=n[2],_=n[6],m=n[10],f=n[14],E=n[3],x=n[7],T=n[11],A=n[15],w=i[0],C=i[4],B=i[8],M=i[12],b=i[1],k=i[5],X=i[9],J=i[13],P=i[2],H=i[6],q=i[10],V=i[14],ne=i[3],W=i[7],j=i[11],Q=i[15];return r[0]=a*w+o*b+c*P+l*ne,r[4]=a*C+o*k+c*H+l*W,r[8]=a*B+o*X+c*q+l*j,r[12]=a*M+o*J+c*V+l*Q,r[1]=h*w+u*b+d*P+p*ne,r[5]=h*C+u*k+d*H+p*W,r[9]=h*B+u*X+d*q+p*j,r[13]=h*M+u*J+d*V+p*Q,r[2]=g*w+_*b+m*P+f*ne,r[6]=g*C+_*k+m*H+f*W,r[10]=g*B+_*X+m*q+f*j,r[14]=g*M+_*J+m*V+f*Q,r[3]=E*w+x*b+T*P+A*ne,r[7]=E*C+x*k+T*H+A*W,r[11]=E*B+x*X+T*q+A*j,r[15]=E*M+x*J+T*V+A*Q,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],p=e[14],g=e[3],_=e[7],m=e[11],f=e[15];return g*(+r*c*u-i*l*u-r*o*d+n*l*d+i*o*p-n*c*p)+_*(+t*c*p-t*l*d+r*a*d-i*a*p+i*l*h-r*c*h)+m*(+t*l*u-t*o*p-r*a*u+n*a*p+r*o*h-n*l*h)+f*(-i*o*h-t*c*u+t*o*d+i*a*u-n*a*d+n*c*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],p=e[11],g=e[12],_=e[13],m=e[14],f=e[15],E=u*m*l-_*d*l+_*c*p-o*m*p-u*c*f+o*d*f,x=g*d*l-h*m*l-g*c*p+a*m*p+h*c*f-a*d*f,T=h*_*l-g*u*l+g*o*p-a*_*p-h*o*f+a*u*f,A=g*u*c-h*_*c-g*o*d+a*_*d+h*o*m-a*u*m,w=t*E+n*x+i*T+r*A;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return e[0]=E*C,e[1]=(_*d*r-u*m*r-_*i*p+n*m*p+u*i*f-n*d*f)*C,e[2]=(o*m*r-_*c*r+_*i*l-n*m*l-o*i*f+n*c*f)*C,e[3]=(u*c*r-o*d*r-u*i*l+n*d*l+o*i*p-n*c*p)*C,e[4]=x*C,e[5]=(h*m*r-g*d*r+g*i*p-t*m*p-h*i*f+t*d*f)*C,e[6]=(g*c*r-a*m*r-g*i*l+t*m*l+a*i*f-t*c*f)*C,e[7]=(a*d*r-h*c*r+h*i*l-t*d*l-a*i*p+t*c*p)*C,e[8]=T*C,e[9]=(g*u*r-h*_*r-g*n*p+t*_*p+h*n*f-t*u*f)*C,e[10]=(a*_*r-g*o*r+g*n*l-t*_*l-a*n*f+t*o*f)*C,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*p-t*o*p)*C,e[12]=A*C,e[13]=(h*_*i-g*u*i+g*n*d-t*_*d-h*n*m+t*u*m)*C,e[14]=(g*o*i-a*_*i-g*n*c+t*_*c+a*n*m-t*o*m)*C,e[15]=(a*u*i-h*o*i+h*n*c-t*u*c-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,p=r*h,g=r*u,_=a*h,m=a*u,f=o*u,E=c*l,x=c*h,T=c*u,A=n.x,w=n.y,C=n.z;return i[0]=(1-(_+f))*A,i[1]=(p+T)*A,i[2]=(g-x)*A,i[3]=0,i[4]=(p-T)*w,i[5]=(1-(d+f))*w,i[6]=(m+E)*w,i[7]=0,i[8]=(g+x)*C,i[9]=(m-E)*C,i[10]=(1-(d+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Jn.set(i[0],i[1],i[2]).length();const a=Jn.set(i[4],i[5],i[6]).length(),o=Jn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],zt.copy(this);const l=1/r,h=1/a,u=1/o;return zt.elements[0]*=l,zt.elements[1]*=l,zt.elements[2]*=l,zt.elements[4]*=h,zt.elements[5]*=h,zt.elements[6]*=h,zt.elements[8]*=u,zt.elements[9]*=u,zt.elements[10]*=u,t.setFromRotationMatrix(zt),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=ln){const c=this.elements,l=2*r/(t-e),h=2*r/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i);let p,g;if(o===ln)p=-(a+r)/(a-r),g=-2*a*r/(a-r);else if(o===Fs)p=-a/(a-r),g=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=ln){const c=this.elements,l=1/(t-e),h=1/(n-i),u=1/(a-r),d=(t+e)*l,p=(n+i)*h;let g,_;if(o===ln)g=(a+r)*u,_=-2*u;else if(o===Fs)g=r*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-p,c[2]=0,c[6]=0,c[10]=_,c[14]=-g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}
vendor: 4,580 bytes, line 5
5const Jn=new L,zt=new Be,zh=new L(0,0,0),Gh=new L(1,1,1),_n=new L,as=new L,Lt=new L,so=new Be,ro=new Wt;class Gs{constructor(e=0,t=0,n=0,i=Gs.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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 i=e.elements,r=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(vt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-vt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(vt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-vt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(vt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-vt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,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 so.makeRotationFromQuaternion(e),this.setFromRotationMatrix(so,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ro.setFromEuler(this),this.setFromQuaternion(ro,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}}Gs.DEFAULT_ORDER="XYZ";class Rc{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 kh=0;const ao=new L,Qn=new Wt,nn=new Be,os=new L,Ni=new L,Vh=new L,Wh=new Wt,oo=new L(1,0,0),co=new L(0,1,0),lo=new L(0,0,1),Xh={type:"added"},qh={type:"removed"};class tt extends qn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=Vt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tt.DEFAULT_UP.clone();const e=new L,t=new Gs,n=new Wt,i=new L(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Be},normalMatrix:{value:new Oe}}),this.matrix=new Be,this.matrixWorld=new Be,this.matrixAutoUpdate=tt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Rc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 11,568 bytes, line 5
5setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.multiply(Qn),this}rotateOnWorldAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.premultiply(Qn),this}rotateX(e){return this.rotateOnAxis(oo,e)}rotateY(e){return this.rotateOnAxis(co,e)}rotateZ(e){return this.rotateOnAxis(lo,e)}translateOnAxis(e,t){return ao.copy(e).applyQuaternion(this.quaternion),this.position.add(ao.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(oo,e)}translateY(e){return this.translateOnAxis(co,e)}translateZ(e){return this.translateOnAxis(lo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(nn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?os.copy(e):os.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ni.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?nn.lookAt(Ni,os,this.up):nn.lookAt(os,Ni,this.up),this.quaternion.setFromRotationMatrix(nn),i&&(nn.extractRotation(i.matrixWorld),Qn.setFromRotationMatrix(nn),this.quaternion.premultiply(Qn.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(Xh)):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(qh)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),nn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),nn.multiply(e.parent.matrixWorld)),e.applyMatrix4(nn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ni,e,Vh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ni,Wh,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,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const r=t[n];(r.matrixWorldAutoUpdate===!0||e===!0)&&r.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 i=this.children;for(let r=0,a=i.length;r<a;r++){const o=i[r];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];i.animations.push(r(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}tt.DEFAULT_UP=new L(0,1,0);tt.DEFAULT_MATRIX_AUTO_UPDATE=!0;tt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Gt=new L,sn=new L,dr=new L,rn=new L,ei=new L,ti=new L,ho=new L,fr=new L,pr=new L,mr=new L;let cs=!1;class kt{constructor(e=new L,t=new L,n=new L){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Gt.subVectors(e,t),i.cross(Gt);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Gt.subVectors(i,t),sn.subVectors(n,t),dr.subVectors(e,t);const a=Gt.dot(Gt),o=Gt.dot(sn),c=Gt.dot(dr),l=sn.dot(sn),h=sn.dot(dr),u=a*l-o*o;if(u===0)return r.set(-2,-1,-1);const d=1/u,p=(l*c-o*h)*d,g=(a*h-o*c)*d;return r.set(1-p-g,g,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,rn),rn.x>=0&&rn.y>=0&&rn.x+rn.y<=1}static getUV(e,t,n,i,r,a,o,c){return cs===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),cs=!0),this.getInterpolation(e,t,n,i,r,a,o,c)}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,rn),c.setScalar(0),c.addScaledVector(r,rn.x),c.addScaledVector(a,rn.y),c.addScaledVector(o,rn.z),c}static isFrontFacing(e,t,n,i){return Gt.subVectors(n,t),sn.subVectors(e,t),Gt.cross(sn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Gt.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),Gt.cross(sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return cs===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),cs=!0),kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}getInterpolation(e,t,n,i,r){return kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;ei.subVectors(i,n),ti.subVectors(r,n),fr.subVectors(e,n);const c=ei.dot(fr),l=ti.dot(fr);if(c<=0&&l<=0)return t.copy(n);pr.subVectors(e,i);const h=ei.dot(pr),u=ti.dot(pr);if(h>=0&&u<=h)return t.copy(i);const d=c*u-h*l;
vendor: 6,683 bytes, line 5
5if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(ei,a);mr.subVectors(e,r);const p=ei.dot(mr),g=ti.dot(mr);if(g>=0&&p<=g)return t.copy(r);const _=p*l-c*g;if(_<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(ti,o);const m=h*g-p*u;if(m<=0&&u-h>=0&&p-g>=0)return ho.subVectors(r,i),o=(u-h)/(u-h+(p-g)),t.copy(i).addScaledVector(ho,o);const f=1/(m+_+d);return a=_*f,o=d*f,t.copy(n).addScaledVector(ei,a).addScaledVector(ti,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Cc={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},xn={h:0,s:0,l:0},ls={h:0,s:0,l:0};function gr(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class Ae{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=it){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qe.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,qe.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=qe.workingColorSpace){if(e=ea(e,1),t=vt(t,0,1),n=vt(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=gr(a,r,e+1/3),this.g=gr(a,r,e),this.b=gr(a,r,e-1/3)}return qe.toWorkingColorSpace(this,i),this}setStyle(e,t=it){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,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=it){const n=Cc[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=mi(e.r),this.g=mi(e.g),this.b=mi(e.b),this}copyLinearToSRGB(e){return this.r=sr(e.r),this.g=sr(e.g),this.b=sr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=it){return qe.fromWorkingColorSpace(xt.copy(this),e),Math.round(vt(xt.r*255,0,255))*65536+Math.round(vt(xt.g*255,0,255))*256+Math.round(vt(xt.b*255,0,255))}getHexString(e=it){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qe.workingColorSpace){qe.fromWorkingColorSpace(xt.copy(this),t);const n=xt.r,i=xt.g,r=xt.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-n)/u+2;break;case r:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=qe.workingColorSpace){return qe.fromWorkingColorSpace(xt.copy(this),t),e.r=xt.r,e.g=xt.g,e.b
vendor: 3,458 bytes, line 5
5=xt.b,e}getStyle(e=it){qe.fromWorkingColorSpace(xt.copy(this),e);const t=xt.r,n=xt.g,i=xt.b;return e!==it?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(xn),this.setHSL(xn.h+e,xn.s+t,xn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(xn),e.getHSL(ls);const n=Vi(xn.h,ls.h,t),i=Vi(xn.s,ls.s,t),r=Vi(xn.l,ls.l,t);return this.setHSL(n,i,r),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,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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 xt=new Ae;Ae.NAMES=Cc;let Yh=0;class Kt extends qn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Yh++}),this.uuid=Vt(),this.name="",this.type="Material",this.blending=pi,this.side=un,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ur,this.blendDst=Nr,this.blendEquation=Nn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ae(0,0,0),this.blendAlpha=0,this.depthFunc=Ls,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$a,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yn,this.stencilZFail=Yn,this.stencilZPass=Yn,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 i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 16,670 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&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.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.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!==pi&&(n.blending=this.blending),this.side!==un&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ur&&(n.blendSrc=this.blendSrc),this.blendDst!==Nr&&(n.blendDst=this.blendDst),this.blendEquation!==Nn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ls&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$a&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Yn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Yn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const a=[];for(const o in r){const c=r[o];delete c.metadata,a.push(c)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class On extends Kt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ae(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=hc,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 rt=new L,hs=new ke;class bt{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=zr,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=cn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];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++)hs.fromBufferAttribute(this,t),hs.applyMatrix3(e),this.setXY(t,hs.x,hs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix3(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix4(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.applyNormalMatrix(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)rt.fromBufferAttribute(this,t),rt.transformDirection(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=jt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Ke(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=jt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=jt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=jt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=jt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ke(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),i=Ke(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),i=Ke(i,this.array),r=Ke(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,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!==zr&&(e.usage=this.usage),e}}class Lc extends bt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Pc extends bt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class hn extends bt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let jh=0;const Dt=new Be,_r=new tt,ni=new L,Pt=new dn,Fi=new dn,ht=new L;class $t extends qn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jh++}),this.uuid=Vt(),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(Tc(e)?Pc:Lc)(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 r=new Oe().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dt.makeRotationFromQuaternion(e),this.applyMatrix4(Dt),this}rotateX(e){return Dt.makeRotationX(e),this.applyMatrix4(Dt),this}rotateY(e){return Dt.makeRotationY(e),this.applyMatrix4(Dt),this}rotateZ(e){return Dt.makeRotationZ(e),this.applyMatrix4(Dt),this}translate(e,t,n){return Dt.makeTranslation(e,t,n),this.applyMatrix4(Dt),this}scale(e,t,n){return Dt.makeScale(e,t,n),this.applyMatrix4(Dt),this}lookAt(e){return _r.lookAt(e),_r.updateMatrix(),this.applyMatrix4(_r.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ni).negate(),this.translate(ni.x,ni.y,ni.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new hn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new dn);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,i=t.length;n<i;n++){const r=t[n];Pt.setFromBufferAttribute(r),this.morphTargetsRelative?(ht.addVectors(this.boundingBox.min,Pt.min),this.boundingBox.expandByPoint(ht),ht.addVectors(this.boundingBox.max,Pt.max),this.boundingBox.expandByPoint(ht)):(this.boundingBox.expandByPoint(Pt.min),this.boundingBox.expandByPoint(Pt.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 Zt);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(Pt.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];Fi.setFromBufferAttribute(o),this.morphTargetsRelative?(ht.addVectors(Pt.min,Fi.min),Pt.expandByPoint(ht),ht.addVectors(Pt.max,Fi.max),Pt.expandByPoint(ht)):(Pt.expandByPoint(Fi.min),Pt.expandByPoint(Fi.max))}Pt.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)ht.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(ht));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)ht.fromBufferAttribute(o,l),c&&(ni.fromBufferAttribute(e,l),ht.add(ni)),i=Math.max(i,n.distanceToSquared(ht))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,r=t.normal.array,a=t.uv.array,o=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new bt(new Float32Array(4*o),4));const c=this.getAttribute("tangent").array,l=[],h=[];for(let b=0;b<o;b++)l[b]=new L,h[b]=new L;const u=new L,d=new L,p=new L,g=new ke,_=new ke,m=new ke,f=new L,E=new L;function x(b,k,X){u.fromArray(i,b*3),d.fromArray(i,k*3),p.fromArray(i,X*3),g.fromArray(a,b*2),_.fromArray(a,k*2),m.fromArray(a,X*2),d.sub(u),p.sub(u),_.sub(g),m.sub(g);const J=1/(_.x*m.y-m.x*_.y);isFinite(J)&&(f.copy(d).multiplyScalar(m.y).addScaledVector(p,-_.y).multiplyScalar(J),E.copy(p).multiplyScalar(_.x).addScaledVector(d,-m.x).multiplyScalar(J),l[b].add(f),l[k].add(f),l[X].add(f),h[b].add(E),h[k].add(E),h[X].add(E))}let T=this.groups;T.length===0&&(T=[{start:0,count:n.length}]);for(let b=0,k=T.length;b<k;++b){const X=T[b],J=X.start,P=X.count;for(let H=J,q=J+P;H<q;H+=3)x(n[H+0],n[H+1],n[H+2])}const A=new L,w=new L,C=new L,B=new L;function M(b){C.fromArray(r,b*3),B.copy(C);const k=l[b];A.copy(k),A.sub(C.multiplyScalar(C.dot(k))).normalize(),w.crossVectors(B,k);const J=w.dot(h[b])<0?-1:1;c[b*4]=A.x,c[b*4+1]=A.y,c[b*4+2]=A.z,c[b*4+3]=J}for(let b=0,k=T.length;b<k;++b){const X=T[b],J=X.start,P=X.count;for(let H=J,q=J+P;H<q;H+=3)M(n[H+0]),M(n[H+1]),M(n[H+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new bt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const i=new L,r=new L,a=new L,o=new L,c=new L,l=new L,h=new L,u=new L;if(e)for(let d=0,p=e.count;d<p;d+=3){const g=e.getX(d+0),_=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,g),r.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,p=t.count;d<p;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ht.fromBufferAttribute(e,t),ht.normalize(),e.setXYZ(t,ht.x,ht.y,ht.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h);let p=0,g=0;for(let _=0,m=c.length;_<m;_++){o.isInterleavedBufferAttribute?p=c[_]*o.data.stride+o.offset:p=c[_]*h;for(let f=0;f<h;f++)d[g++]=l[p++]}return new bt(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new $t,n=this.index.array,i=this.attributes;for(const o in i){const c=i[o],l=e(c,n);t.setAttribute(o,l)}const r=this.morphAttributes;for(const o in r){const c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){const d=l[h],p=e(d,n);c.push(p)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 21,078 bytes, lines 5-44
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 c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){const p=l[u];h.push(p.toJSON(e.data))}h.length>0&&(i[c]=h,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new 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 i=e.attributes;for(const l in i){const h=i[l];this.setAttribute(l,h.clone(t))}const r=e.morphAttributes;for(const l in r){const h=[],u=r[l];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const uo=new Be,Cn=new zs,us=new Zt,fo=new L,ii=new L,si=new L,ri=new L,xr=new L,ds=new L,fs=new ke,ps=new ke,ms=new ke,po=new L,mo=new L,go=new L,gs=new L,_s=new L;class Bt extends tt{constructor(e=new $t,t=new On){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){ds.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(xr.fromBufferAttribute(u,e),a?ds.addScaledVector(xr,h):ds.addScaledVector(xr.sub(t),h))}t.add(ds)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),us.copy(n.boundingSphere),us.applyMatrix4(r),Cn.copy(e.ray).recast(e.near),!(us.containsPoint(Cn.origin)===!1&&(Cn.intersectSphere(us,fo)===null||Cn.origin.distanceToSquared(fo)>(e.far-e.near)**2))&&(uo.copy(r).invert(),Cn.copy(e.ray).applyMatrix4(uo),!(n.boundingBox!==null&&Cn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Cn)))}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,p=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=a[m.materialIndex],E=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let T=E,A=x;T<A;T+=3){const w=o.getX(T),C=o.getX(T+1),B=o.getX(T+2);i=xs(this,f,e,n,l,h,u,w,C,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const E=o.getX(m),x=o.getX(m+1),T=o.getX(m+2);i=xs(this,a,e,n,l,h,u,E,x,T),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=a[m.materialIndex],E=Math.max(m.start,p.start),x=Math.min(c.count,Math.min(m.start+m.count,p.start+p.count));for(let T=E,A=x;T<A;T+=3){const w=T,C=T+1,B=T+2;i=xs(this,f,e,n,l,h,u,w,C,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(c.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const E=m,x=m+1,T=m+2;i=xs(this,a,e,n,l,h,u,E,x,T),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function Kh(s,e,t,n,i,r,a,o){let c;if(e.side===Rt?c=n.intersectTriangle(a,r,i,!0,o):c=n.intersectTriangle(i,r,a,e.side===un,o),c===null)return null;_s.copy(o),_s.applyMatrix4(s.matrixWorld);const l=t.ray.origin.distanceTo(_s);return l<t.near||l>t.far?null:{distance:l,point:_s.clone(),object:s}}function xs(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,ii),s.getVertexPosition(c,si),s.getVertexPosition(l,ri);const h=Kh(s,e,t,n,ii,si,ri,gs);if(h){i&&(fs.fromBufferAttribute(i,o),ps.fromBufferAttribute(i,c),ms.fromBufferAttribute(i,l),h.uv=kt.getInterpolation(gs,ii,si,ri,fs,ps,ms,new ke)),r&&(fs.fromBufferAttribute(r,o),ps.fromBufferAttribute(r,c),ms.fromBufferAttribute(r,l),h.uv1=kt.getInterpolation(gs,ii,si,ri,fs,ps,ms,new ke),h.uv2=h.uv1),a&&(po.fromBufferAttribute(a,o),mo.fromBufferAttribute(a,c),go.fromBufferAttribute(a,l),h.normal=kt.getInterpolation(gs,ii,si,ri,po,mo,go,new L),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:c,c:l,normal:new L,materialIndex:0};kt.getNormal(ii,si,ri,u.normal),h.face=u}return h}class Ki extends $t{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const c=[],l=[],h=[],u=[];let d=0,p=0;g("z","y","x",-1,-1,n,t,e,a,r,0),g("z","y","x",1,-1,n,t,-e,a,r,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new hn(l,3)),this.setAttribute("normal",new hn(h,3)),this.setAttribute("uv",new hn(u,2));function g(_,m,f,E,x,T,A,w,C,B,M){const b=T/C,k=A/B,X=T/2,J=A/2,P=w/2,H=C+1,q=B+1;let V=0,ne=0;const W=new L;for(let j=0;j<q;j++){const Q=j*k-J;for(let ue=0;ue<H;ue++){const z=ue*b-X;W[_]=z*E,W[m]=Q*x,W[f]=P,l.push(W.x,W.y,W.z),W[_]=0,W[m]=0,W[f]=w>0?1:-1,h.push(W.x,W.y,W.z),u.push(ue/C),u.push(1-j/B),V+=1}}for(let j=0;j<B;j++)for(let Q=0;Q<C;Q++){const ue=d+Q+H*j,z=d+Q+H*(j+1),Y=d+(Q+1)+H*(j+1),ae=d+(Q+1)+H*j;c.push(ue,z,ae),c.push(z,Y,ae),ne+=6}o.addGroup(p,ne,M),p+=ne,d+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ki(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ei(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Tt(s){const e={};for(let t=0;t<s.length;t++){const n=Ei(s[t]);for(const i in n)e[i]=n[i]}return e}function Zh(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Ic(s){return s.getRenderTarget()===null?s.outputColorSpace:qe.workingColorSpace}const $h={clone:Ei,merge:Tt};var Jh=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,Qh=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class Wn extends Kt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Jh,this.fragmentShader=Qh,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=Ei(e.uniforms),this.uniformsGroups=Zh(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 i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Dc extends tt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Be,this.projectionMatrix=new Be,this.projectionMatrixInverse=new Be,this.coordinateSystem=ln}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class At extends Dc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=yi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ki*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return yi*2*Math.atan(Math.tan(ki*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ki*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ai=-90,oi=1;class eu extends tt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new At(ai,oi,e,t);i.layers=this.layers,this.add(i);const r=new At(ai,oi,e,t);r.layers=this.layers,this.add(r);const a=new At(ai,oi,e,t);a.layers=this.layers,this.add(a);const o=new At(ai,oi,e,t);o.layers=this.layers,this.add(o);const c=new At(ai,oi,e,t);c.layers=this.layers,this.add(c);const l=new At(ai,oi,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(const l of t)this.remove(l);if(e===ln)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Fs)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,p),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Uc extends pt{constructor(e,t,n,i,r,a,o,c,l,h){e=e!==void 0?e:[],t=t!==void 0?t:_i,super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tu extends Vn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Wi("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Gn?it:Ot),this.texture=new Uc(i,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:wt}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 `},i=new Ki(5,5,5),r=new Wn({name:"CubemapFromEquirect",uniforms:Ei(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Rt,blending:yn});r.uniforms.tEquirect.value=t;const a=new Bt(i,r),o=t.minFilter;return t.minFilter===kn&&(t.minFilter=wt),new eu(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}const vr=new L,nu=new L,iu=new Oe;class Dn{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,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=vr.subVectors(n,t).cross(nu.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(vr),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}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||iu.getNormalMatrix(e),i=this.coplanarPoint(vr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ln=new Zt,vs=new L;class ta{constructor(e=new Dn,t=new Dn,n=new Dn,i=new Dn,r=new Dn,a=new Dn){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ln){const n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],c=i[3],l=i[4],h=i[5],u=i[6],d=i[7],p=i[8],g=i[9],_=i[10],m=i[11],f=i[12],E=i[13],x=i[14],T=i[15];if(n[0].setComponents(c-r,d-l,m-p,T-f).normalize(),n[1].setComponents(c+r,d+l,m+p,T+f).normalize(),n[2].setComponents(c+a,d+h,m+g,T+E).normalize(),n[3].setComponents(c-a,d-h,m-g,T-E).normalize(),n[4].setComponents(c-o,d-u,m-_,T-x).normalize(),t===ln)n[5].setComponents(c+o,d+u,m+_,T+x).normalize();else if(t===Fs)n[5].setComponents(o,u,_,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ln.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ln)}intersectsSprite(e){return Ln.center.set(0,0,0),Ln.radius=.7071067811865476,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(vs.x=i.normal.x>0?e.max.x:e.min.x,vs.y=i.normal.y>0?e.max.y:e.min.y,vs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(vs)<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 Nc(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)}
44,stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function su(s,e){const t=e.isWebGL2,n=new WeakMap;function i(l,h){const u=l.array,d=l.usage,p=u.byteLength,g=s.createBuffer();s.bindBuffer(h,g),s.bufferData(h,u,d),l.onUploadCallback();let _;if(u instanceof Float32Array)_=s.FLOAT;else if(u instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)_=s.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=s.UNSIGNED_SHORT;else if(u instanceof Int16Array)_=s.SHORT;else if(u instanceof Uint32Array)_=s.UNSIGNED_INT;else if(u instanceof Int32Array)_=s.INT;else if(u instanceof Int8Array)_=s.BYTE;else if(u instanceof Uint8Array)_=s.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)_=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:g,type:_,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version,size:p}}function r(l,h,u){const d=h.array,p=h._updateRange,g=h.updateRanges;if(s.bindBuffer(u,l),p.count===-1&&g.length===0&&s.bufferSubData(u,0,d),g.length!==0){for(let _=0,m=g.length;_<m;_++){const f=g[_];t?s.bufferSubData(u,f.start*d.BYTES_PER_ELEMENT,d,f.start,f.count):s.bufferSubData(u,f.start*d.BYTES_PER_ELEMENT,d.subarray(f.start,f.start+f.count))}h.clearUpdateRanges()}p.count!==-1&&(t?s.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):s.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1),h.onUploadCallback()}function a(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function o(l){l.isInterleavedBufferAttribute&&(l=l.data);const h=n.get(l);h&&(s.deleteBuffer(h.buffer),n.delete(l))}function c(l,h){if(l.isGLBufferAttribute){const d=n.get(l);(!d||d.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 u=n.get(l);if(u===void 0)n.set(l,i(l,h));else if(u.version<l.version){if(u.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(u.buffer,l,h),u.version=l.version}}return{get:a,remove:o,update:c}}class na extends $t{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,p=[],g=[],_=[],m=[];for(let f=0;f<h;f++){const E=f*d-a;for(let x=0;x<l;x++){const T=x*u-r;g.push(T,-E,0),_.push(0,0,1),m.push(x/o),m.push(1-f/c)}}for(let f=0;f<c;f++)for(let E=0;E<o;E++){const x=E+l*f,T=E+l*(f+1),A=E+1+l*(f+1),w=E+1+l*f;p.push(x,T,w),p.push(T,A,w)}this.setIndex(p),this.setAttribute("position",new hn(g,3)),this.setAttribute("normal",new hn(_,3)),this.setAttribute("uv",new hn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new na(e.width,e.height,e.widthSegments,e.heightSegments)}}var ru=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,au=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,ou=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,cu=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,lu=`#ifdef USE_ALPHATEST 86 if ( diffuseColor.a < alphaTest ) discard; 87#endif`,hu=`#ifdef USE_ALPHATEST 88 uniform float alphaTest; 89#endif`,uu=`#ifdef USE_AOMAP 90 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 91 reflectedLight.indirectDiffuse *= ambientOcclusion; 92 #if defined( USE_CLEARCOAT ) 93 clearcoatSpecularIndirect *= ambientOcclusion; 94 #endif 95 #if defined( USE_SHEEN ) 96 sheenSpecularIndirect *= ambientOcclusion; 97 #endif 98 #if defined( USE_ENVMAP ) && defined( STANDARD )
99 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 100 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 101 #endif 102#endif`,du=`#ifdef USE_AOMAP 103 uniform sampler2D aoMap; 104 uniform float aoMapIntensity; 105#endif`,fu=`#ifdef USE_BATCHING 106 attribute float batchId; 107 uniform highp sampler2D batchingTexture; 108 mat4 getBatchingMatrix( const in float i ) { 109 int size = textureSize( batchingTexture, 0 ).x; 110 int j = int( i ) * 4; 111 int x = j % size; 112 int y = j / size; 113 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 114 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 115 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 116 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 117 return mat4( v1, v2, v3, v4 ); 118 } 119#endif`,pu=`#ifdef USE_BATCHING 120 mat4 batchingMatrix = getBatchingMatrix( batchId ); 121#endif`,mu=`vec3 transformed = vec3( position ); 122#ifdef USE_ALPHAHASH 123 vPosition = vec3( position ); 124#endif`,gu=`vec3 objectNormal = vec3( normal ); 125#ifdef USE_TANGENT 126 vec3 objectTangent = vec3( tangent.xyz ); 127#endif`,_u=`float G_BlinnPhong_Implicit( ) { 128 return 0.25; 129} 130float D_BlinnPhong( const in float shininess, const in float dotNH ) { 131 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 132} 133vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 134 vec3 halfDir = normalize( lightDir + viewDir ); 135 float dotNH = saturate( dot( normal, halfDir ) ); 136 float dotVH = saturate( dot( viewDir, halfDir ) ); 137 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 138 float G = G_BlinnPhong_Implicit( ); 139 float D = D_BlinnPhong( shininess, dotNH ); 140 return F * ( G * D ); 141} // validated`,xu=`#ifdef USE_IRIDESCENCE 142 const mat3 XYZ_TO_REC709 = mat3( 143 3.2404542, -0.9692660, 0.0556434, 144 -1.5371385, 1.8760108, -0.2040259, 145 -0.4985314, 0.0415560, 1.0572252 146 ); 147 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 148 vec3 sqrtF0 = sqrt( fresnel0 ); 149 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 150 } 151 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 152 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 153 } 154 float IorToFresnel0( float transmittedIor, float incidentIor ) { 155 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 156 } 157 vec3 evalSensitivity( float OPD, vec3 shift ) { 158 float phase = 2.0 * PI * OPD * 1.0e-9; 159 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 160 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 161 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 162 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 163 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 ) ); 164 xyz /= 1.0685e-7; 165 vec3 rgb = XYZ_TO_REC709 * xyz; 166 return rgb; 167 } 168 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 169 vec3 I; 170 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 171 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 172 float cosTheta2Sq = 1.0 - sinTheta2Sq; 173 if ( cosTheta2Sq < 0.0 ) { 174 return vec3( 1.0 ); 175 } 176 float cosTheta2 = sqrt( cosTheta2Sq ); 177 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 178 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
179 float T121 = 1.0 - R12; 180 float phi12 = 0.0; 181 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 182 float phi21 = PI - phi12; 183 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 184 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 185 vec3 phi23 = vec3( 0.0 ); 186 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 187 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 188 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 189 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 190 vec3 phi = vec3( phi21 ) + phi23; 191 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 192 vec3 r123 = sqrt( R123 ); 193 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 194 vec3 C0 = R12 + Rs; 195 I = C0; 196 vec3 Cm = Rs - T121; 197 for ( int m = 1; m <= 2; ++ m ) { 198 Cm *= r123; 199 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 200 I += Cm * Sm; 201 } 202 return max( I, vec3( 0.0 ) ); 203 } 204#endif`,vu=`#ifdef USE_BUMPMAP 205 uniform sampler2D bumpMap; 206 uniform float bumpScale; 207 vec2 dHdxy_fwd() { 208 vec2 dSTdx = dFdx( vBumpMapUv ); 209 vec2 dSTdy = dFdy( vBumpMapUv ); 210 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 211 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 212 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 213 return vec2( dBx, dBy ); 214 } 215 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 216 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 217 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 218 vec3 vN = surf_norm; 219 vec3 R1 = cross( vSigmaY, vN ); 220 vec3 R2 = cross( vN, vSigmaX ); 221 float fDet = dot( vSigmaX, R1 ) * faceDirection; 222 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 223 return normalize( abs( fDet ) * surf_norm - vGrad ); 224 } 225#endif`,Mu=`#if NUM_CLIPPING_PLANES > 0 226 vec4 plane; 227 #pragma unroll_loop_start 228 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 229 plane = clippingPlanes[ i ]; 230 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 bool clipped = true; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 239 } 240 #pragma unroll_loop_end 241 if ( clipped ) discard; 242 #endif 243#endif`,Su=`#if NUM_CLIPPING_PLANES > 0 244 varying vec3 vClipPosition; 245 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 246#endif`,yu=`#if NUM_CLIPPING_PLANES > 0 247 varying vec3 vClipPosition; 248#endif`,Eu=`#if NUM_CLIPPING_PLANES > 0 249 vClipPosition = - mvPosition.xyz; 250#endif`,Tu=`#if defined( USE_COLOR_ALPHA ) 251 diffuseColor *= vColor; 252#elif defined( USE_COLOR ) 253 diffuseColor.rgb *= vColor; 254#endif`,Au=`#if defined( USE_COLOR_ALPHA ) 255 varying vec4 vColor; 256#elif defined( USE_COLOR ) 257 varying vec3 vColor; 258#endif`,bu=`#if defined( USE_COLOR_ALPHA ) 259 varying vec4 vColor; 260#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 261 varying vec3 vColor; 262#endif`,wu=`#if defined( USE_COLOR_ALPHA ) 263 vColor = vec4( 1.0 ); 264#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 265 vColor = vec3( 1.0 ); 266#endif 267#ifdef USE_COLOR 268 vColor *= color; 269#endif 270#ifdef USE_INSTANCING_COLOR 271 vColor.xyz *= instanceColor.xyz; 272#endif`,Ru=`#define PI 3.141592653589793 273#define PI2 6.283185307179586 274#define PI_HALF 1.5707963267948966 275#define RECIPROCAL_PI 0.3183098861837907 276#define RECIPROCAL_PI2 0.15915494309189535 277#define EPSILON 1e-6 278#ifndef saturate 279#define saturate( a ) clamp( a, 0.0, 1.0 ) 280#endif 281#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 282float pow2( const in float x ) { return x*x; } 283vec3 pow2( const in vec3 x ) { return x*x; } 284float pow3( const in float x ) { return x*x*x; } 285float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 286float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 287float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 288highp float rand( const in vec2 uv ) { 289 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 290 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 291 return fract( sin( sn ) * c ); 292} 293#ifdef HIGH_PRECISION 294 float precisionSafeLength( vec3 v ) { return length( v ); } 295#else 296 float precisionSafeLength( vec3 v ) { 297 float maxComponent = max3( abs( v ) ); 298 return length( v / maxComponent ) * maxComponent; 299 } 300#endif 301struct IncidentLight { 302 vec3 color; 303 vec3 direction; 304 bool visible; 305}; 306struct ReflectedLight { 307 vec3 directDiffuse; 308 vec3 directSpecular; 309 vec3 indirectDiffuse; 310 vec3 indirectSpecular; 311}; 312#ifdef USE_ALPHAHASH 313 varying vec3 vPosition; 314#endif 315vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 316 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 317} 318vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 319 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 320} 321mat3 transposeMat3( const in mat3 m ) { 322 mat3 tmp; 323 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 324 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 325 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 326 return tmp; 327} 328float luminance( const in vec3 rgb ) { 329 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 330 return dot( weights, rgb ); 331} 332bool isPerspectiveMatrix( mat4 m ) { 333 return m[ 2 ][ 3 ] == - 1.0; 334} 335vec2 equirectUv( in vec3 dir ) { 336 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 337 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 338 return vec2( u, v ); 339}
340vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 341 return RECIPROCAL_PI * diffuseColor; 342} 343vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 344 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 345 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 346} 347float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 348 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 349 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 350} // validated`,Cu=`#ifdef ENVMAP_TYPE_CUBE_UV 351 #define cubeUV_minMipLevel 4.0 352 #define cubeUV_minTileSize 16.0 353 float getFace( vec3 direction ) { 354 vec3 absDirection = abs( direction ); 355 float face = - 1.0; 356 if ( absDirection.x > absDirection.z ) { 357 if ( absDirection.x > absDirection.y ) 358 face = direction.x > 0.0 ? 0.0 : 3.0; 359 else 360 face = direction.y > 0.0 ? 1.0 : 4.0; 361 } else { 362 if ( absDirection.z > absDirection.y ) 363 face = direction.z > 0.0 ? 2.0 : 5.0; 364 else 365 face = direction.y > 0.0 ? 1.0 : 4.0; 366 } 367 return face; 368 } 369 vec2 getUV( vec3 direction, float face ) { 370 vec2 uv; 371 if ( face == 0.0 ) { 372 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 373 } else if ( face == 1.0 ) { 374 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 375 } else if ( face == 2.0 ) { 376 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 377 } else if ( face == 3.0 ) { 378 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 379 } else if ( face == 4.0 ) { 380 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 381 } else { 382 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 383 } 384 return 0.5 * ( uv + 1.0 ); 385 } 386 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 387 float face = getFace( direction ); 388 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 389 mipInt = max( mipInt, cubeUV_minMipLevel ); 390 float faceSize = exp2( mipInt ); 391 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 392 if ( face > 2.0 ) { 393 uv.y += faceSize; 394 face -= 3.0; 395 } 396 uv.x += face * faceSize; 397 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 398 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 399 uv.x *= CUBEUV_TEXEL_WIDTH; 400 uv.y *= CUBEUV_TEXEL_HEIGHT; 401 #ifdef texture2DGradEXT 402 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 403 #else 404 return texture2D( envMap, uv ).rgb; 405 #endif 406 } 407 #define cubeUV_r0 1.0 408 #define cubeUV_v0 0.339 409 #define cubeUV_m0 - 2.0 410 #define cubeUV_r1 0.8 411 #define cubeUV_v1 0.276 412 #define cubeUV_m1 - 1.0 413 #define cubeUV_r4 0.4 414 #define cubeUV_v4 0.046 415 #define cubeUV_m4 2.0 416 #define cubeUV_r5 0.305 417 #define cubeUV_v5 0.016 418 #define cubeUV_m5 3.0 419 #define cubeUV_r6 0.21 420 #define cubeUV_v6 0.0038 421 #define cubeUV_m6 4.0 422 float roughnessToMip( float roughness ) { 423 float mip = 0.0; 424 if ( roughness >= cubeUV_r1 ) { 425 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 426 } else if ( roughness >= cubeUV_r4 ) { 427 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 428 } else if ( roughness >= cubeUV_r5 ) { 429 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 430 } else if ( roughness >= cubeUV_r6 ) { 431 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 432 } else { 433 mip = - 2.0 * log2( 1.16 * roughness ); } 434 return mip; 435 } 436 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 437 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 438 float mipF = fract( mip ); 439 float mipInt = floor( mip ); 440 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 441 if ( mipF == 0.0 ) { 442 return vec4( color0, 1.0 ); 443 } else { 444 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 445 return vec4( mix( color0, color1, mipF ), 1.0 ); 446 } 447 } 448#endif`,Lu=`vec3 transformedNormal = objectNormal; 449#ifdef USE_TANGENT 450 vec3 transformedTangent = objectTangent; 451#endif 452#ifdef USE_BATCHING 453 mat3 bm = mat3( batchingMatrix );
454 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 455 transformedNormal = bm * transformedNormal; 456 #ifdef USE_TANGENT 457 transformedTangent = bm * transformedTangent; 458 #endif 459#endif 460#ifdef USE_INSTANCING 461 mat3 im = mat3( instanceMatrix ); 462 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 463 transformedNormal = im * transformedNormal; 464 #ifdef USE_TANGENT 465 transformedTangent = im * transformedTangent; 466 #endif 467#endif 468transformedNormal = normalMatrix * transformedNormal; 469#ifdef FLIP_SIDED 470 transformedNormal = - transformedNormal; 471#endif 472#ifdef USE_TANGENT 473 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 474 #ifdef FLIP_SIDED 475 transformedTangent = - transformedTangent; 476 #endif 477#endif`,Pu=`#ifdef USE_DISPLACEMENTMAP 478 uniform sampler2D displacementMap; 479 uniform float displacementScale; 480 uniform float displacementBias; 481#endif`,Iu=`#ifdef USE_DISPLACEMENTMAP 482 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); 483#endif`,Du=`#ifdef USE_EMISSIVEMAP 484 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 485 totalEmissiveRadiance *= emissiveColor.rgb; 486#endif`,Uu=`#ifdef USE_EMISSIVEMAP 487 uniform sampler2D emissiveMap; 488#endif`,Nu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fu=` 489const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 490 vec3( 0.8224621, 0.177538, 0.0 ), 491 vec3( 0.0331941, 0.9668058, 0.0 ), 492 vec3( 0.0170827, 0.0723974, 0.9105199 ) 493); 494const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 495 vec3( 1.2249401, - 0.2249404, 0.0 ), 496 vec3( - 0.0420569, 1.0420571, 0.0 ), 497 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 498); 499vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 500 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 501} 502vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 503 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 504} 505vec4 LinearTransferOETF( in vec4 value ) { 506 return value; 507} 508vec4 sRGBTransferOETF( in vec4 value ) { 509 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 ); 510} 511vec4 LinearToLinear( in vec4 value ) { 512 return value; 513} 514vec4 LinearTosRGB( in vec4 value ) { 515 return sRGBTransferOETF( value ); 516}`,Ou=`#ifdef USE_ENVMAP 517 #ifdef ENV_WORLDPOS 518 vec3 cameraToFrag; 519 if ( isOrthographic ) { 520 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 521 } else { 522 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 523 } 524 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 525 #ifdef ENVMAP_MODE_REFLECTION 526 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 527 #else 528 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 529 #endif 530 #else 531 vec3 reflectVec = vReflect; 532 #endif 533 #ifdef ENVMAP_TYPE_CUBE 534 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 535 #else 536 vec4 envColor = vec4( 0.0 ); 537 #endif 538 #ifdef ENVMAP_BLENDING_MULTIPLY 539 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 540 #elif defined( ENVMAP_BLENDING_MIX ) 541 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 542 #elif defined( ENVMAP_BLENDING_ADD ) 543 outgoingLight += envColor.xyz * specularStrength * reflectivity; 544 #endif 545#endif`,Bu=`#ifdef USE_ENVMAP 546 uniform float envMapIntensity; 547 uniform float flipEnvMap; 548 #ifdef ENVMAP_TYPE_CUBE 549 uniform samplerCube envMap; 550 #else 551 uniform sampler2D envMap; 552 #endif 553 554#endif`,Hu=`#ifdef USE_ENVMAP 555 uniform float reflectivity; 556 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 557 #define ENV_WORLDPOS 558 #endif 559 #ifdef ENV_WORLDPOS 560 varying vec3 vWorldPosition; 561 uniform float refractionRatio; 562 #else 563 varying vec3 vReflect; 564 #endif 565#endif`,zu=`#ifdef USE_ENVMAP 566 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 567 #define ENV_WORLDPOS 568 #endif 569 #ifdef ENV_WORLDPOS 570 571 varying vec3 vWorldPosition; 572 #else 573 varying vec3 vReflect; 574 uniform float refractionRatio; 575 #endif 576#endif`,Gu=`#ifdef USE_ENVMAP 577 #ifdef ENV_WORLDPOS 578 vWorldPosition = worldPosition.xyz; 579 #else 580 vec3 cameraToVertex; 581 if ( isOrthographic ) { 582 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 583 } else {
584 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 585 } 586 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 587 #ifdef ENVMAP_MODE_REFLECTION 588 vReflect = reflect( cameraToVertex, worldNormal ); 589 #else 590 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 591 #endif 592 #endif 593#endif`,ku=`#ifdef USE_FOG 594 vFogDepth = - mvPosition.z; 595#endif`,Vu=`#ifdef USE_FOG 596 varying float vFogDepth; 597#endif`,Wu=`#ifdef USE_FOG 598 #ifdef FOG_EXP2 599 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 600 #else 601 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 602 #endif 603 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 604#endif`,Xu=`#ifdef USE_FOG 605 uniform vec3 fogColor; 606 varying float vFogDepth; 607 #ifdef FOG_EXP2 608 uniform float fogDensity; 609 #else 610 uniform float fogNear; 611 uniform float fogFar; 612 #endif 613#endif`,qu=`#ifdef USE_GRADIENTMAP 614 uniform sampler2D gradientMap; 615#endif 616vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 617 float dotNL = dot( normal, lightDirection ); 618 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 619 #ifdef USE_GRADIENTMAP 620 return vec3( texture2D( gradientMap, coord ).r ); 621 #else 622 vec2 fw = fwidth( coord ) * 0.5; 623 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 624 #endif 625}`,Yu=`#ifdef USE_LIGHTMAP 626 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 627 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 628 reflectedLight.indirectDiffuse += lightMapIrradiance; 629#endif`,ju=`#ifdef USE_LIGHTMAP 630 uniform sampler2D lightMap; 631 uniform float lightMapIntensity; 632#endif`,Ku=`LambertMaterial material; 633material.diffuseColor = diffuseColor.rgb; 634material.specularStrength = specularStrength;`,Zu=`varying vec3 vViewPosition; 635struct LambertMaterial { 636 vec3 diffuseColor; 637 float specularStrength; 638}; 639void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 640 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 641 vec3 irradiance = dotNL * directLight.color; 642 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 643} 644void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 645 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 646} 647#define RE_Direct RE_Direct_Lambert 648#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,$u=`uniform bool receiveShadow; 649uniform vec3 ambientLightColor; 650#if defined( USE_LIGHT_PROBES ) 651 uniform vec3 lightProbe[ 9 ]; 652#endif 653vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 654 float x = normal.x, y = normal.y, z = normal.z; 655 vec3 result = shCoefficients[ 0 ] * 0.886227; 656 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 657 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 658 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 659 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 660 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 661 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 662 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 663 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 664 return result; 665} 666vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 667 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 668 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 669 return irradiance; 670} 671vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 672 vec3 irradiance = ambientLightColor; 673 return irradiance; 674} 675float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 676 #if defined ( LEGACY_LIGHTS ) 677 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 678 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 679 } 680 return 1.0; 681 #else 682 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 683 if ( cutoffDistance > 0.0 ) { 684 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 685 } 686 return distanceFalloff; 687 #endif 688} 689float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 690 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 691} 692#if NUM_DIR_LIGHTS > 0 693 struct DirectionalLight { 694 vec3 direction; 695 vec3 color; 696 }; 697 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 698 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 699 light.color = directionalLight.color; 700 light.direction = directionalLight.direction; 701 light.visible = true; 702 } 703#endif 704#if NUM_POINT_LIGHTS > 0 705 struct PointLight { 706 vec3 position; 707 vec3 color; 708 float distance; 709 float decay; 710 }; 711 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 712 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 713 vec3 lVector = pointLight.position - geometryPosition; 714 light.direction = normalize( lVector ); 715 float lightDistance = length( lVector ); 716 light.color = pointLight.color; 717 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 718 light.visible = ( light.color != vec3( 0.0 ) ); 719 } 720#endif
721#if NUM_SPOT_LIGHTS > 0 722 struct SpotLight { 723 vec3 position; 724 vec3 direction; 725 vec3 color; 726 float distance; 727 float decay; 728 float coneCos; 729 float penumbraCos; 730 }; 731 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 732 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 733 vec3 lVector = spotLight.position - geometryPosition; 734 light.direction = normalize( lVector ); 735 float angleCos = dot( light.direction, spotLight.direction ); 736 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 737 if ( spotAttenuation > 0.0 ) { 738 float lightDistance = length( lVector ); 739 light.color = spotLight.color * spotAttenuation; 740 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 741 light.visible = ( light.color != vec3( 0.0 ) ); 742 } else { 743 light.color = vec3( 0.0 ); 744 light.visible = false; 745 } 746 } 747#endif 748#if NUM_RECT_AREA_LIGHTS > 0 749 struct RectAreaLight { 750 vec3 color; 751 vec3 position; 752 vec3 halfWidth; 753 vec3 halfHeight; 754 }; 755 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 756 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 757#endif 758#if NUM_HEMI_LIGHTS > 0 759 struct HemisphereLight { 760 vec3 direction; 761 vec3 skyColor; 762 vec3 groundColor; 763 }; 764 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 765 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 766 float dotNL = dot( normal, hemiLight.direction ); 767 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 768 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 769 return irradiance; 770 } 771#endif`,Ju=`#ifdef USE_ENVMAP 772 vec3 getIBLIrradiance( const in vec3 normal ) { 773 #ifdef ENVMAP_TYPE_CUBE_UV 774 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 775 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 776 return PI * envMapColor.rgb * envMapIntensity; 777 #else 778 return vec3( 0.0 ); 779 #endif 780 } 781 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 782 #ifdef ENVMAP_TYPE_CUBE_UV 783 vec3 reflectVec = reflect( - viewDir, normal ); 784 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 785 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 786 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 787 return envMapColor.rgb * envMapIntensity; 788 #else 789 return vec3( 0.0 ); 790 #endif 791 } 792 #ifdef USE_ANISOTROPY 793 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 794 #ifdef ENVMAP_TYPE_CUBE_UV 795 vec3 bentNormal = cross( bitangent, viewDir ); 796 bentNormal = normalize( cross( bentNormal, bitangent ) ); 797 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 798 return getIBLRadiance( viewDir, bentNormal, roughness ); 799 #else 800 return vec3( 0.0 ); 801 #endif 802 } 803 #endif 804#endif`,Qu=`ToonMaterial material; 805material.diffuseColor = diffuseColor.rgb;`,ed=`varying vec3 vViewPosition; 806struct ToonMaterial { 807 vec3 diffuseColor; 808}; 809void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 810 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 811 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 812} 813void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 814 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 815} 816#define RE_Direct RE_Direct_Toon 817#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,td=`BlinnPhongMaterial material; 818material.diffuseColor = diffuseColor.rgb; 819material.specularColor = specular; 820material.specularShininess = shininess; 821material.specularStrength = specularStrength;`,nd=`varying vec3 vViewPosition; 822struct BlinnPhongMaterial { 823 vec3 diffuseColor; 824 vec3 specularColor; 825 float specularShininess; 826 float specularStrength; 827}; 828void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
829 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 830 vec3 irradiance = dotNL * directLight.color; 831 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 832 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 833} 834void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 835 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 836} 837#define RE_Direct RE_Direct_BlinnPhong 838#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,id=`PhysicalMaterial material; 839material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 840vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 841float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 842material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 843material.roughness = min( material.roughness, 1.0 ); 844#ifdef IOR 845 material.ior = ior; 846 #ifdef USE_SPECULAR 847 float specularIntensityFactor = specularIntensity; 848 vec3 specularColorFactor = specularColor; 849 #ifdef USE_SPECULAR_COLORMAP 850 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 851 #endif 852 #ifdef USE_SPECULAR_INTENSITYMAP 853 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 854 #endif 855 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 856 #else 857 float specularIntensityFactor = 1.0; 858 vec3 specularColorFactor = vec3( 1.0 ); 859 material.specularF90 = 1.0; 860 #endif 861 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 862#else 863 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 864 material.specularF90 = 1.0; 865#endif 866#ifdef USE_CLEARCOAT 867 material.clearcoat = clearcoat; 868 material.clearcoatRoughness = clearcoatRoughness; 869 material.clearcoatF0 = vec3( 0.04 ); 870 material.clearcoatF90 = 1.0; 871 #ifdef USE_CLEARCOATMAP 872 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 873 #endif 874 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 875 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 876 #endif 877 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 878 material.clearcoatRoughness += geometryRoughness; 879 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 880#endif 881#ifdef USE_IRIDESCENCE 882 material.iridescence = iridescence; 883 material.iridescenceIOR = iridescenceIOR; 884 #ifdef USE_IRIDESCENCEMAP 885 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 886 #endif 887 #ifdef USE_IRIDESCENCE_THICKNESSMAP 888 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 889 #else 890 material.iridescenceThickness = iridescenceThicknessMaximum; 891 #endif 892#endif 893#ifdef USE_SHEEN 894 material.sheenColor = sheenColor; 895 #ifdef USE_SHEEN_COLORMAP 896 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 897 #endif 898 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 899 #ifdef USE_SHEEN_ROUGHNESSMAP 900 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 901 #endif 902#endif 903#ifdef USE_ANISOTROPY 904 #ifdef USE_ANISOTROPYMAP 905 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 906 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 907 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 908 #else 909 vec2 anisotropyV = anisotropyVector; 910 #endif 911 material.anisotropy = length( anisotropyV ); 912 if( material.anisotropy == 0.0 ) { 913 anisotropyV = vec2( 1.0, 0.0 ); 914 } else { 915 anisotropyV /= material.anisotropy; 916 material.anisotropy = saturate( material.anisotropy ); 917 } 918 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
919 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 920 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 921#endif`,sd=`struct PhysicalMaterial { 922 vec3 diffuseColor; 923 float roughness; 924 vec3 specularColor; 925 float specularF90
vendor: 14,563 bytes, lines 925-1221
925; 926 #ifdef USE_CLEARCOAT 927 float clearcoat; 928 float clearcoatRoughness; 929 vec3 clearcoatF0; 930 float clearcoatF90; 931 #endif 932 #ifdef USE_IRIDESCENCE 933 float iridescence; 934 float iridescenceIOR; 935 float iridescenceThickness; 936 vec3 iridescenceFresnel; 937 vec3 iridescenceF0; 938 #endif 939 #ifdef USE_SHEEN 940 vec3 sheenColor; 941 float sheenRoughness; 942 #endif 943 #ifdef IOR 944 float ior; 945 #endif 946 #ifdef USE_TRANSMISSION 947 float transmission; 948 float transmissionAlpha; 949 float thickness; 950 float attenuationDistance; 951 vec3 attenuationColor; 952 #endif 953 #ifdef USE_ANISOTROPY 954 float anisotropy; 955 float alphaT; 956 vec3 anisotropyT; 957 vec3 anisotropyB; 958 #endif 959}; 960vec3 clearcoatSpecularDirect = vec3( 0.0 ); 961vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 962vec3 sheenSpecularDirect = vec3( 0.0 ); 963vec3 sheenSpecularIndirect = vec3(0.0 ); 964vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 965 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 966 float x2 = x * x; 967 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 968 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 969} 970float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 971 float a2 = pow2( alpha ); 972 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 973 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 974 return 0.5 / max( gv + gl, EPSILON ); 975} 976float D_GGX( const in float alpha, const in float dotNH ) { 977 float a2 = pow2( alpha ); 978 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 979 return RECIPROCAL_PI * a2 / pow2( denom ); 980} 981#ifdef USE_ANISOTROPY 982 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 983 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 984 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 985 float v = 0.5 / ( gv + gl ); 986 return saturate(v); 987 } 988 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 989 float a2 = alphaT * alphaB; 990 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 991 highp float v2 = dot( v, v ); 992 float w2 = a2 / v2; 993 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 994 } 995#endif 996#ifdef USE_CLEARCOAT 997 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 998 vec3 f0 = material.clearcoatF0; 999 float f90 = material.clearcoatF90; 1000 float roughness = material.clearcoatRoughness; 1001 float alpha = pow2( roughness ); 1002 vec3 halfDir = normalize( lightDir + viewDir ); 1003 float dotNL = saturate( dot( normal, lightDir ) ); 1004 float dotNV = saturate( dot( normal, viewDir ) ); 1005 float dotNH = saturate( dot( normal, halfDir ) ); 1006 float dotVH = saturate( dot( viewDir, halfDir ) ); 1007 vec3 F = F_Schlick( f0, f90, dotVH ); 1008 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1009 float D = D_GGX( alpha, dotNH ); 1010 return F * ( V * D ); 1011 } 1012#endif 1013vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1014 vec3 f0 = material.specularColor; 1015 float f90 = material.specularF90; 1016 float roughness = material.roughness; 1017 float alpha = pow2( roughness ); 1018 vec3 halfDir = normalize( lightDir + viewDir ); 1019 float dotNL = saturate( dot( normal, lightDir ) ); 1020 float dotNV = saturate( dot( normal, viewDir ) ); 1021 float dotNH = saturate( dot( normal, halfDir ) ); 1022 float dotVH = saturate( dot( viewDir, halfDir ) ); 1023 vec3 F = F_Schlick( f0, f90, dotVH ); 1024 #ifdef USE_IRIDESCENCE 1025 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1026 #endif 1027 #ifdef USE_ANISOTROPY 1028 float dotTL = dot( material.anisotropyT, lightDir ); 1029 float dotTV = dot( material.anisotropyT, viewDir ); 1030 float dotTH = dot( material.anisotropyT, halfDir ); 1031 float dotBL = dot( material.anisotropyB, lightDir ); 1032 float dotBV = dot( material.anisotropyB, viewDir ); 1033 float dotBH = dot( material.anisotropyB, halfDir ); 1034 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1035 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1036 #else 1037 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1038 float D = D_GGX( alpha, dotNH ); 1039 #endif 1040 return F * ( V * D ); 1041} 1042vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1043 const float LUT_SIZE = 64.0; 1044 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1045 const float LUT_BIAS = 0.5 / LUT_SIZE; 1046 float dotNV = saturate( dot( N, V ) ); 1047 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1048 uv = uv * LUT_SCALE + LUT_BIAS; 1049 return uv; 1050} 1051float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1052 float l = length( f ); 1053 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1054} 1055vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1056 float x = dot( v1, v2 ); 1057 float y = abs( x ); 1058 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1059 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1060 float v = a / b; 1061 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1062 return cross( v1, v2 ) * theta_sintheta; 1063} 1064vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1065 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1066 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1067 vec3 lightNormal = cross( v1, v2 ); 1068 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1069 vec3 T1, T2; 1070 T1 = normalize( V - N * dot( V, N ) ); 1071 T2 = - cross( N, T1 ); 1072 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1073 vec3 coords[ 4 ]; 1074 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1075 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1076 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1077 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1078 coords[ 0 ] = normalize( coords[ 0 ] ); 1079 coords[ 1 ] = normalize( coords[ 1 ] ); 1080 coords[ 2 ] = normalize( coords[ 2 ] ); 1081 coords[ 3 ] = normalize( coords[ 3 ] ); 1082 vec3 vectorFormFactor = vec3( 0.0 ); 1083 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1084 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1085 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1086 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1087 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1088 return vec3( result ); 1089} 1090#if defined( USE_SHEEN ) 1091float D_Charlie( float roughness, float dotNH ) { 1092 float alpha = pow2( roughness ); 1093 float invAlpha = 1.0 / alpha; 1094 float cos2h = dotNH * dotNH; 1095 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1096 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1097} 1098float V_Neubelt( float dotNV, float dotNL ) { 1099 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1100} 1101vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1102 vec3 halfDir = normalize( lightDir + viewDir ); 1103 float dotNL = saturate( dot( normal, lightDir ) ); 1104 float dotNV = saturate( dot( normal, viewDir ) ); 1105 float dotNH = saturate( dot( normal, halfDir ) ); 1106 float D = D_Charlie( sheenRoughness, dotNH ); 1107 float V = V_Neubelt( dotNV, dotNL ); 1108 return sheenColor * ( D * V ); 1109} 1110#endif 1111float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1112 float dotNV = saturate( dot( normal, viewDir ) ); 1113 float r2 = roughness * roughness; 1114 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1115 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1116 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1117 return saturate( DG * RECIPROCAL_PI ); 1118} 1119vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1120 float dotNV = saturate( dot( normal, viewDir ) ); 1121 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1122 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1123 vec4 r = roughness * c0 + c1; 1124 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1125 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1126 return fab; 1127} 1128vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1129 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1130 return specularColor * fab.x + specularF90 * fab.y; 1131} 1132#ifdef USE_IRIDESCENCE 1133void 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 ) { 1134#else 1135void 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 ) { 1136#endif 1137 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1138 #ifdef USE_IRIDESCENCE 1139 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1140 #else 1141 vec3 Fr = specularColor; 1142 #endif 1143 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1144 float Ess = fab.x + fab.y; 1145 float Ems = 1.0 - Ess; 1146 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1147 singleScatter += FssEss; 1148 multiScatter += Fms * Ems; 1149} 1150#if NUM_RECT_AREA_LIGHTS > 0 1151 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1152 vec3 normal = geometryNormal; 1153 vec3 viewDir = geometryViewDir; 1154 vec3 position = geometryPosition; 1155 vec3 lightPos = rectAreaLight.position; 1156 vec3 halfWidth = rectAreaLight.halfWidth; 1157 vec3 halfHeight = rectAreaLight.halfHeight; 1158 vec3 lightColor = rectAreaLight.color; 1159 float roughness = material.roughness; 1160 vec3 rectCoords[ 4 ]; 1161 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1162 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1163 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1164 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1165 vec4 t1 = texture2D( ltc_1, uv ); 1166 vec4 t2 = texture2D( ltc_2, uv ); 1167 mat3 mInv = mat3( 1168 vec3( t1.x, 0, t1.y ), 1169 vec3( 0, 1, 0 ), 1170 vec3( t1.z, 0, t1.w ) 1171 ); 1172 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1173 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1174 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1175 } 1176#endif 1177void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1178 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1179 vec3 irradiance = dotNL * directLight.color; 1180 #ifdef USE_CLEARCOAT 1181 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1182 vec3 ccIrradiance = dotNLcc * directLight.color; 1183 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1184 #endif 1185 #ifdef USE_SHEEN 1186 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1187 #endif 1188 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1189 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1190} 1191void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1192 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1193} 1194void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1195 #ifdef USE_CLEARCOAT 1196 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1197 #endif 1198 #ifdef USE_SHEEN 1199 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1200 #endif 1201 vec3 singleScattering = vec3( 0.0 ); 1202 vec3 multiScattering = vec3( 0.0 ); 1203 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1204 #ifdef USE_IRIDESCENCE 1205 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1206 #else 1207 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1208 #endif 1209 vec3 totalScattering = singleScattering + multiScattering; 1210 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1211 reflectedLight.indirectSpecular += radiance * singleScattering; 1212 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1213 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1214} 1215#define RE_Direct RE_Direct_Physical 1216#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1217#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1218#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1219float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1220 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1221}`,
1221rd=` 1222vec3 geometryPosition = - vViewPosition; 1223vec3 geometryNormal = normal; 1224vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1225vec3 geometryClearcoatNormal = vec3( 0.0 ); 1226#ifdef USE_CLEARCOAT 1227 geometryClearcoatNormal = clearcoatNormal; 1228#endif 1229#ifdef USE_IRIDESCENCE 1230 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1231 if ( material.iridescenceThickness == 0.0 ) { 1232 material.iridescence = 0.0; 1233 } else { 1234 material.iridescence = saturate( material.iridescence ); 1235 } 1236 if ( material.iridescence > 0.0 ) { 1237 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1238 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1239 } 1240#endif 1241IncidentLight directLight; 1242#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1243 PointLight pointLight; 1244 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1245 PointLightShadow pointLightShadow; 1246 #endif 1247 #pragma unroll_loop_start 1248 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1249 pointLight = pointLights[ i ]; 1250 getPointLightInfo( pointLight, geometryPosition, directLight ); 1251 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1252 pointLightShadow = pointLightShadows[ i ]; 1253 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1254 #endif 1255 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1256 } 1257 #pragma unroll_loop_end 1258#endif 1259#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1260 SpotLight spotLight; 1261 vec4 spotColor; 1262 vec3 spotLightCoord; 1263 bool inSpotLightMap; 1264 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1265 SpotLightShadow spotLightShadow; 1266 #endif 1267 #pragma unroll_loop_start 1268 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1269 spotLight = spotLights[ i ]; 1270 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1271 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1272 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1273 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1274 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1275 #else 1276 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1277 #endif 1278 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1279 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1280 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1281 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1282 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1283 #endif 1284 #undef SPOT_LIGHT_MAP_INDEX 1285 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1286 spotLightShadow = spotLightShadows[ i ]; 1287 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1288 #endif 1289 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1290 } 1291 #pragma unroll_loop_end 1292#endif 1293#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1294 DirectionalLight directionalLight; 1295 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1296 DirectionalLightShadow directionalLightShadow; 1297 #endif 1298 #pragma unroll_loop_start 1299 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1300 directionalLight = directionalLights[ i ]; 1301 getDirectionalLightInfo( directionalLight, directLight ); 1302 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1303 directionalLightShadow = directionalLightShadows[ i ]; 1304 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1305 #endif 1306 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1307 } 1308 #pragma unroll_loop_end 1309#endif 1310#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1311 RectAreaLight rectAreaLight; 1312 #pragma unroll_loop_start 1313 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1314 rectAreaLight = rectAreaLights[ i ]; 1315 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1316 } 1317 #pragma unroll_loop_end 1318#endif 1319#if defined( RE_IndirectDiffuse ) 1320 vec3 iblIrradiance = vec3( 0.0 ); 1321 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1322 #if defined( USE_LIGHT_PROBES ) 1323 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1324 #endif 1325 #if ( NUM_HEMI_LIGHTS > 0 ) 1326 #pragma unroll_loop_start 1327 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1328 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1329 } 1330 #pragma unroll_loop_end 1331 #endif 1332#endif 1333#if defined( RE_IndirectSpecular ) 1334 vec3 radiance = vec3( 0.0 ); 1335 vec3 clearcoatRadiance = vec3( 0.0 ); 1336#endif`,ad=`#if defined( RE_IndirectDiffuse ) 1337 #ifdef USE_LIGHTMAP 1338 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1339 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1340 irradiance += lightMapIrradiance; 1341 #endif 1342 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1343 iblIrradiance += getIBLIrradiance( geometryNormal ); 1344 #endif 1345#endif 1346#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1347 #ifdef USE_ANISOTROPY 1348 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1349 #else 1350 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1351 #endif 1352 #ifdef USE_CLEARCOAT 1353 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1354 #endif 1355#endif`,od=`#if defined( RE_IndirectDiffuse ) 1356 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1357#endif 1358#if defined( RE_IndirectSpecular ) 1359 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1360#endif`,cd=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1361 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1362#endif`,ld=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1363 uniform float logDepthBufFC; 1364 varying float vFragDepth; 1365 varying float vIsPerspective; 1366#endif`,hd=`#ifdef USE_LOGDEPTHBUF 1367 #ifdef USE_LOGDEPTHBUF_EXT 1368 varying float vFragDepth; 1369 varying float vIsPerspective; 1370 #else 1371 uniform float logDepthBufFC; 1372 #endif 1373#endif`,ud=`#ifdef USE_LOGDEPTHBUF 1374 #ifdef USE_LOGDEPTHBUF_EXT 1375 vFragDepth = 1.0 + gl_Position.w; 1376 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1377 #else 1378 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1379 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1380 gl_Position.z *= gl_Position.w; 1381 } 1382 #endif 1383#endif`,dd=`#ifdef USE_MAP 1384 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1385 #ifdef DECODE_VIDEO_TEXTURE 1386 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1387 1388 #endif 1389 diffuseColor *= sampledDiffuseColor; 1390#endif`,fd=`#ifdef USE_MAP 1391 uniform sampler2D map; 1392#endif`,pd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1393 #if defined( USE_POINTS_UV ) 1394 vec2 uv = vUv; 1395 #else 1396 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1397 #endif 1398#endif 1399#ifdef USE_MAP 1400 diffuseColor *= texture2D( map, uv ); 1401#endif 1402#ifdef USE_ALPHAMAP 1403 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1404#endif`,md=`#if defined( USE_POINTS_UV ) 1405 varying vec2 vUv; 1406#else 1407 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1408 uniform mat3 uvTransform; 1409 #endif 1410#endif 1411#ifdef USE_MAP 1412 uniform sampler2D map; 1413#endif 1414#ifdef USE_ALPHAMAP 1415 uniform sampler2D alphaMap; 1416#endif`,gd=`float metalnessFactor = metalness; 1417#ifdef USE_METALNESSMAP 1418 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1419 metalnessFactor *= texelMetalness.b; 1420#endif`,_d=`#ifdef USE_METALNESSMAP 1421 uniform sampler2D metalnessMap; 1422#endif`,xd=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1423 vColor *= morphTargetBaseInfluence; 1424 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1425 #if defined( USE_COLOR_ALPHA ) 1426 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1427 #elif defined( USE_COLOR ) 1428 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1429 #endif 1430 } 1431#endif`,vd=`#ifdef USE_MORPHNORMALS 1432 objectNormal *= morphTargetBaseInfluence; 1433 #ifdef MORPHTARGETS_TEXTURE 1434 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1435 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1436 } 1437 #else 1438 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1439 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1440 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1441 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1442 #endif 1443#endif`,Md=`#ifdef USE_MORPHTARGETS 1444 uniform float morphTargetBaseInfluence; 1445 #ifdef MORPHTARGETS_TEXTURE 1446 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1447 uniform sampler2DArray morphTargetsTexture; 1448 uniform ivec2 morphTargetsTextureSize; 1449 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1450 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1451 int y = texelIndex / morphTargetsTextureSize.x; 1452 int x = texelIndex - y * morphTargetsTextureSize.x; 1453 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1454 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1455 } 1456 #else 1457 #ifndef USE_MORPHNORMALS 1458 uniform float morphTargetInfluences[ 8 ]; 1459 #else 1460 uniform float morphTargetInfluences[ 4 ]; 1461 #endif 1462 #endif 1463#endif`,Sd=`#ifdef USE_MORPHTARGETS 1464 transformed *= morphTargetBaseInfluence; 1465 #ifdef MORPHTARGETS_TEXTURE 1466 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1467 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1468 } 1469 #else 1470 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1471 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1472 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1473 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1474 #ifndef USE_MORPHNORMALS 1475 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1476 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1477 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1478 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1479 #endif 1480 #endif 1481#endif`,yd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1482#ifdef FLAT_SHADED 1483 vec3 fdx = dFdx( vViewPosition ); 1484 vec3 fdy = dFdy( vViewPosition ); 1485 vec3 normal = normalize( cross( fdx, fdy ) ); 1486#else 1487 vec3 normal = normalize( vNormal ); 1488 #ifdef DOUBLE_SIDED 1489 normal *= faceDirection; 1490 #endif 1491#endif 1492#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1493 #ifdef USE_TANGENT 1494 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1495 #else 1496 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1497 #if defined( USE_NORMALMAP ) 1498 vNormalMapUv 1499 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1500 vClearcoatNormalMapUv 1501 #else 1502 vUv 1503 #endif 1504 ); 1505 #endif 1506 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1507 tbn[0] *= faceDirection; 1508 tbn[1] *= faceDirection; 1509 #endif 1510#endif 1511#ifdef USE_CLEARCOAT_NORMALMAP 1512 #ifdef USE_TANGENT 1513 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1514 #else 1515 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1516 #endif 1517 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1518 tbn2[0] *= faceDirection; 1519 tbn2[1] *= faceDirection; 1520 #endif 1521#endif 1522vec3 nonPerturbedNormal = normal;`,Ed=`#ifdef USE_NORMALMAP_OBJECTSPACE 1523 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1524 #ifdef FLIP_SIDED 1525 normal = - normal; 1526 #endif 1527 #ifdef DOUBLE_SIDED 1528 normal = normal * faceDirection; 1529 #endif 1530 normal = normalize( normalMatrix * normal ); 1531#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1532 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1533 mapN.xy *= normalScale; 1534 normal = normalize( tbn * mapN ); 1535#elif defined( USE_BUMPMAP )
1536 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1537#endif`,Td=`#ifndef FLAT_SHADED 1538 varying vec3 vNormal; 1539 #ifdef USE_TANGENT 1540 varying vec3 vTangent; 1541 varying vec3 vBitangent; 1542 #endif 1543#endif`,Ad=`#ifndef FLAT_SHADED 1544 varying vec3 vNormal; 1545 #ifdef USE_TANGENT 1546 varying vec3 vTangent; 1547 varying vec3 vBitangent; 1548 #endif 1549#endif`,bd=`#ifndef FLAT_SHADED 1550 vNormal = normalize( transformedNormal ); 1551 #ifdef USE_TANGENT 1552 vTangent = normalize( transformedTangent ); 1553 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1554 #endif 1555#endif`,wd=`#ifdef USE_NORMALMAP 1556 uniform sampler2D normalMap; 1557 uniform vec2 normalScale; 1558#endif 1559#ifdef USE_NORMALMAP_OBJECTSPACE 1560 uniform mat3 normalMatrix; 1561#endif 1562#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1563 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1564 vec3 q0 = dFdx( eye_pos.xyz ); 1565 vec3 q1 = dFdy( eye_pos.xyz ); 1566 vec2 st0 = dFdx( uv.st ); 1567 vec2 st1 = dFdy( uv.st ); 1568 vec3 N = surf_norm; 1569 vec3 q1perp = cross( q1, N ); 1570 vec3 q0perp = cross( N, q0 ); 1571 vec3 T = q1perp * st0.x + q0perp * st1.x; 1572 vec3 B = q1perp * st0.y + q0perp * st1.y; 1573 float det = max( dot( T, T ), dot( B, B ) ); 1574 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1575 return mat3( T * scale, B * scale, N ); 1576 } 1577#endif`,Rd=`#ifdef USE_CLEARCOAT 1578 vec3 clearcoatNormal = nonPerturbedNormal; 1579#endif`,Cd=`#ifdef USE_CLEARCOAT_NORMALMAP 1580 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1581 clearcoatMapN.xy *= clearcoatNormalScale; 1582 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1583#endif`,Ld=`#ifdef USE_CLEARCOATMAP 1584 uniform sampler2D clearcoatMap; 1585#endif 1586#ifdef USE_CLEARCOAT_NORMALMAP 1587 uniform sampler2D clearcoatNormalMap; 1588 uniform vec2 clearcoatNormalScale; 1589#endif 1590#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1591 uniform sampler2D clearcoatRoughnessMap; 1592#endif`,Pd=`#ifdef USE_IRIDESCENCEMAP 1593 uniform sampler2D iridescenceMap; 1594#endif 1595#ifdef USE_IRIDESCENCE_THICKNESSMAP 1596 uniform sampler2D iridescenceThicknessMap; 1597#endif`,Id=`#ifdef OPAQUE 1598diffuseColor.a = 1.0; 1599#endif 1600#ifdef USE_TRANSMISSION 1601diffuseColor.a *= material.transmissionAlpha; 1602#endif 1603gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Dd=`vec3 packNormalToRGB( const in vec3 normal ) { 1604 return normalize( normal ) * 0.5 + 0.5; 1605} 1606vec3 unpackRGBToNormal( const in vec3 rgb ) { 1607 return 2.0 * rgb.xyz - 1.0; 1608} 1609const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1610const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1611const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1612const float ShiftRight8 = 1. / 256.; 1613vec4 packDepthToRGBA( const in float v ) { 1614 vec4 r = vec4( fract( v * PackFactors ), v ); 1615 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1616} 1617float unpackRGBAToDepth( const in vec4 v ) { 1618 return dot( v, UnpackFactors ); 1619} 1620vec2 packDepthToRG( in highp float v ) { 1621 return packDepthToRGBA( v ).yx; 1622} 1623float unpackRGToDepth( const in highp vec2 v ) { 1624 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1625} 1626vec4 pack2HalfToRGBA( vec2 v ) { 1627 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1628 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1629} 1630vec2 unpackRGBATo2Half( vec4 v ) { 1631 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1632} 1633float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1634 return ( viewZ + near ) / ( near - far ); 1635} 1636float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1637 return depth * ( near - far ) - near; 1638} 1639float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1640 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1641} 1642float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1643 return ( near * far ) / ( ( far - near ) * depth - far ); 1644}`,Ud=`#ifdef PREMULTIPLIED_ALPHA 1645 gl_FragColor.rgb *= gl_FragColor.a; 1646#endif`,Nd=`vec4 mvPosition = vec4( transformed, 1.0 ); 1647#ifdef USE_BATCHING 1648 mvPosition = batchingMatrix * mvPosition; 1649#endif 1650#ifdef USE_INSTANCING 1651 mvPosition = instanceMatrix * mvPosition; 1652#endif 1653mvPosition = modelViewMatrix * mvPosition; 1654gl_Position = projectionMatrix * mvPosition;`,Fd=`#ifdef DITHERING 1655 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1656#endif`,Od=`#ifdef DITHERING 1657 vec3 dithering( vec3 color ) { 1658 float grid_position = rand( gl_FragCoord.xy ); 1659 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1660 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1661 return color + dither_shift_RGB; 1662 } 1663#endif`,Bd=`float roughnessFactor = roughness; 1664#ifdef USE_ROUGHNESSMAP 1665 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1666 roughnessFactor *= texelRoughness.g; 1667#endif`,Hd=`#ifdef USE_ROUGHNESSMAP 1668 uniform sampler2D roughnessMap;
1669#endif`,zd=`#if NUM_SPOT_LIGHT_COORDS > 0 1670 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1671#endif 1672#if NUM_SPOT_LIGHT_MAPS > 0 1673 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1674#endif 1675#ifdef USE_SHADOWMAP 1676 #if NUM_DIR_LIGHT_SHADOWS > 0 1677 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1678 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1679 struct DirectionalLightShadow { 1680 float shadowBias; 1681 float shadowNormalBias; 1682 float shadowRadius; 1683 vec2 shadowMapSize; 1684 }; 1685 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1686 #endif 1687 #if NUM_SPOT_LIGHT_SHADOWS > 0 1688 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1689 struct SpotLightShadow { 1690 float shadowBias; 1691 float shadowNormalBias; 1692 float shadowRadius; 1693 vec2 shadowMapSize; 1694 }; 1695 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1696 #endif 1697 #if NUM_POINT_LIGHT_SHADOWS > 0 1698 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1699 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1700 struct PointLightShadow { 1701 float shadowBias; 1702 float shadowNormalBias; 1703 float shadowRadius; 1704 vec2 shadowMapSize; 1705 float shadowCameraNear; 1706 float shadowCameraFar; 1707 }; 1708 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1709 #endif 1710 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1711 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1712 } 1713 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1714 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1715 } 1716 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1717 float occlusion = 1.0; 1718 vec2 distribution = texture2DDistribution( shadow, uv ); 1719 float hard_shadow = step( compare , distribution.x ); 1720 if (hard_shadow != 1.0 ) { 1721 float distance = compare - distribution.x ; 1722 float variance = max( 0.00000, distribution.y * distribution.y ); 1723 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 ); 1724 } 1725 return occlusion; 1726 } 1727 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1728 float shadow = 1.0; 1729 shadowCoord.xyz /= shadowCoord.w; 1730 shadowCoord.z += shadowBias; 1731 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1732 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1733 if ( frustumTest ) { 1734 #if defined( SHADOWMAP_TYPE_PCF ) 1735 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1736 float dx0 = - texelSize.x * shadowRadius; 1737 float dy0 = - texelSize.y * shadowRadius; 1738 float dx1 = + texelSize.x * shadowRadius; 1739 float dy1 = + texelSize.y * shadowRadius; 1740 float dx2 = dx0 / 2.0; 1741 float dy2 = dy0 / 2.0; 1742 float dx3 = dx1 / 2.0; 1743 float dy3 = dy1 / 2.0; 1744 shadow = ( 1745 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1746 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1747 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1748 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1749 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1750 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1751 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1752 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1753 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1754 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1755 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1756 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1757 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1758 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1759 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1760 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1761 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1762 ) * ( 1.0 / 17.0 ); 1763 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1764 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1765 float dx = texelSize.x; 1766 float dy = texelSize.y; 1767 vec2 uv = shadowCoord.xy;
1768 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1769 uv -= f * texelSize; 1770 shadow = ( 1771 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1772 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1773 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1775 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1776 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1777 f.x ) + 1778 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1779 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1780 f.x ) + 1781 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1782 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1783 f.y ) + 1784 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1785 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1786 f.y ) + 1787 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1788 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1789 f.x ), 1790 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1791 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1792 f.x ), 1793 f.y ) 1794 ) * ( 1.0 / 9.0 ); 1795 #elif defined( SHADOWMAP_TYPE_VSM ) 1796 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1797 #else 1798 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1799 #endif 1800 } 1801 return shadow; 1802 } 1803 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1804 vec3 absV = abs( v ); 1805 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1806 absV *= scaleToCube; 1807 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1808 vec2 planar = v.xy; 1809 float almostATexel = 1.5 * texelSizeY; 1810 float almostOne = 1.0 - almostATexel; 1811 if ( absV.z >= almostOne ) { 1812 if ( v.z > 0.0 ) 1813 planar.x = 4.0 - v.x; 1814 } else if ( absV.x >= almostOne ) { 1815 float signX = sign( v.x ); 1816 planar.x = v.z * signX + 2.0 * signX; 1817 } else if ( absV.y >= almostOne ) { 1818 float signY = sign( v.y ); 1819 planar.x = v.x + 2.0 * signY + 2.0; 1820 planar.y = v.z * signY - 2.0; 1821 } 1822 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1823 } 1824 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1825 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1826 vec3 lightToPosition = shadowCoord.xyz; 1827 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1828 vec3 bd3D = normalize( lightToPosition ); 1829 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1830 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1831 return ( 1832 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1833 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1834 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1835 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1836 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1837 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1838 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1839 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1840 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1841 ) * ( 1.0 / 9.0 ); 1842 #else 1843 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1844 #endif 1845 } 1846#endif`,Gd=`#if NUM_SPOT_LIGHT_COORDS > 0 1847 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1848 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1849#endif 1850#ifdef USE_SHADOWMAP 1851 #if NUM_DIR_LIGHT_SHADOWS > 0 1852 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1853 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1854 struct DirectionalLightShadow { 1855 float shadowBias; 1856 float shadowNormalBias; 1857 float shadowRadius; 1858 vec2 shadowMapSize; 1859 }; 1860 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1861 #endif
1862 #if NUM_SPOT_LIGHT_SHADOWS > 0 1863 struct SpotLightShadow { 1864 float shadowBias; 1865 float shadowNormalBias; 1866 float shadowRadius; 1867 vec2 shadowMapSize; 1868 }; 1869 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1870 #endif 1871 #if NUM_POINT_LIGHT_SHADOWS > 0 1872 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1873 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1874 struct PointLightShadow { 1875 float shadowBias; 1876 float shadowNormalBias; 1877 float shadowRadius; 1878 vec2 shadowMapSize; 1879 float shadowCameraNear; 1880 float shadowCameraFar; 1881 }; 1882 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1883 #endif 1884#endif`,kd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1885 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1886 vec4 shadowWorldPosition; 1887#endif 1888#if defined( USE_SHADOWMAP ) 1889 #if NUM_DIR_LIGHT_SHADOWS > 0 1890 #pragma unroll_loop_start 1891 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1892 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1893 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1894 } 1895 #pragma unroll_loop_end 1896 #endif 1897 #if NUM_POINT_LIGHT_SHADOWS > 0 1898 #pragma unroll_loop_start 1899 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1900 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1901 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1902 } 1903 #pragma unroll_loop_end 1904 #endif 1905#endif 1906#if NUM_SPOT_LIGHT_COORDS > 0 1907 #pragma unroll_loop_start 1908 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1909 shadowWorldPosition = worldPosition; 1910 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1911 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1912 #endif 1913 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1914 } 1915 #pragma unroll_loop_end 1916#endif`,Vd=`float getShadowMask() { 1917 float shadow = 1.0; 1918 #ifdef USE_SHADOWMAP 1919 #if NUM_DIR_LIGHT_SHADOWS > 0 1920 DirectionalLightShadow directionalLight; 1921 #pragma unroll_loop_start 1922 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1923 directionalLight = directionalLightShadows[ i ]; 1924 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1925 } 1926 #pragma unroll_loop_end 1927 #endif 1928 #if NUM_SPOT_LIGHT_SHADOWS > 0 1929 SpotLightShadow spotLight; 1930 #pragma unroll_loop_start 1931 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1932 spotLight = spotLightShadows[ i ]; 1933 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1934 } 1935 #pragma unroll_loop_end 1936 #endif 1937 #if NUM_POINT_LIGHT_SHADOWS > 0 1938 PointLightShadow pointLight; 1939 #pragma unroll_loop_start 1940 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1941 pointLight = pointLightShadows[ i ]; 1942 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1943 } 1944 #pragma unroll_loop_end 1945 #endif 1946 #endif 1947 return shadow; 1948}`,Wd=`#ifdef USE_SKINNING 1949 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1950 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1951 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1952 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1953#endif`,Xd=`#ifdef USE_SKINNING 1954 uniform mat4 bindMatrix; 1955 uniform mat4 bindMatrixInverse; 1956 uniform highp sampler2D boneTexture; 1957 mat4 getBoneMatrix( const in float i ) { 1958 int size = textureSize( boneTexture, 0 ).x; 1959 int j = int( i ) * 4; 1960 int x = j % size; 1961 int y = j / size; 1962 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 1963 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 1964 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 1965 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 1966 return mat4( v1, v2, v3, v4 ); 1967 } 1968#endif`,qd=`#ifdef USE_SKINNING 1969 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1970 vec4 skinned = vec4( 0.0 ); 1971 skinned += boneMatX * skinVertex * skinWeight.x; 1972 skinned += boneMatY * skinVertex * skinWeight.y; 1973 skinned += boneMatZ * skinVertex * skinWeight.z; 1974 skinned += boneMatW * skinVertex * skinWeight.w; 1975 transformed = ( bindMatrixInverse * skinned ).xyz; 1976#endif`,Yd=`#ifdef USE_SKINNING 1977 mat4 skinMatrix = mat4( 0.0 ); 1978 skinMatrix += skinWeight.x * boneMatX; 1979 skinMatrix += skinWeight.y * boneMatY; 1980 skinMatrix += skinWeight.z * boneMatZ; 1981 skinMatrix += skinWeight.w * boneMatW; 1982 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1983 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1984 #ifdef USE_TANGENT 1985 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1986 #endif 1987#endif`,jd=`float specularStrength; 1988#ifdef USE_SPECULARMAP 1989 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 1990 specularStrength = texelSpecular.r; 1991#else 1992 specularStrength = 1.0; 1993#endif`,Kd=`#ifdef USE_SPECULARMAP 1994 uniform sampler2D specularMap; 1995#endif`,Zd=`#if defined( TONE_MAPPING ) 1996 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1997#endif`,$d=`#ifndef saturate 1998#define saturate( a ) clamp( a, 0.0, 1.0 ) 1999#endif 2000uniform float toneMappingExposure; 2001vec3 LinearToneMapping( vec3 color ) { 2002 return saturate( toneMappingExposure * color ); 2003} 2004vec3 ReinhardToneMapping( vec3 color ) { 2005 color *= toneMappingExposure; 2006 return saturate( color / ( vec3( 1.0 ) + color ) ); 2007} 2008vec3 OptimizedCineonToneMapping( vec3 color ) { 2009 color *= toneMappingExposure; 2010 color = max( vec3( 0.0 ), color - 0.004 ); 2011 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2012} 2013vec3 RRTAndODTFit( vec3 v ) { 2014 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2015 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2016 return a / b; 2017} 2018vec3 ACESFilmicToneMapping( vec3 color ) { 2019 const mat3 ACESInputMat = mat3( 2020 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2021 vec3( 0.04823, 0.01566, 0.83777 ) 2022 ); 2023 const mat3 ACESOutputMat = mat3( 2024 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2025 vec3( -0.07367, -0.00605, 1.07602 ) 2026 ); 2027 color *= toneMappingExposure / 0.6; 2028 color = ACESInputMat * color; 2029 color = RRTAndODTFit( color ); 2030 color = ACESOutputMat * color; 2031 return saturate( color ); 2032} 2033vec3 CustomToneMapping( vec3 color ) { return color; }`,Jd=`#ifdef USE_TRANSMISSION 2034 material.transmission = transmission; 2035 material.transmissionAlpha = 1.0; 2036 material.thickness = thickness; 2037 material.attenuationDistance = attenuationDistance; 2038 material.attenuationColor = attenuationColor; 2039 #ifdef USE_TRANSMISSIONMAP 2040 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2041 #endif 2042 #ifdef USE_THICKNESSMAP 2043 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2044 #endif 2045 vec3 pos = vWorldPosition; 2046 vec3 v = normalize( cameraPosition - pos ); 2047 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2048 vec4 transmitted = getIBLVolumeRefraction( 2049 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2050 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 2051 material.attenuationColor, material.attenuationDistance ); 2052 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2053 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2054#endif`,Qd=`#ifdef USE_TRANSMISSION 2055 uniform float transmission; 2056 uniform float thickness; 2057 uniform float attenuationDistance; 2058 uniform vec3 attenuationColor; 2059 #ifdef USE_TRANSMISSIONMAP 2060 uniform sampler2D transmissionMap; 2061 #endif 2062 #ifdef USE_THICKNESSMAP 2063 uniform sampler2D thicknessMap; 2064 #endif 2065 uniform vec2 transmissionSamplerSize; 2066 uniform sampler2D transmissionSamplerMap; 2067 uniform mat4 modelMatrix; 2068 uniform mat4 projectionMatrix; 2069 varying vec3 vWorldPosition; 2070 float w0( float a ) { 2071 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2072 } 2073 float w1( float a ) { 2074 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2075 } 2076 float w2( float a ){ 2077 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2078 } 2079 float w3( float a ) { 2080 return ( 1.0 / 6.0 ) * ( a * a * a ); 2081 } 2082 float g0( float a ) { 2083 return w0( a ) + w1( a ); 2084 } 2085 float g1( float a ) { 2086 return w2( a ) + w3( a ); 2087 } 2088 float h0( float a ) { 2089 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2090 } 2091 float h1( float a ) { 2092 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2093 } 2094 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2095 uv = uv * texelSize.zw + 0.5; 2096 vec2 iuv = floor( uv ); 2097 vec2 fuv = fract( uv ); 2098 float g0x = g0( fuv.x ); 2099 float g1x = g1( fuv.x ); 2100 float h0x = h0( fuv.x ); 2101 float h1x = h1( fuv.x ); 2102 float h0y = h0( fuv.y ); 2103 float h1y = h1( fuv.y ); 2104 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2105 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2106 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2107 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2108 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2109 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2110 } 2111 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2112 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2113 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2114 vec2 fLodSizeInv = 1.0 / fLodSize; 2115 vec2 cLodSizeInv = 1.0 / cLodSize; 2116 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2117 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2118 return mix( fSample, cSample, fract( lod ) ); 2119 } 2120 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2121 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2122 vec3 modelScale; 2123 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2124 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2125 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2126 return normalize( refractionVector ) * thickness * modelScale; 2127 } 2128 float applyIorToRoughness( const in float roughness, const in float ior ) { 2129 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2130 } 2131 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2132 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2133 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2134 } 2135 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2136 if ( isinf( attenuationDistance ) ) { 2137 return vec3( 1.0 ); 2138 } else { 2139 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2140 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2141 } 2142 } 2143 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2144 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2145 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 2146 const in vec3 attenuationColor, const in float attenuationDistance ) { 2147 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2148 vec3 refractedRayExit = position + transmissionRay; 2149 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2150 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2151 refractionCoords += 1.0; 2152 refractionCoords /= 2.0; 2153 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2154 vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2155 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2156 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2157 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2158 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2159 } 2160#endif`,ef=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2161 varying vec2 vUv; 2162#endif 2163#ifdef USE_MAP 2164 varying vec2 vMapUv; 2165#endif 2166#ifdef USE_ALPHAMAP
2167 varying vec2 vAlphaMapUv; 2168#endif 2169#ifdef USE_LIGHTMAP 2170 varying vec2 vLightMapUv; 2171#endif 2172#ifdef USE_AOMAP 2173 varying vec2 vAoMapUv; 2174#endif 2175#ifdef USE_BUMPMAP 2176 varying vec2 vBumpMapUv; 2177#endif 2178#ifdef USE_NORMALMAP 2179 varying vec2 vNormalMapUv; 2180#endif 2181#ifdef USE_EMISSIVEMAP 2182 varying vec2 vEmissiveMapUv; 2183#endif 2184#ifdef USE_METALNESSMAP 2185 varying vec2 vMetalnessMapUv; 2186#endif 2187#ifdef USE_ROUGHNESSMAP 2188 varying vec2 vRoughnessMapUv; 2189#endif 2190#ifdef USE_ANISOTROPYMAP 2191 varying vec2 vAnisotropyMapUv; 2192#endif 2193#ifdef USE_CLEARCOATMAP 2194 varying vec2 vClearcoatMapUv; 2195#endif 2196#ifdef USE_CLEARCOAT_NORMALMAP 2197 varying vec2 vClearcoatNormalMapUv; 2198#endif 2199#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2200 varying vec2 vClearcoatRoughnessMapUv; 2201#endif 2202#ifdef USE_IRIDESCENCEMAP 2203 varying vec2 vIridescenceMapUv; 2204#endif 2205#ifdef USE_IRIDESCENCE_THICKNESSMAP 2206 varying vec2 vIridescenceThicknessMapUv; 2207#endif 2208#ifdef USE_SHEEN_COLORMAP 2209 varying vec2 vSheenColorMapUv; 2210#endif 2211#ifdef USE_SHEEN_ROUGHNESSMAP 2212 varying vec2 vSheenRoughnessMapUv; 2213#endif 2214#ifdef USE_SPECULARMAP 2215 varying vec2 vSpecularMapUv; 2216#endif 2217#ifdef USE_SPECULAR_COLORMAP 2218 varying vec2 vSpecularColorMapUv; 2219#endif 2220#ifdef USE_SPECULAR_INTENSITYMAP 2221 varying vec2 vSpecularIntensityMapUv; 2222#endif 2223#ifdef USE_TRANSMISSIONMAP 2224 uniform mat3 transmissionMapTransform; 2225 varying vec2 vTransmissionMapUv; 2226#endif 2227#ifdef USE_THICKNESSMAP 2228 uniform mat3 thicknessMapTransform; 2229 varying vec2 vThicknessMapUv; 2230#endif`,tf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2231 varying vec2 vUv; 2232#endif 2233#ifdef USE_MAP 2234 uniform mat3 mapTransform; 2235 varying vec2 vMapUv; 2236#endif 2237#ifdef USE_ALPHAMAP 2238 uniform mat3 alphaMapTransform; 2239 varying vec2 vAlphaMapUv; 2240#endif 2241#ifdef USE_LIGHTMAP 2242 uniform mat3 lightMapTransform; 2243 varying vec2 vLightMapUv; 2244#endif 2245#ifdef USE_AOMAP 2246 uniform mat3 aoMapTransform; 2247 varying vec2 vAoMapUv; 2248#endif 2249#ifdef USE_BUMPMAP 2250 uniform mat3 bumpMapTransform; 2251 varying vec2 vBumpMapUv; 2252#endif 2253#ifdef USE_NORMALMAP 2254 uniform mat3 normalMapTransform; 2255 varying vec2 vNormalMapUv; 2256#endif 2257#ifdef USE_DISPLACEMENTMAP 2258 uniform mat3 displacementMapTransform; 2259 varying vec2 vDisplacementMapUv; 2260#endif 2261#ifdef USE_EMISSIVEMAP 2262 uniform mat3 emissiveMapTransform; 2263 varying vec2 vEmissiveMapUv; 2264#endif 2265#ifdef USE_METALNESSMAP 2266 uniform mat3 metalnessMapTransform; 2267 varying vec2 vMetalnessMapUv; 2268#endif 2269#ifdef USE_ROUGHNESSMAP 2270 uniform mat3 roughnessMapTransform; 2271 varying vec2 vRoughnessMapUv; 2272#endif 2273#ifdef USE_ANISOTROPYMAP 2274 uniform mat3 anisotropyMapTransform; 2275 varying vec2 vAnisotropyMapUv; 2276#endif 2277#ifdef USE_CLEARCOATMAP 2278 uniform mat3 clearcoatMapTransform; 2279 varying vec2 vClearcoatMapUv; 2280#endif 2281#ifdef USE_CLEARCOAT_NORMALMAP 2282 uniform mat3 clearcoatNormalMapTransform; 2283 varying vec2 vClearcoatNormalMapUv; 2284#endif 2285#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2286 uniform mat3 clearcoatRoughnessMapTransform; 2287 varying vec2 vClearcoatRoughnessMapUv; 2288#endif 2289#ifdef USE_SHEEN_COLORMAP 2290 uniform mat3 sheenColorMapTransform; 2291 varying vec2 vSheenColorMapUv; 2292#endif 2293#ifdef USE_SHEEN_ROUGHNESSMAP 2294 uniform mat3 sheenRoughnessMapTransform; 2295 varying vec2 vSheenRoughnessMapUv; 2296#endif 2297#ifdef USE_IRIDESCENCEMAP 2298 uniform mat3 iridescenceMapTransform; 2299 varying vec2 vIridescenceMapUv; 2300#endif 2301#ifdef USE_IRIDESCENCE_THICKNESSMAP 2302 uniform mat3 iridescenceThicknessMapTransform; 2303 varying vec2 vIridescenceThicknessMapUv; 2304#endif 2305#ifdef USE_SPECULARMAP 2306 uniform mat3 specularMapTransform; 2307 varying vec2 vSpecularMapUv; 2308#endif 2309#ifdef USE_SPECULAR_COLORMAP 2310 uniform mat3 specularColorMapTransform; 2311 varying vec2 vSpecularColorMapUv; 2312#endif 2313#ifdef USE_SPECULAR_INTENSITYMAP 2314 uniform mat3 specularIntensityMapTransform; 2315 varying vec2 vSpecularIntensityMapUv; 2316#endif 2317#ifdef USE_TRANSMISSIONMAP 2318 uniform mat3 transmissionMapTransform; 2319 varying vec2 vTransmissionMapUv; 2320#endif 2321#ifdef USE_THICKNESSMAP 2322 uniform mat3 thicknessMapTransform; 2323 varying vec2 vThicknessMapUv; 2324#endif`,nf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2325 vUv = vec3( uv, 1 ).xy; 2326#endif 2327#ifdef USE_MAP 2328 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2329#endif 2330#ifdef USE_ALPHAMAP 2331 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2332#endif 2333#ifdef USE_LIGHTMAP 2334 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2335#endif 2336#ifdef USE_AOMAP 2337 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2338#endif 2339#ifdef USE_BUMPMAP 2340 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2341#endif 2342#ifdef USE_NORMALMAP 2343 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2344#endif 2345#ifdef USE_DISPLACEMENTMAP 2346 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2347#endif 2348#ifdef USE_EMISSIVEMAP 2349 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2350#endif 2351#ifdef USE_METALNESSMAP 2352 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2353#endif 2354#ifdef USE_ROUGHNESSMAP 2355 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2356#endif 2357#ifdef USE_ANISOTROPYMAP 2358 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2359#endif 2360#ifdef USE_CLEARCOATMAP 2361 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2362#endif 2363#ifdef USE_CLEARCOAT_NORMALMAP 2364 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2365#endif 2366#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2367 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2368#endif
2369#ifdef USE_IRIDESCENCEMAP 2370 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2371#endif 2372#ifdef USE_IRIDESCENCE_THICKNESSMAP 2373 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2374#endif 2375#ifdef USE_SHEEN_COLORMAP 2376 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2377#endif 2378#ifdef USE_SHEEN_ROUGHNESSMAP 2379 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2380#endif 2381#ifdef USE_SPECULARMAP 2382 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2383#endif 2384#ifdef USE_SPECULAR_COLORMAP 2385 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2386#endif 2387#ifdef USE_SPECULAR_INTENSITYMAP 2388 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2389#endif 2390#ifdef USE_TRANSMISSIONMAP 2391 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2392#endif 2393#ifdef USE_THICKNESSMAP 2394 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2395#endif`,sf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2396 vec4 worldPosition = vec4( transformed, 1.0 ); 2397 #ifdef USE_BATCHING 2398 worldPosition = batchingMatrix * worldPosition; 2399 #endif 2400 #ifdef USE_INSTANCING 2401 worldPosition = instanceMatrix * worldPosition; 2402 #endif 2403 worldPosition = modelMatrix * worldPosition; 2404#endif`;const rf=`varying vec2 vUv; 2405uniform mat3 uvTransform; 2406void main() { 2407 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2408 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2409}`,af=`uniform sampler2D t2D; 2410uniform float backgroundIntensity; 2411varying vec2 vUv; 2412void main() { 2413 vec4 texColor = texture2D( t2D, vUv ); 2414 #ifdef DECODE_VIDEO_TEXTURE 2415 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2416 #endif 2417 texColor.rgb *= backgroundIntensity; 2418 gl_FragColor = texColor; 2419 #include <tonemapping_fragment> 2420 #include <colorspace_fragment> 2421}`,of=`varying vec3 vWorldDirection; 2422#include <common> 2423void main() { 2424 vWorldDirection = transformDirection( position, modelMatrix ); 2425 #include <begin_vertex> 2426 #include <project_vertex> 2427 gl_Position.z = gl_Position.w; 2428}`,cf=`#ifdef ENVMAP_TYPE_CUBE 2429 uniform samplerCube envMap; 2430#elif defined( ENVMAP_TYPE_CUBE_UV ) 2431 uniform sampler2D envMap; 2432#endif 2433uniform float flipEnvMap; 2434uniform float backgroundBlurriness; 2435uniform float backgroundIntensity; 2436varying vec3 vWorldDirection; 2437#include <cube_uv_reflection_fragment> 2438void main() { 2439 #ifdef ENVMAP_TYPE_CUBE 2440 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2441 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2442 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 2443 #else 2444 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2445 #endif 2446 texColor.rgb *= backgroundIntensity; 2447 gl_FragColor = texColor; 2448 #include <tonemapping_fragment> 2449 #include <colorspace_fragment> 2450}`,lf=`varying vec3 vWorldDirection; 2451#include <common> 2452void main() { 2453 vWorldDirection = transformDirection( position, modelMatrix ); 2454 #include <begin_vertex> 2455 #include <project_vertex> 2456 gl_Position.z = gl_Position.w; 2457}`,hf=`uniform samplerCube tCube; 2458uniform float tFlip; 2459uniform float opacity; 2460varying vec3 vWorldDirection; 2461void main() { 2462 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2463 gl_FragColor = texColor; 2464 gl_FragColor.a *= opacity; 2465 #include <tonemapping_fragment> 2466 #include <colorspace_fragment> 2467}`,uf=`#include <common> 2468#include <batching_pars_vertex> 2469#include <uv_pars_vertex> 2470#include <displacementmap_pars_vertex> 2471#include <morphtarget_pars_vertex> 2472#include <skinning_pars_vertex> 2473#include <logdepthbuf_pars_vertex> 2474#include <clipping_planes_pars_vertex> 2475varying vec2 vHighPrecisionZW; 2476void main() { 2477 #include <uv_vertex> 2478 #include <batching_vertex> 2479 #include <skinbase_vertex> 2480 #ifdef USE_DISPLACEMENTMAP 2481 #include <beginnormal_vertex> 2482 #include <morphnormal_vertex> 2483 #include <skinnormal_vertex> 2484 #endif 2485 #include <begin_vertex> 2486 #include <morphtarget_vertex> 2487 #include <skinning_vertex> 2488 #include <displacementmap_vertex> 2489 #include <project_vertex> 2490 #include <logdepthbuf_vertex> 2491 #include <clipping_planes_vertex> 2492 vHighPrecisionZW = gl_Position.zw; 2493}`,df=`#if DEPTH_PACKING == 3200 2494 uniform float opacity; 2495#endif 2496#include <common> 2497#include <packing> 2498#include <uv_pars_fragment> 2499#include <map_pars_fragment> 2500#include <alphamap_pars_fragment> 2501#include <alphatest_pars_fragment> 2502#include <alphahash_pars_fragment> 2503#include <logdepthbuf_pars_fragment> 2504#include <clipping_planes_pars_fragment> 2505varying vec2 vHighPrecisionZW; 2506void main() { 2507 #include <clipping_planes_fragment> 2508 vec4 diffuseColor = vec4( 1.0 ); 2509 #if DEPTH_PACKING == 3200 2510 diffuseColor.a = opacity; 2511 #endif 2512 #include <map_fragment> 2513 #include <alphamap_fragment> 2514 #include <alphatest_fragment> 2515 #include <alphahash_fragment> 2516 #include <logdepthbuf_fragment> 2517 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2518 #if DEPTH_PACKING == 3200 2519 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2520 #elif DEPTH_PACKING == 3201 2521 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2522 #endif 2523}`,ff=`#define DISTANCE 2524varying vec3 vWorldPosition; 2525#include <common> 2526#include <batching_pars_vertex> 2527#include <uv_pars_vertex> 2528#include <displacementmap_pars_vertex> 2529#include <morphtarget_pars_vertex> 2530#include <skinning_pars_vertex> 2531#include <clipping_planes_pars_vertex> 2532void main() { 2533 #include <uv_vertex> 2534 #include <batching_vertex> 2535 #include <skinbase_vertex> 2536 #ifdef USE_DISPLACEMENTMAP 2537 #include <beginnormal_vertex> 2538 #include <morphnormal_vertex> 2539 #include <skinnormal_vertex> 2540 #endif 2541 #include <begin_vertex> 2542 #include <morphtarget_vertex> 2543 #include <skinning_vertex> 2544 #include <displacementmap_vertex> 2545 #include <project_vertex> 2546 #include <worldpos_vertex> 2547 #include <clipping_planes_vertex> 2548 vWorldPosition = worldPosition.xyz; 2549}`,pf=`#define DISTANCE 2550uniform vec3 referencePosition; 2551uniform float nearDistance; 2552uniform float farDistance; 2553varying vec3 vWorldPosition; 2554#include <common> 2555#include <packing> 2556#include <uv_pars_fragment> 2557#include <map_pars_fragment> 2558#include <alphamap_pars_fragment> 2559#include <alphatest_pars_fragment> 2560#include <alphahash_pars_fragment> 2561#include <clipping_planes_pars_fragment> 2562void main () { 2563 #include <clipping_planes_fragment> 2564 vec4 diffuseColor = vec4( 1.0 ); 2565 #include <map_fragment> 2566 #include <alphamap_fragment> 2567 #include <alphatest_fragment> 2568 #include <alphahash_fragment> 2569 float dist = length( vWorldPosition - referencePosition ); 2570 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2571 dist = saturate( dist ); 2572 gl_FragColor = packDepthToRGBA( dist ); 2573}`,mf=`varying vec3 vWorldDirection; 2574#include <common> 2575void main() { 2576 vWorldDirection = transformDirection( position, modelMatrix ); 2577 #include <begin_vertex> 2578 #include <project_vertex> 2579}`,gf=`uniform sampler2D tEquirect; 2580varying vec3 vWorldDirection; 2581#include <common> 2582void main() { 2583 vec3 direction = normalize( vWorldDirection ); 2584 vec2 sampleUV = equirectUv( direction ); 2585 gl_FragColor = texture2D( tEquirect, sampleUV ); 2586 #include <tonemapping_fragment> 2587 #include <colorspace_fragment> 2588}`,_f=`uniform float scale; 2589attribute float lineDistance; 2590varying float vLineDistance; 2591#include <common> 2592#include <uv_pars_vertex> 2593#include <color_pars_vertex> 2594#include <fog_pars_vertex> 2595#include <morphtarget_pars_vertex> 2596#include <logdepthbuf_pars_vertex> 2597#include <clipping_planes_pars_vertex> 2598void main() { 2599 vLineDistance = scale * lineDistance; 2600 #include <uv_vertex> 2601 #include <color_vertex> 2602 #include <morphcolor_vertex> 2603 #include <begin_vertex> 2604 #include <morphtarget_vertex> 2605 #include <project_vertex> 2606 #include <logdepthbuf_vertex> 2607 #include <clipping_planes_vertex> 2608 #include <fog_vertex> 2609}`,xf=`uniform vec3 diffuse; 2610uniform float opacity; 2611uniform float dashSize; 2612uniform float totalSize; 2613varying float vLineDistance; 2614#include <common> 2615#include <color_pars_fragment> 2616#include <uv_pars_fragment> 2617#include <map_pars_fragment> 2618#include <fog_pars_fragment> 2619#include <logdepthbuf_pars_fragment> 2620#include <clipping_planes_pars_fragment> 2621void main() { 2622 #include <clipping_planes_fragment> 2623 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2624 discard; 2625 } 2626 vec3 outgoingLight = vec3( 0.0 ); 2627 vec4 diffuseColor = vec4( diffuse, opacity ); 2628 #include <logdepthbuf_fragment> 2629 #include <map_fragment> 2630 #include <color_fragment> 2631 outgoingLight = diffuseColor.rgb; 2632 #include <opaque_fragment> 2633 #include <tonemapping_fragment> 2634 #include <colorspace_fragment> 2635 #include <fog_fragment> 2636 #include <premultiplied_alpha_fragment> 2637}`,vf=`#include <common> 2638#include <batching_pars_vertex> 2639#include <uv_pars_vertex> 2640#include <envmap_pars_vertex> 2641#include <color_pars_vertex> 2642#include <fog_pars_vertex> 2643#include <morphtarget_pars_vertex> 2644#include <skinning_pars_vertex> 2645#include <logdepthbuf_pars_vertex> 2646#include <clipping_planes_pars_vertex> 2647void main() { 2648 #include <uv_vertex> 2649 #include <color_vertex> 2650 #include <morphcolor_vertex> 2651 #include <batching_vertex> 2652 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2653 #include <beginnormal_vertex> 2654 #include <morphnormal_vertex> 2655 #include <skinbase_vertex> 2656 #include <skinnormal_vertex> 2657 #include <defaultnormal_vertex> 2658 #endif 2659 #include <begin_vertex> 2660 #include <morphtarget_vertex> 2661 #include <skinning_vertex> 2662 #include <project_vertex> 2663 #include <logdepthbuf_vertex> 2664 #include <clipping_planes_vertex> 2665 #include <worldpos_vertex> 2666 #include <envmap_vertex> 2667 #include <fog_vertex> 2668}`,Mf=`uniform vec3 diffuse; 2669uniform float opacity; 2670#ifndef FLAT_SHADED 2671 varying vec3 vNormal; 2672#endif 2673#include <common> 2674#include <dithering_pars_fragment> 2675#include <color_pars_fragment> 2676#include <uv_pars_fragment> 2677#include <map_pars_fragment> 2678#include <alphamap_pars_fragment> 2679#include <alphatest_pars_fragment> 2680#include <alphahash_pars_fragment> 2681#include <aomap_pars_fragment> 2682#include <lightmap_pars_fragment> 2683#include <envmap_common_pars_fragment> 2684#include <envmap_pars_fragment> 2685#include <fog_pars_fragment> 2686#include <specularmap_pars_fragment> 2687#include <logdepthbuf_pars_fragment> 2688#include <clipping_planes_pars_fragment> 2689void main() { 2690 #include <clipping_planes_fragment> 2691 vec4 diffuseColor = vec4( diffuse, opacity ); 2692 #include <logdepthbuf_fragment> 2693 #include <map_fragment> 2694 #include <color_fragment> 2695 #include <alphamap_fragment> 2696 #include <alphatest_fragment> 2697 #include <alphahash_fragment> 2698 #include <specularmap_fragment> 2699 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2700 #ifdef USE_LIGHTMAP 2701 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2702 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2703 #else 2704 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2705 #endif 2706 #include <aomap_fragment> 2707 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2708 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2709 #include <envmap_fragment> 2710 #include <opaque_fragment> 2711 #include <tonemapping_fragment> 2712 #include <colorspace_fragment> 2713 #include <fog_fragment> 2714 #include <premultiplied_alpha_fragment> 2715 #include <dithering_fragment> 2716}`,Sf=`#define LAMBERT 2717varying vec3 vViewPosition; 2718#include <common> 2719#include <batching_pars_vertex> 2720#include <uv_pars_vertex> 2721#include <displacementmap_pars_vertex> 2722#include <envmap_pars_vertex> 2723#include <color_pars_vertex> 2724#include <fog_pars_vertex> 2725#include <normal_pars_vertex> 2726#include <morphtarget_pars_vertex> 2727#include <skinning_pars_vertex> 2728#include <shadowmap_pars_vertex> 2729#include <logdepthbuf_pars_vertex> 2730#include <clipping_planes_pars_vertex> 2731void main() { 2732 #include <uv_vertex> 2733 #include <color_vertex> 2734 #include <morphcolor_vertex> 2735 #include <batching_vertex> 2736 #include <beginnormal_vertex> 2737 #include <morphnormal_vertex> 2738 #include <skinbase_vertex> 2739 #include <skinnormal_vertex> 2740 #include <defaultnormal_vertex> 2741 #include <normal_vertex> 2742 #include <begin_vertex> 2743 #include <morphtarget_vertex> 2744 #include <skinning_vertex> 2745 #include <displacementmap_vertex> 2746 #include <project_vertex> 2747 #include <logdepthbuf_vertex> 2748 #include <clipping_planes_vertex> 2749 vViewPosition = - mvPosition.xyz; 2750 #include <worldpos_vertex> 2751 #include <envmap_vertex> 2752 #include <shadowmap_vertex> 2753 #include <fog_vertex> 2754}
2754`,yf=`#define LAMBERT 2755uniform vec3 diffuse; 2756uniform vec3 emissive; 2757uniform float opacity; 2758#include <common> 2759#include <packing> 2760#include <dithering_pars_fragment> 2761#include <color_pars_fragment> 2762#include <uv_pars_fragment> 2763#include <map_pars_fragment> 2764#include <alphamap_pars_fragment> 2765#include <alphatest_pars_fragment> 2766#include <alphahash_pars_fragment> 2767#include <aomap_pars_fragment> 2768#include <lightmap_pars_fragment> 2769#include <emissivemap_pars_fragment> 2770#include <envmap_common_pars_fragment> 2771#include <envmap_pars_fragment> 2772#include <fog_pars_fragment> 2773#include <bsdfs> 2774#include <lights_pars_begin> 2775#include <normal_pars_fragment> 2776#include <lights_lambert_pars_fragment> 2777#include <shadowmap_pars_fragment> 2778#include <bumpmap_pars_fragment> 2779#include <normalmap_pars_fragment> 2780#include <specularmap_pars_fragment> 2781#include <logdepthbuf_pars_fragment> 2782#include <clipping_planes_pars_fragment> 2783void main() { 2784 #include <clipping_planes_fragment> 2785 vec4 diffuseColor = vec4( diffuse, opacity ); 2786 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2787 vec3 totalEmissiveRadiance = emissive; 2788 #include <logdepthbuf_fragment> 2789 #include <map_fragment> 2790 #include <color_fragment> 2791 #include <alphamap_fragment> 2792 #include <alphatest_fragment> 2793 #include <alphahash_fragment> 2794 #include <specularmap_fragment> 2795 #include <normal_fragment_begin> 2796 #include <normal_fragment_maps> 2797 #include <emissivemap_fragment> 2798 #include <lights_lambert_fragment> 2799 #include <lights_fragment_begin> 2800 #include <lights_fragment_maps> 2801 #include <lights_fragment_end> 2802 #include <aomap_fragment> 2803 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2804 #include <envmap_fragment> 2805 #include <opaque_fragment> 2806 #include <tonemapping_fragment> 2807 #include <colorspace_fragment> 2808 #include <fog_fragment> 2809 #include <premultiplied_alpha_fragment> 2810 #include <dithering_fragment> 2811}`,Ef=`#define MATCAP 2812varying vec3 vViewPosition; 2813#include <common> 2814#include <batching_pars_vertex> 2815#include <uv_pars_vertex> 2816#include <color_pars_vertex> 2817#include <displacementmap_pars_vertex> 2818#include <fog_pars_vertex> 2819#include <normal_pars_vertex> 2820#include <morphtarget_pars_vertex> 2821#include <skinning_pars_vertex> 2822#include <logdepthbuf_pars_vertex> 2823#include <clipping_planes_pars_vertex> 2824void main() { 2825 #include <uv_vertex> 2826 #include <color_vertex> 2827 #include <morphcolor_vertex> 2828 #include <batching_vertex> 2829 #include <beginnormal_vertex> 2830 #include <morphnormal_vertex> 2831 #include <skinbase_vertex> 2832 #include <skinnormal_vertex> 2833 #include <defaultnormal_vertex> 2834 #include <normal_vertex> 2835 #include <begin_vertex> 2836 #include <morphtarget_vertex> 2837 #include <skinning_vertex> 2838 #include <displacementmap_vertex> 2839 #include <project_vertex> 2840 #include <logdepthbuf_vertex> 2841 #include <clipping_planes_vertex> 2842 #include <fog_vertex> 2843 vViewPosition = - mvPosition.xyz; 2844}`,Tf=`#define MATCAP 2845uniform vec3 diffuse; 2846uniform float opacity; 2847uniform sampler2D matcap; 2848varying vec3 vViewPosition; 2849#include <common> 2850#include <dithering_pars_fragment> 2851#include <color_pars_fragment> 2852#include <uv_pars_fragment> 2853#include <map_pars_fragment> 2854#include <alphamap_pars_fragment> 2855#include <alphatest_pars_fragment> 2856#include <alphahash_pars_fragment> 2857#include <fog_pars_fragment> 2858#include <normal_pars_fragment> 2859#include <bumpmap_pars_fragment> 2860#include <normalmap_pars_fragment> 2861#include <logdepthbuf_pars_fragment> 2862#include <clipping_planes_pars_fragment> 2863void main() { 2864 #include <clipping_planes_fragment> 2865 vec4 diffuseColor = vec4( diffuse, opacity ); 2866 #include <logdepthbuf_fragment> 2867 #include <map_fragment> 2868 #include <color_fragment> 2869 #include <alphamap_fragment> 2870 #include <alphatest_fragment> 2871 #include <alphahash_fragment> 2872 #include <normal_fragment_begin> 2873 #include <normal_fragment_maps> 2874 vec3 viewDir = normalize( vViewPosition ); 2875 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2876 vec3 y = cross( viewDir, x ); 2877 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2878 #ifdef USE_MATCAP 2879 vec4 matcapColor = texture2D( matcap, uv ); 2880 #else 2881 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2882 #endif 2883 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2884 #include <opaque_fragment> 2885 #include <tonemapping_fragment> 2886 #include <colorspace_fragment> 2887 #include <fog_fragment> 2888 #include <premultiplied_alpha_fragment> 2889 #include <dithering_fragment> 2890}`,Af=`#define NORMAL 2891#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2892 varying vec3 vViewPosition; 2893#endif 2894#include <common> 2895#include <batching_pars_vertex> 2896#include <uv_pars_vertex> 2897#include <displacementmap_pars_vertex> 2898#include <normal_pars_vertex> 2899#include <morphtarget_pars_vertex> 2900#include <skinning_pars_vertex> 2901#include <logdepthbuf_pars_vertex> 2902#include <clipping_planes_pars_vertex> 2903void main() { 2904 #include <uv_vertex> 2905 #include <batching_vertex> 2906 #include <beginnormal_vertex> 2907 #include <morphnormal_vertex> 2908 #include <skinbase_vertex> 2909 #include <skinnormal_vertex> 2910 #include <defaultnormal_vertex> 2911 #include <normal_vertex> 2912 #include <begin_vertex> 2913 #include <morphtarget_vertex> 2914 #include <skinning_vertex> 2915 #include <displacementmap_vertex> 2916 #include <project_vertex> 2917 #include <logdepthbuf_vertex> 2918 #include <clipping_planes_vertex> 2919#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2920 vViewPosition = - mvPosition.xyz; 2921#endif 2922}`,bf=`#define NORMAL 2923uniform float opacity; 2924#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2925 varying vec3 vViewPosition; 2926#endif 2927#include <packing> 2928#include <uv_pars_fragment> 2929#include <normal_pars_fragment> 2930#include <bumpmap_pars_fragment> 2931#include <normalmap_pars_fragment> 2932#include <logdepthbuf_pars_fragment> 2933#include <clipping_planes_pars_fragment> 2934void main() { 2935 #include <clipping_planes_fragment> 2936 #include <logdepthbuf_fragment> 2937 #include <normal_fragment_begin> 2938 #include <normal_fragment_maps> 2939 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2940 #ifdef OPAQUE 2941 gl_FragColor.a = 1.0; 2942 #endif 2943}`,wf=`#define PHONG 2944varying vec3 vViewPosition; 2945#include <common> 2946#include <batching_pars_vertex> 2947#include <uv_pars_vertex> 2948#include <displacementmap_pars_vertex> 2949#include <envmap_pars_vertex> 2950#include <color_pars_vertex> 2951#include <fog_pars_vertex> 2952#include <normal_pars_vertex> 2953#include <morphtarget_pars_vertex> 2954#include <skinning_pars_vertex> 2955#include <shadowmap_pars_vertex> 2956#include <logdepthbuf_pars_vertex> 2957#include <clipping_planes_pars_vertex> 2958void main() { 2959 #include <uv_vertex> 2960 #include <color_vertex> 2961 #include <morphcolor_vertex> 2962 #include <batching_vertex> 2963 #include <beginnormal_vertex> 2964 #include <morphnormal_vertex> 2965 #include <skinbase_vertex> 2966 #include <skinnormal_vertex> 2967 #include <defaultnormal_vertex> 2968 #include <normal_vertex> 2969 #include <begin_vertex> 2970 #include <morphtarget_vertex> 2971 #include <skinning_vertex> 2972 #include <displacementmap_vertex> 2973 #include <project_vertex> 2974 #include <logdepthbuf_vertex> 2975 #include <clipping_planes_vertex> 2976 vViewPosition = - mvPosition.xyz; 2977 #include <worldpos_vertex> 2978 #include <envmap_vertex> 2979 #include <shadowmap_vertex> 2980 #include <fog_vertex> 2981}`,Rf=`#define PHONG 2982uniform vec3 diffuse; 2983uniform vec3 emissive; 2984uniform vec3 specular; 2985uniform float shininess; 2986uniform float opacity; 2987#include <common> 2988#include <packing> 2989#include <dithering_pars_fragment> 2990#include <color_pars_fragment> 2991#include <uv_pars_fragment> 2992#include <map_pars_fragment> 2993#include <alphamap_pars_fragment> 2994#include <alphatest_pars_fragment> 2995#include <alphahash_pars_fragment> 2996#include <aomap_pars_fragment> 2997#include <lightmap_pars_fragment> 2998#include <emissivemap_pars_fragment> 2999#include <envmap_common_pars_fragment> 3000#include <envmap_pars_fragment> 3001#include <fog_pars_fragment> 3002#include <bsdfs> 3003#include <lights_pars_begin> 3004#include <normal_pars_fragment> 3005#include <lights_phong_pars_fragment> 3006#include <shadowmap_pars_fragment> 3007#include <bumpmap_pars_fragment> 3008#include <normalmap_pars_fragment> 3009#include <specularmap_pars_fragment> 3010#include <logdepthbuf_pars_fragment> 3011#include <clipping_planes_pars_fragment> 3012void main() { 3013 #include <clipping_planes_fragment> 3014 vec4 diffuseColor = vec4( diffuse, opacity ); 3015 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3016 vec3 totalEmissiveRadiance = emissive; 3017 #include <logdepthbuf_fragment> 3018 #include <map_fragment> 3019 #include <color_fragment> 3020 #include <alphamap_fragment> 3021 #include <alphatest_fragment> 3022 #include <alphahash_fragment> 3023 #include <specularmap_fragment> 3024 #include <normal_fragment_begin> 3025 #include <normal_fragment_maps> 3026 #include <emissivemap_fragment> 3027 #include <lights_phong_fragment> 3028 #include <lights_fragment_begin> 3029 #include <lights_fragment_maps> 3030 #include <lights_fragment_end> 3031 #include <aomap_fragment> 3032 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3033 #include <envmap_fragment> 3034 #include <opaque_fragment> 3035 #include <tonemapping_fragment> 3036 #include <colorspace_fragment> 3037 #include <fog_fragment> 3038 #include <premultiplied_alpha_fragment> 3039 #include <dithering_fragment> 3040}`,Cf=`#define STANDARD 3041varying vec3 vViewPosition; 3042#ifdef USE_TRANSMISSION 3043 varying vec3 vWorldPosition; 3044#endif 3045#include <common> 3046#include <batching_pars_vertex> 3047#include <uv_pars_vertex> 3048#include <displacementmap_pars_vertex> 3049#include <color_pars_vertex> 3050#include <fog_pars_vertex> 3051#include <normal_pars_vertex> 3052#include <morphtarget_pars_vertex> 3053#include <skinning_pars_vertex> 3054#include <shadowmap_pars_vertex> 3055#include <logdepthbuf_pars_vertex> 3056#include <clipping_planes_pars_vertex> 3057void main() { 3058 #include <uv_vertex> 3059 #include <color_vertex> 3060 #include <morphcolor_vertex> 3061 #include <batching_vertex> 3062 #include <beginnormal_vertex> 3063 #include <morphnormal_vertex> 3064 #include <skinbase_vertex> 3065 #include <skinnormal_vertex> 3066 #include <defaultnormal_vertex> 3067 #include <normal_vertex> 3068 #include <begin_vertex> 3069 #include <morphtarget_vertex> 3070 #include <skinning_vertex> 3071 #include <displacementmap_vertex> 3072 #include <project_vertex> 3073 #include <logdepthbuf_vertex> 3074 #include <clipping_planes_vertex> 3075 vViewPosition = - mvPosition.xyz; 3076 #include <worldpos_vertex> 3077 #include <shadowmap_vertex> 3078 #include <fog_vertex> 3079#ifdef USE_TRANSMISSION 3080 vWorldPosition = worldPosition.xyz; 3081#endif 3082}`,Lf=`#define STANDARD 3083#ifdef PHYSICAL 3084 #define IOR 3085 #define USE_SPECULAR 3086#endif 3087uniform vec3 diffuse; 3088uniform vec3 emissive; 3089uniform float roughness; 3090uniform float metalness; 3091uniform float opacity; 3092#ifdef IOR 3093 uniform float ior; 3094#endif 3095#ifdef USE_SPECULAR 3096 uniform float specularIntensity; 3097 uniform vec3 specularColor; 3098 #ifdef USE_SPECULAR_COLORMAP 3099 uniform sampler2D specularColorMap; 3100 #endif 3101 #ifdef USE_SPECULAR_INTENSITYMAP 3102 uniform sampler2D specularIntensityMap; 3103 #endif 3104#endif 3105#ifdef USE_CLEARCOAT 3106 uniform float clearcoat; 3107 uniform float clearcoatRoughness; 3108#endif
3109#ifdef USE_IRIDESCENCE 3110 uniform float iridescence; 3111 uniform float iridescenceIOR; 3112 uniform float iridescenceThicknessMinimum; 3113 uniform float iridescenceThicknessMaximum; 3114#endif 3115#ifdef USE_SHEEN 3116 uniform vec3 sheenColor; 3117 uniform float sheenRoughness; 3118 #ifdef USE_SHEEN_COLORMAP 3119 uniform sampler2D sheenColorMap; 3120 #endif 3121 #ifdef USE_SHEEN_ROUGHNESSMAP 3122 uniform sampler2D sheenRoughnessMap; 3123 #endif 3124#endif 3125#ifdef USE_ANISOTROPY 3126 uniform vec2 anisotropyVector; 3127 #ifdef USE_ANISOTROPYMAP 3128 uniform sampler2D anisotropyMap; 3129 #endif 3130#endif 3131varying vec3 vViewPosition; 3132#include <common> 3133#include <packing> 3134#include <dithering_pars_fragment> 3135#include <color_pars_fragment> 3136#include <uv_pars_fragment> 3137#include <map_pars_fragment> 3138#include <alphamap_pars_fragment> 3139#include <alphatest_pars_fragment> 3140#include <alphahash_pars_fragment> 3141#include <aomap_pars_fragment> 3142#include <lightmap_pars_fragment> 3143#include <emissivemap_pars_fragment> 3144#include <iridescence_fragment> 3145#include <cube_uv_reflection_fragment> 3146#include <envmap_common_pars_fragment> 3147#include <envmap_physical_pars_fragment> 3148#include <fog_pars_fragment> 3149#include <lights_pars_begin> 3150#include <normal_pars_fragment> 3151#include <lights_physical_pars_fragment> 3152#include <transmission_pars_fragment> 3153#include <shadowmap_pars_fragment> 3154#include <bumpmap_pars_fragment> 3155#include <normalmap_pars_fragment> 3156#include <clearcoat_pars_fragment> 3157#include <iridescence_pars_fragment> 3158#include <roughnessmap_pars_fragment> 3159#include <metalnessmap_pars_fragment> 3160#include <logdepthbuf_pars_fragment> 3161#include <clipping_planes_pars_fragment> 3162void main() { 3163 #include <clipping_planes_fragment> 3164 vec4 diffuseColor = vec4( diffuse, opacity ); 3165 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3166 vec3 totalEmissiveRadiance = emissive; 3167 #include <logdepthbuf_fragment> 3168 #include <map_fragment> 3169 #include <color_fragment> 3170 #include <alphamap_fragment> 3171 #include <alphatest_fragment> 3172 #include <alphahash_fragment> 3173 #include <roughnessmap_fragment> 3174 #include <metalnessmap_fragment> 3175 #include <normal_fragment_begin> 3176 #include <normal_fragment_maps> 3177 #include <clearcoat_normal_fragment_begin> 3178 #include <clearcoat_normal_fragment_maps> 3179 #include <emissivemap_fragment> 3180 #include <lights_physical_fragment> 3181 #include <lights_fragment_begin> 3182 #include <lights_fragment_maps> 3183 #include <lights_fragment_end> 3184 #include <aomap_fragment> 3185 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3186 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3187 #include <transmission_fragment> 3188 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3189 #ifdef USE_SHEEN 3190 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3191 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3192 #endif 3193 #ifdef USE_CLEARCOAT 3194 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3195 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3196 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3197 #endif 3198 #include <opaque_fragment> 3199 #include <tonemapping_fragment> 3200 #include <colorspace_fragment> 3201 #include <fog_fragment> 3202 #include <premultiplied_alpha_fragment> 3203 #include <dithering_fragment> 3204}`,Pf=`#define TOON 3205varying vec3 vViewPosition; 3206#include <common> 3207#include <batching_pars_vertex> 3208#include <uv_pars_vertex> 3209#include <displacementmap_pars_vertex> 3210#include <color_pars_vertex> 3211#include <fog_pars_vertex> 3212#include <normal_pars_vertex> 3213#include <morphtarget_pars_vertex> 3214#include <skinning_pars_vertex> 3215#include <shadowmap_pars_vertex> 3216#include <logdepthbuf_pars_vertex> 3217#include <clipping_planes_pars_vertex> 3218void main() { 3219 #include <uv_vertex> 3220 #include <color_vertex> 3221 #include <morphcolor_vertex> 3222 #include <batching_vertex> 3223 #include <beginnormal_vertex> 3224 #include <morphnormal_vertex> 3225 #include <skinbase_vertex> 3226 #include <skinnormal_vertex> 3227 #include <defaultnormal_vertex> 3228 #include <normal_vertex> 3229 #include <begin_vertex> 3230 #include <morphtarget_vertex> 3231 #include <skinning_vertex> 3232 #include <displacementmap_vertex> 3233 #include <project_vertex> 3234 #include <logdepthbuf_vertex> 3235 #include <clipping_planes_vertex> 3236 vViewPosition = - mvPosition.xyz; 3237 #include <worldpos_vertex> 3238 #include <shadowmap_vertex> 3239 #include <fog_vertex> 3240}`,If=`#define TOON 3241uniform vec3 diffuse; 3242uniform vec3 emissive; 3243uniform float opacity; 3244#include <common> 3245#include <packing> 3246#include <dithering_pars_fragment> 3247#include <color_pars_fragment> 3248#include <uv_pars_fragment> 3249#include <map_pars_fragment> 3250#include <alphamap_pars_fragment> 3251#include <alphatest_pars_fragment> 3252#include <alphahash_pars_fragment> 3253#include <aomap_pars_fragment> 3254#include <lightmap_pars_fragment> 3255#include <emissivemap_pars_fragment> 3256#include <gradientmap_pars_fragment> 3257#include <fog_pars_fragment> 3258#include <bsdfs> 3259#include <lights_pars_begin> 3260#include <normal_pars_fragment> 3261#include <lights_toon_pars_fragment> 3262#include <shadowmap_pars_fragment> 3263#include <bumpmap_pars_fragment> 3264#include <normalmap_pars_fragment> 3265#include <logdepthbuf_pars_fragment> 3266#include <clipping_planes_pars_fragment> 3267void main() { 3268 #include <clipping_planes_fragment> 3269 vec4 diffuseColor = vec4( diffuse, opacity ); 3270 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3271 vec3 totalEmissiveRadiance = emissive; 3272 #include <logdepthbuf_fragment> 3273 #include <map_fragment> 3274 #include <color_fragment> 3275 #include <alphamap_fragment> 3276 #include <alphatest_fragment> 3277 #include <alphahash_fragment> 3278 #include <normal_fragment_begin> 3279 #include <normal_fragment_maps> 3280 #include <emissivemap_fragment> 3281 #include <lights_toon_fragment> 3282 #include <lights_fragment_begin> 3283 #include <lights_fragment_maps> 3284 #include <lights_fragment_end> 3285 #include <aomap_fragment> 3286 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3287 #include <opaque_fragment> 3288 #include <tonemapping_fragment> 3289 #include <colorspace_fragment> 3290 #include <fog_fragment> 3291 #include <premultiplied_alpha_fragment> 3292 #include <dithering_fragment> 3293}`,Df=`uniform float size; 3294uniform float scale; 3295#include <common> 3296#include <color_pars_vertex> 3297#include <fog_pars_vertex> 3298#include <morphtarget_pars_vertex> 3299#include <logdepthbuf_pars_vertex> 3300#include <clipping_planes_pars_vertex> 3301#ifdef USE_POINTS_UV 3302 varying vec2 vUv; 3303 uniform mat3 uvTransform; 3304#endif 3305void main() { 3306 #ifdef USE_POINTS_UV 3307 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3308 #endif 3309 #include <color_vertex> 3310 #include <morphcolor_vertex> 3311 #include <begin_vertex> 3312 #include <morphtarget_vertex> 3313 #include <project_vertex> 3314 gl_PointSize = size; 3315 #ifdef USE_SIZEATTENUATION 3316 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3317 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3318 #endif 3319 #include <logdepthbuf_vertex> 3320 #include <clipping_planes_vertex> 3321 #include <worldpos_vertex> 3322 #include <fog_vertex> 3323}`,Uf=`uniform vec3 diffuse; 3324uniform float opacity; 3325#include <common> 3326#include <color_pars_fragment> 3327#include <map_particle_pars_fragment> 3328#include <alphatest_pars_fragment> 3329#include <alphahash_pars_fragment> 3330#include <fog_pars_fragment> 3331#include <logdepthbuf_pars_fragment> 3332#include <clipping_planes_pars_fragment> 3333void main() { 3334 #include <clipping_planes_fragment> 3335 vec3 outgoingLight = vec3( 0.0 ); 3336 vec4 diffuseColor = vec4( diffuse, opacity ); 3337 #include <logdepthbuf_fragment> 3338 #include <map_particle_fragment> 3339 #include <color_fragment> 3340 #include <alphatest_fragment> 3341 #include <alphahash_fragment> 3342 outgoingLight = diffuseColor.rgb; 3343 #include <opaque_fragment> 3344 #include <tonemapping_fragment> 3345 #include <colorspace_fragment> 3346 #include <fog_fragment> 3347 #include <premultiplied_alpha_fragment> 3348}`,Nf=`#include <common> 3349#include <batching_pars_vertex> 3350#include <fog_pars_vertex> 3351#include <morphtarget_pars_vertex> 3352#include <skinning_pars_vertex> 3353#include <logdepthbuf_pars_vertex> 3354#include <shadowmap_pars_vertex> 3355void main() { 3356 #include <batching_vertex> 3357 #include <beginnormal_vertex> 3358 #include <morphnormal_vertex> 3359 #include <skinbase_vertex> 3360 #include <skinnormal_vertex> 3361 #include <defaultnormal_vertex> 3362 #include <begin_vertex> 3363 #include <morphtarget_vertex> 3364 #include <skinning_vertex> 3365 #include <project_vertex> 3366 #include <logdepthbuf_vertex> 3367 #include <worldpos_vertex> 3368 #include <shadowmap_vertex> 3369 #include <fog_vertex> 3370}`,Ff=`uniform vec3 color; 3371uniform float opacity; 3372#include <common> 3373#include <packing> 3374#include <fog_pars_fragment> 3375#include <bsdfs> 3376#include <lights_pars_begin> 3377#include <logdepthbuf_pars_fragment> 3378#include <shadowmap_pars_fragment> 3379#include <shadowmask_pars_fragment> 3380void main() { 3381 #include <logdepthbuf_fragment> 3382 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3383 #include <tonemapping_fragment> 3384 #include <colorspace_fragment> 3385 #include <fog_fragment> 3386}`,Of=`uniform float rotation; 3387uniform vec2 center; 3388#include <common> 3389#include <uv_pars_vertex> 3390#include <fog_pars_vertex> 3391#include <logdepthbuf_pars_vertex> 3392#include <clipping_planes_pars_vertex> 3393void main() { 3394 #include <uv_vertex> 3395 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3396 vec2 scale; 3397 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3398 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3399 #ifndef USE_SIZEATTENUATION 3400 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3401 if ( isPerspective ) scale *= - mvPosition.z; 3402 #endif 3403 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3404 vec2 rotatedPosition; 3405 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3406 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3407 mvPosition.xy += rotatedPosition; 3408 gl_Position = projectionMatrix * mvPosition; 3409 #include <logdepthbuf_vertex> 3410 #include <clipping_planes_vertex> 3411 #include <fog_vertex> 3412}`,Bf=`uniform vec3 diffuse; 3413uniform float opacity; 3414#include <common> 3415#include <uv_pars_fragment> 3416#include <map_pars_fragment> 3417#include <alphamap_pars_fragment> 3418#include <alphatest_pars_fragment> 3419#include <alphahash_pars_fragment> 3420#include <fog_pars_fragment> 3421#include <logdepthbuf_pars_fragment> 3422#include <clipping_planes_pars_fragment> 3423void main() { 3424 #include <clipping_planes_fragment> 3425 vec3 outgoingLight = vec3( 0.0 ); 3426 vec4 diffuseColor = vec4( diffuse, opacity ); 3427 #include <logdepthbuf_fragment> 3428 #include <map_fragment> 3429 #include <alphamap_fragment> 3430 #include <alphatest_fragment> 3431 #include <alphahash_fragment> 3432 outgoingLight = diffuseColor.rgb; 3433 #include <opaque_fragment> 3434 #include <tonemapping_fragment> 3435 #include <colorspace_fragment> 3436 #include <fog_fragment> 3437}`,Ie={alphahash_fragment:ru,alphahash_pars_fragment:au,alphamap_fragment:ou,alphamap_pars_fragment:cu,alphatest_fragment:lu,alphatest_pars_fragment:hu,aomap_fragment:uu,aomap_pars_fragment:du,batching_pars_vertex:fu,batching_vertex:pu,begin_vertex:mu,beginnormal_vertex:gu,bsdfs:_u,iridescence_fragment:xu,bumpmap_pars_fragment:vu,clipping_planes_fragment:Mu,clipping_planes_pars_fragment:Su,clipping_planes_pars_vertex:yu,clipping_planes_vertex:Eu,color_fragment:Tu,color_pars_fragment:Au,color_pars_vertex:bu,color_vertex:wu,common:Ru,cube_uv_reflection_fragment:Cu,defaultnormal_vertex:Lu,dis
vendor: 6,723 bytes, line 3437
3437placementmap_pars_vertex:Pu,displacementmap_vertex:Iu,emissivemap_fragment:Du,emissivemap_pars_fragment:Uu,colorspace_fragment:Nu,colorspace_pars_fragment:Fu,envmap_fragment:Ou,envmap_common_pars_fragment:Bu,envmap_pars_fragment:Hu,envmap_pars_vertex:zu,envmap_physical_pars_fragment:Ju,envmap_vertex:Gu,fog_vertex:ku,fog_pars_vertex:Vu,fog_fragment:Wu,fog_pars_fragment:Xu,gradientmap_pars_fragment:qu,lightmap_fragment:Yu,lightmap_pars_fragment:ju,lights_lambert_fragment:Ku,lights_lambert_pars_fragment:Zu,lights_pars_begin:$u,lights_toon_fragment:Qu,lights_toon_pars_fragment:ed,lights_phong_fragment:td,lights_phong_pars_fragment:nd,lights_physical_fragment:id,lights_physical_pars_fragment:sd,lights_fragment_begin:rd,lights_fragment_maps:ad,lights_fragment_end:od,logdepthbuf_fragment:cd,logdepthbuf_pars_fragment:ld,logdepthbuf_pars_vertex:hd,logdepthbuf_vertex:ud,map_fragment:dd,map_pars_fragment:fd,map_particle_fragment:pd,map_particle_pars_fragment:md,metalnessmap_fragment:gd,metalnessmap_pars_fragment:_d,morphcolor_vertex:xd,morphnormal_vertex:vd,morphtarget_pars_vertex:Md,morphtarget_vertex:Sd,normal_fragment_begin:yd,normal_fragment_maps:Ed,normal_pars_fragment:Td,normal_pars_vertex:Ad,normal_vertex:bd,normalmap_pars_fragment:wd,clearcoat_normal_fragment_begin:Rd,clearcoat_normal_fragment_maps:Cd,clearcoat_pars_fragment:Ld,iridescence_pars_fragment:Pd,opaque_fragment:Id,packing:Dd,premultiplied_alpha_fragment:Ud,project_vertex:Nd,dithering_fragment:Fd,dithering_pars_fragment:Od,roughnessmap_fragment:Bd,roughnessmap_pars_fragment:Hd,shadowmap_pars_fragment:zd,shadowmap_pars_vertex:Gd,shadowmap_vertex:kd,shadowmask_pars_fragment:Vd,skinbase_vertex:Wd,skinning_pars_vertex:Xd,skinning_vertex:qd,skinnormal_vertex:Yd,specularmap_fragment:jd,specularmap_pars_fragment:Kd,tonemapping_fragment:Zd,tonemapping_pars_fragment:$d,transmission_fragment:Jd,transmission_pars_fragment:Qd,uv_pars_fragment:ef,uv_pars_vertex:tf,uv_vertex:nf,worldpos_vertex:sf,background_vert:rf,background_frag:af,backgroundCube_vert:of,backgroundCube_frag:cf,cube_vert:lf,cube_frag:hf,depth_vert:uf,depth_frag:df,distanceRGBA_vert:ff,distanceRGBA_frag:pf,equirect_vert:mf,equirect_frag:gf,linedashed_vert:_f,linedashed_frag:xf,meshbasic_vert:vf,meshbasic_frag:Mf,meshlambert_vert:Sf,meshlambert_frag:yf,meshmatcap_vert:Ef,meshmatcap_frag:Tf,meshnormal_vert:Af,meshnormal_frag:bf,meshphong_vert:wf,meshphong_frag:Rf,meshphysical_vert:Cf,meshphysical_frag:Lf,meshtoon_vert:Pf,meshtoon_frag:If,points_vert:Df,points_frag:Uf,shadow_vert:Nf,shadow_frag:Ff,sprite_vert:Of,sprite_frag:Bf},re={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oe}},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 Oe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oe},normalScale:{value:new ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(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 Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0},uvTransform:{value:new Oe}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oe},alphaMap:{value:null},alphaMapTransform:{value:new Oe},alphaTest:{value:0}}},qt={basic:{uniforms:Tt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.fog]),vertexShader:Ie.meshbasic_vert,fragmentShader:Ie.meshbasic_frag},lambert:{uniforms:Tt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ie.meshlambert_vert,fragmentShader:Ie.meshlambert_frag},phong:{uniforms:Tt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30}}]),vertexShader:Ie.meshphong_vert,fragmentShader:Ie.meshphong_frag},standard:{uniforms:Tt([re.common,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.roughnessmap,re.metalnessmap,re.fog,re.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ie.meshphysical_vert,fragmentShader:Ie.meshphysical_frag},toon:{uniforms:Tt([re.common,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.gradientmap,re.fog,re.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ie.meshtoon_vert,fragmentShader:Ie.meshtoon_frag},matcap:{uniforms:Tt([re.common,re.bumpmap,re.normalmap,re.displacementmap,re.fog,{matc
vendor: 4,821 bytes, line 3437
3437ap:{value:null}}]),vertexShader:Ie.meshmatcap_vert,fragmentShader:Ie.meshmatcap_frag},points:{uniforms:Tt([re.points,re.fog]),vertexShader:Ie.points_vert,fragmentShader:Ie.points_frag},dashed:{uniforms:Tt([re.common,re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ie.linedashed_vert,fragmentShader:Ie.linedashed_frag},depth:{uniforms:Tt([re.common,re.displacementmap]),vertexShader:Ie.depth_vert,fragmentShader:Ie.depth_frag},normal:{uniforms:Tt([re.common,re.bumpmap,re.normalmap,re.displacementmap,{opacity:{value:1}}]),vertexShader:Ie.meshnormal_vert,fragmentShader:Ie.meshnormal_frag},sprite:{uniforms:Tt([re.sprite,re.fog]),vertexShader:Ie.sprite_vert,fragmentShader:Ie.sprite_frag},background:{uniforms:{uvTransform:{value:new Oe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ie.background_vert,fragmentShader:Ie.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ie.backgroundCube_vert,fragmentShader:Ie.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ie.cube_vert,fragmentShader:Ie.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ie.equirect_vert,fragmentShader:Ie.equirect_frag},distanceRGBA:{uniforms:Tt([re.common,re.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ie.distanceRGBA_vert,fragmentShader:Ie.distanceRGBA_frag},shadow:{uniforms:Tt([re.lights,re.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:Ie.shadow_vert,fragmentShader:Ie.shadow_frag}};qt.physical={uniforms:Tt([qt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oe},clearcoatNormalScale:{value:new ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oe},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oe},transmissionSamplerSize:{value:new ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oe},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oe},anisotropyVector:{value:new ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oe}}]),vertexShader:Ie.meshphysical_vert,fragmentShader:Ie.meshphysical_frag};const Ms={r:0,b:0,g:0};function Hf(s,e,t,n,i,r,a){const o=new Ae(0);let c=r===!0?0:1,l,h,u=null,d=0,p=null;function g(m,f){let E=!1,x=f.isScene===!0?f.background:null;x&&x.isTexture&&(x=(f.backgroundBlurriness>0?t:e).get(x)),x===null?_(o,c):x&&x.isColor&&(_(x,1),E=!0);const T=s.xr.getEnvironmentBlendMode();T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||E)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Bs)?(h===void 0&&(h=new Bt(new Ki(1,1,1),new Wn({name:"BackgroundCubeMaterial",uniforms:Ei(qt.backgroundCube.uniforms),vertexShader:qt.backgroundCube.vertexShader,fragmentShader:qt.backgroundCube.fragmentShader,side:Rt,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(A,w,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,h.material.toneMapped=qe.getTransfer(x.colorSpace)!==Je,(u!==x||d!==x.version||p!==s.toneMapping)&&(h.material.needsUpdate=!0,u=x,d=x.version,p=s.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(l===void 0&&(l=new Bt(new na(2,2),new Wn({name:"Backgroun
3437dMaterial",uniforms:Ei(qt.background.uniforms),vertexShader:qt.background.vertexShader,fragmentShader:qt.background.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=x,l.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,l.material.toneMapped=qe.getTransfer(x.colorSpace)!==Je,x.matrixAutoUpdate===!0&&x.updateMatrix(),l.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||p!==s.toneMapping)&&(l.material.needsUpdate=!0,u=x,d=x.version,p=s.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function _(m,f){m.getRGB(Ms,Ic(s)),n.buffers.color.setClear(Ms.r,Ms.g,Ms.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),c=f,_(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(m){c=m,_(o,c)},render:g}}function zf(s,e,t,n){const i=s.getParameter(s.MAX_VERTEX_ATTRIBS),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||r!==null,o={},c=m(null);let l=c,h=!1;function u(P,H,q,V,ne){let W=!1;if(a){const j=_(V,q,H);l!==j&&(l=j,p(l.object)),W=f(P,V,q,ne),W&&E(P,V,q,ne)}else{const j=H.wireframe===!0;(l.geometry!==V.id||l.program!==q.id||l.wireframe!==j)&&(l.geometry=V.id,l.program=q.id,l.wireframe=j,W=!0)}ne!==null&&t.update(ne,s.ELEMENT_ARRAY_BUFFER),(W||h)&&(h=!1,B(P,H,q,V),ne!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t.get(ne).buffer))}function d(){return n.isWebGL2?s.createVertexArray():r.createVertexArrayOES()}function p(P){return n.isWebGL2?s.bindVertexArray(P):r.bindVertexArrayOES(P)}function g(P){return n.isWebGL2?s.deleteVertexArray(P):r.deleteVertexArrayOES(P)}function _(P,H,q){const V=q.wireframe===!0;let ne=o[P.id];ne===void 0&&(ne={},o[P.id]=ne);let W=ne[H.id];W===void 0&&(W={},ne[H.id]=W);let j=W[V];return j===void 0&&(j=m(d()),W[V]=j),j}function m(P){const H=[],q=[],V=[];for(let ne=0;ne<i;ne++)H[ne]=0,q[ne]=0,V[ne]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:q,attributeDivisors:V,object:P,attributes:{},index:null}}function f(P,H,q,V){const ne=l.attributes,W=H.attributes;let j=0;const Q=q.getAttributes();for(const ue in Q)if(Q[ue].location>=0){const Y=ne[ue];let ae=W[ue];if(ae===void 0&&(ue==="instanceMatrix"&&P.instanceMatrix&&(ae=P.instanceMatrix),ue==="instanceColor"&&P.instanceColor&&(ae=P.instanceColor)),Y===void 0||Y.attribute!==ae||ae&&Y.data!==ae.data)return!0;j++}return l.attributesNum!==j||l.index!==V}function E(P,H,q,V){const ne={},W=H.attributes;let j=0;const Q=q.getAttributes();for(const ue in Q)if(Q[ue].location>=0){let Y=W[ue];Y===void 0&&(ue==="instanceMatrix"&&P.instanceMatrix&&(Y=P.instanceMatrix),ue==="instanceColor"&&P.instanceColor&&(Y=P.instanceColor));const ae={};ae.attribute=Y,Y&&Y.data&&(ae.data=Y.data),ne[ue]=ae,j++}l.attributes=ne,l.attributesNum=j,l.index=V}function x(){const P=l.newAttributes;for(let H=0,q=P.length;H<q;H++)P[H]=0}function T(P){A(P,0)}function A(P,H){const q=l.newAttributes,V=l.enabledAttributes,ne=l.attributeDivisors;q[P]=1,V[P]===0&&(s.enableVertexAttribArray(P),V[P]=1),ne[P]!==H&&((n.isWebGL2?s:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](P,H),ne[P]=H)}function w(){const P=l.newAttributes,H=l.enabledAttributes;for(let q=0,V=H.length;q<V;q++)H[q]!==P[q]&&(s.disableVertexAttribArray(q),H[q]=0)}function C(P,H,q,V,ne,W,j){j===!0?s.vertexAttribIPointer(P,H,q,ne,W):s.vertexAttribPointer(P,H,q,V,ne,W)}function B(P,H,q,V){if(n.isWebGL2===!1&&(P.isInstancedMesh||V.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;x();const ne=V.attributes,W=q.getAttributes(),j=H.defaultAttributeValues;for(const Q in W){const ue=W[Q];if(ue.location>=0){let z=ne[Q];if(z===void 0&&(Q==="instanceMatrix"&&P.instanceMatrix&&(z=P.instanceMatrix),Q==="instanceColor"&&P.instanceColor&&(z=P.instanceColor)),z!==void 0){const Y=z.normalized,ae=z.itemSize,pe=t.get(z);if(pe===void 0)continue;
3437const me=pe.buffer,Pe=pe.type,be=pe.bytesPerElement,Te=n.isWebGL2===!0&&(Pe===s.INT||Pe===s.UNSIGNED_INT||z.gpuType===fc);if(z.isInterleavedBufferAttribute){const De=z.data,D=De.stride,Mt=z.offset;if(De.isInstancedInterleavedBuffer){for(let ge=0;ge<ue.locationSize;ge++)A(ue.location+ge,De.meshPerAttribute);P.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=De.meshPerAttribute*De.count)}else for(let ge=0;ge<ue.locationSize;ge++)T(ue.location+ge);s.bindBuffer(s.ARRAY_BUFFER,me);for(let ge=0;ge<ue.locationSize;ge++)C(ue.location+ge,ae/ue.locationSize,Pe,Y,D*be,(Mt+ae/ue.locationSize*ge)*be,Te)}else{if(z.isInstancedBufferAttribute){for(let De=0;De<ue.locationSize;De++)A(ue.location+De,z.meshPerAttribute);P.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=z.meshPerAttribute*z.count)}else for(let De=0;De<ue.locationSize;De++)T(ue.location+De);s.bindBuffer(s.ARRAY_BUFFER,me);for(let De=0;De<ue.locationSize;De++)C(ue.location+De,ae/ue.locationSize,Pe,Y,ae*be,ae/ue.locationSize*De*be,Te)}}else if(j!==void 0){const Y=j[Q];if(Y!==void 0)switch(Y.length){case 2:s.vertexAttrib2fv(ue.location,Y);break;case 3:s.vertexAttrib3fv(ue.location,Y);break;case 4:s.vertexAttrib4fv(ue.location,Y);break;default:s.vertexAttrib1fv(ue.location,Y)}}}}w()}function M(){X();for(const P in o){const H=o[P];for(const q in H){const V=H[q];for(const ne in V)g(V[ne].object),delete V[ne];delete H[q]}delete o[P]}}function b(P){if(o[P.id]===void 0)return;const H=o[P.id];for(const q in H){const V=H[q];for(const ne in V)g(V[ne].object),delete V[ne];delete H[q]}delete o[P.id]}function k(P){for(const H in o){const q=o[H];if(q[P.id]===void 0)continue;const V=q[P.id];for(const ne in V)g(V[ne].object),delete V[ne];delete q[P.id]}}function X(){J(),h=!0,l!==c&&(l=c,p(l.object))}function J(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:u,reset:X,resetDefaultState:J,dispose:M,releaseStatesOfGeometry:b,releaseStatesOfProgram:k,initAttributes:x,enableAttribute:T,disableUnusedAttributes:w}}function Gf(s,e,t,n){const i=n.isWebGL2;let r;function a(h){r=h}function o(h,u){s.drawArrays(r,h,u),t.update(u,r,1)}function c(h,u,d){if(d===0)return;let p,g;if(i)p=s,g="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),g="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[g](r,h,u,d),t.update(u,r,d)}function l(h,u,d){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<d;g++)this.render(h[g],u[g]);else{p.multiDrawArraysWEBGL(r,h,0,u,0,d);let g=0;for(let _=0;_<d;_++)g+=u[_];t.update(g,r,1)}}this.setMode=a,this.render=o,this.renderInstances=c,this.renderMultiDraw=l}function kf(s,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");n=s.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function r(C){if(C==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&s.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const c=r(o);c!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",c,"instead."),o=c);const l=a||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),d=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_TEXTURE_SIZE),g=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),_=s.getParameter(s.MAX_VERTEX_ATTRIBS),m=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),f=s.getParameter(s.MAX_VARYING_VECTORS),E=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,T=a||e.has("OES_texture_float"),A=x&&T,w=a?s.getParameter(s.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:E,vertexTextures:x,floatFragmentTextures:T,floatVertexTextures:A,maxSamples:w}}function Vf(s){const e=this;let t=null,n=0,i=!1,r=!1;const a=new Dn,o=new Oe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const p=u.length!==0||d||n!==0||i;return i=d,n=u.length,p},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,p){const g=u.clippingPlanes,_=u.clipIntersection,m=u.clipSh
vendor: 11,445 bytes, lines 3437-3512
3437adows,f=s.get(u);if(!i||g===null||g.length===0||r&&!m)r?h(null):l();else{const E=r?0:n,x=E*4;let T=f.clippingState||null;c.value=T,T=h(g,d,x,p);for(let A=0;A!==x;++A)T[A]=t[A];f.clippingState=T,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,p,g){const _=u!==null?u.length:0;let m=null;if(_!==0){if(m=c.value,g!==!0||m===null){const f=p+_*4,E=d.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<f)&&(m=new Float32Array(f));for(let x=0,T=p;x!==_;++x,T+=4)a.copy(u[x]).applyMatrix4(E,o),a.normal.toArray(m,T),m[T+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Wf(s){let e=new WeakMap;function t(a,o){return o===Fr?a.mapping=_i:o===Or&&(a.mapping=xi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Fr||o===Or)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new tu(c.height/2);return l.fromEquirectangularTexture(s,a),e.set(a,l),a.addEventListener("dispose",i),t(l.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}class ia extends Dc{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=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=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const fi=4,_o=[.125,.215,.35,.446,.526,.582],Fn=20,Mr=new ia,xo=new Ae;let Sr=null,yr=0,Er=0;const Un=(1+Math.sqrt(5))/2,ci=1/Un,vo=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,Un,ci),new L(0,Un,-ci),new L(ci,0,Un),new L(-ci,0,Un),new L(Un,ci,0),new L(-Un,ci,0)];class Mo{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,i=100){Sr=this._renderer.getRenderTarget(),yr=this._renderer.getActiveCubeFace(),Er=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Eo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yo(),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(Sr,yr,Er),e.scissorTest=!1,Ss(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===_i||e.mapping===xi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Sr=this._renderer.getRenderTarget(),yr=this._renderer.getActiveCubeFace(),Er=this._renderer.getActiveMipmapLevel();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:wt,minFilter:wt,generateMipmaps:!1,type:qi,format:Ft,colorSpace:mt,depthBuffer:!1},i=So(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=So(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Xf(r)),this._blurMaterial=qf(r,e,t)}return i}_compileMaterial(e){const t=new Bt(this._lodPlanes[0],e);this._renderer.compile(t,Mr)}_sceneToCubeUV(e,t,n,i){const o=new At(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,d=h.toneMapping;h.getClearColor(xo),h.toneMapping=En,h.autoClear=!1;const p=new On({name:"PMREM.Background",side:Rt,depthWrite:!1,depthTest:!1}),g=new Bt(new Ki,p);let _=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,_=!0):(p.color.copy(xo),_=!0);for(let f=0;f<6;f++){const E=f%3;E===0?(o.up.set(0,c[f],0),o.lookAt(l[f],0,0)):E===1?(o.up.set(0,0,c[f]),o.lookAt(0,l[f],0)):(o.up.set(0,c[f],0),o.lookAt(0,0,l[f]));const x=this._cubeSize;Ss(i,E*x,f>2?x:0,x,x),h.setRenderTarget(i),_&&h.render(g,o),h.render(e,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=d,h.autoClear=u,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===_i||e.mapping===xi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Eo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yo());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Bt(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;Ss(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Mr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=vo[(i-1)%vo.length];this._blur(e,i-1,i,r,a)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Bt(this._lodPlanes[i],l),d=l.uniforms,p=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*Fn-1),_=r/g,m=isFinite(r)?1+Math.floor(h*_):Fn;m>Fn&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Fn}`);const f=[];let E=0;for(let C=0;C<Fn;++C){const B=C/_,M=Math.exp(-B*B/2);f.push(M),C===0?E+=M:C<m&&(E+=2*M)}for(let C=0;C<f.length;C++)f[C]=f[C]/E;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=g,d.mipInt.value=x-n;const T=this._sizeLods[i],A=3*T*(i>x-fi?i-x+fi:0),w=4*(this._cubeSize-T);Ss(t,A,w,3*T,2*T),c.setRenderTarget(t),c.render(u,Mr)}}function Xf(s){const e=[],t=[],n=[];let i=s;const r=s-fi+1+_o.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);t.push(o);let c=1/o;a>s-fi?c=_o[a-s+fi-1]:a===0&&(c=0),n.push(c);const l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],p=6,g=6,_=3,m=2,f=1,E=new Float32Array(_*g*p),x=new Float32Array(m*g*p),T=new Float32Array(f*g*p);for(let w=0;w<p;w++){const C=w%3*2/3-1,B=w>2?0:-1,M=[C,B,0,C+2/3,B,0,C+2/3,B+1,0,C,B,0,C+2/3,B+1,0,C,B+1,0];E.set(M,_*g*w),x.set(d,m*g*w);const b=[w,w,w,w,w,w];T.set(b,f*g*w)}const A=new $t;A.setAttribute("position",new bt(E,_)),A.setAttribute("uv",new bt(x,m)),A.setAttribute("faceIndex",new bt(T,f)),e.push(A),i>fi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function So(s,e,t){const n=new Vn(s,e,t);return n.texture.mapping=Bs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ss(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function qf(s,e,t){const n=new Float32Array(Fn),i=new L(0,1,0);return new Wn({name:"SphericalGaussianBlur",defines:{n:Fn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:sa(),fragmentShader:` 3438 3439 precision mediump float; 3440 precision mediump int; 3441 3442 varying vec3 vOutputDirection; 3443 3444 uniform sampler2D envMap; 3445 uniform int samples; 3446 uniform float weights[ n ]; 3447 uniform bool latitudinal; 3448 uniform float dTheta; 3449 uniform float mipInt; 3450 uniform vec3 poleAxis; 3451 3452 #define ENVMAP_TYPE_CUBE_UV 3453 #include <cube_uv_reflection_fragment> 3454 3455 vec3 getSample( float theta, vec3 axis ) { 3456 3457 float cosTheta = cos( theta ); 3458 // Rodrigues' axis-angle rotation 3459 vec3 sampleDirection = vOutputDirection * cosTheta 3460 + cross( axis, vOutputDirection ) * sin( theta ) 3461 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3462 3463 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3464 3465 } 3466 3467 void main() { 3468 3469 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3470 3471 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3472 3473 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3474 3475 } 3476 3477 axis = normalize( axis ); 3478 3479 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3480 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3481 3482 for ( int i = 1; i < n; i++ ) { 3483 3484 if ( i >= samples ) { 3485 3486 break; 3487 3488 } 3489 3490 float theta = dTheta * float( i ); 3491 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3492 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3493 3494 } 3495 3496 } 3497 `,blending:yn,depthTest:!1,depthWrite:!1})}function yo(){return new Wn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:sa(),fragmentShader:` 3498 3499 precision mediump float; 3500 precision mediump int; 3501 3502 varying vec3 vOutputDirection; 3503 3504 uniform sampler2D envMap; 3505 3506 #include <common> 3507 3508 void main() { 3509 3510 vec3 outputDirection = normalize( vOutputDirection ); 3511 vec2 uv = equirectUv( outputDirection ); 3512
3513 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3514 3515 } 3516 `,blending:yn,depthTest:!1,depthWrite:!1})}function Eo(){return new Wn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:sa(),fragmentShader:` 3517 3518 precision mediump float; 3519 precision mediump int; 3520 3521 uniform float flipEnvMap; 3522 3523 varying vec3 vOutputDirection; 3524 3525 uniform samplerCube envMap; 3526 3527 void main() { 3528 3529 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3530 3531 } 3532 `,blending:yn,depthTest:!1,depthWrite:!1})}function sa(){return` 3533 3534 precision mediump float; 3535 precision mediump int; 3536 3537 attribute float faceIndex; 3538 3539 varying vec3 vOutputDirection; 3540 3541 // RH coordinate system; PMREM face-indexing convention 3542 vec3 getDirection( vec2 uv, float face ) { 3543 3544 uv = 2.0 * uv - 1.0; 3545 3546 vec3 direction = vec3( uv, 1.0 ); 3547 3548 if ( face == 0.0 ) { 3549 3550 direction = direction.zyx; // ( 1, v, u ) pos x 3551 3552 } else if ( face == 1.0 ) { 3553 3554 direction = direction.xzy; 3555 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3556 3557 } else if ( face == 2.0 ) { 3558 3559 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3560 3561 } else if ( face == 3.0 ) { 3562 3563 direction = direction.zyx; 3564 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3565 3566 } else if ( face == 4.0 ) { 3567 3568 direction = direction.xzy; 3569 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3570 3571 } else if ( face == 5.0 ) { 3572 3573 direction.z *= -1.0; // ( u, v, -1 ) neg z 3574 3575 } 3576 3577 return direction; 3578 3579 } 3580 3581 void main() { 3582 3583 vOutputDirection = getDirection( uv, faceIndex ); 3584 gl_Position = vec4( position, 1.0 ); 3585 3586 } 3587 `}function Yf(s){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===Fr||c===Or,h=c===_i||c===xi;if(l||h)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=e.get(o);return t===null&&(t=new Mo(s)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),e.set(o,u),u.texture}else{if(e.has(o))return e.get(o).texture;{const u=o.image;if(l&&u&&u.height>0||h&&u&&i(u)){t===null&&(t=new Mo(s));const d=l?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",r),d.texture}else return null}}}return o}function i(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){const c=o.target;c.removeEventListener("dispose",r);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function jf(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Kf(s,e,t,n){const i={},r=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);for(const g in d.morphAttributes){const _=d.morphAttributes[g];for(let m=0,f=_.length;m<f;m++)e.remove(_[m])}d.removeEventListener("dispose",a),delete i[d.id];const p=r.get(d);p&&(e.remove(p),r.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(u){const d=u.attributes;for(const g in d)e.update(d[g],s.ARRAY_BUFFER);const p=u.morphAttributes;for(const g in p){const _=p[g];for(let m=0,f=_.length;m<f;m++)e.update(_[m],s.ARRAY_BUFFER)}}function l(u){const d=[],p=u.index,g=u.attributes.position;let _=0;if(p!==null){const E=p.array;_=p.version;for(let x=0,T=E.length;x<T;x+=3){const A=E[x+0],w=E[x+1],C=E[x+2];d.push(A,w,w,C,C,A)}}else if(g!==void 0){const E=g.array;_=g.version;for(let x=0,T=E.length/3-1;x<T;x+=3){const A=x+0,w=x+1,C=x+2;d.push(A,w,w,C,C,A)}}else return;const m=new(Tc(d)?Pc:Lc)(d,1);m.version=_;const f=r.get(u);f&&e.remove(f),r.set(u,m)}function h(u){const d=r.get(u);if(d){const p=u.index;p!==null&&d.version<p.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}
3587function Zf(s,e,t,n){const i=n.isWebGL2;let r;function a(p){r=p}let o,c;function l(p){o=p.type,c=p.bytesPerElement}function h(p,g){s.drawElements(r,g,o,p*c),t.update(g,r,1)}function u(p,g,_){if(_===0)return;let m,f;if(i)m=s,f="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),f="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[f](r,g,o,p*c,_),t.update(g,r,_)}function d(p,g,_){if(_===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<_;f++)this.render(p[f]/c,g[f]);else{m.multiDrawElementsWEBGL(r,g,0,o,p,0,_);let f=0;for(let E=0;E<_;E++)f+=g[E];t.update(f,r,1)}}this.setMode=a,this.setIndex=l,this.render=h,this.renderInstances=u,this.renderMultiDraw=d}function $f(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Jf(s,e){return s[0]-e[0]}function Qf(s,e){return Math.abs(e[1])-Math.abs(s[1])}function ep(s,e,t){const n={},i=new Float32Array(8),r=new WeakMap,a=new Ze,o=[];for(let l=0;l<8;l++)o[l]=[l,0];function c(l,h,u){const d=l.morphTargetInfluences;if(e.isWebGL2===!0){const p=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,g=p!==void 0?p.length:0;let _=r.get(h);if(_===void 0||_.count!==g){let P=function(){X.dispose(),r.delete(h),h.removeEventListener("dispose",P)};_!==void 0&&_.texture.dispose();const E=h.morphAttributes.position!==void 0,x=h.morphAttributes.normal!==void 0,T=h.morphAttributes.color!==void 0,A=h.morphAttributes.position||[],w=h.morphAttributes.normal||[],C=h.morphAttributes.color||[];let B=0;E===!0&&(B=1),x===!0&&(B=2),T===!0&&(B=3);let M=h.attributes.position.count*B,b=1;M>e.maxTextureSize&&(b=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const k=new Float32Array(M*b*4*g),X=new wc(k,M,b,g);X.type=cn,X.needsUpdate=!0;const J=B*4;for(let H=0;H<g;H++){const q=A[H],V=w[H],ne=C[H],W=M*b*4*H;for(let j=0;j<q.count;j++){const Q=j*J;E===!0&&(a.fromBufferAttribute(q,j),k[W+Q+0]=a.x,k[W+Q+1]=a.y,k[W+Q+2]=a.z,k[W+Q+3]=0),x===!0&&(a.fromBufferAttribute(V,j),k[W+Q+4]=a.x,k[W+Q+5]=a.y,k[W+Q+6]=a.z,k[W+Q+7]=0),T===!0&&(a.fromBufferAttribute(ne,j),k[W+Q+8]=a.x,k[W+Q+9]=a.y,k[W+Q+10]=a.z,k[W+Q+11]=ne.itemSize===4?a.w:1)}}_={count:g,texture:X,size:new ke(M,b)},r.set(h,_),h.addEventListener("dispose",P)}let m=0;for(let E=0;E<d.length;E++)m+=d[E];const f=h.morphTargetsRelative?1:1-m;u.getUniforms().setValue(s,"morphTargetBaseInfluence",f),u.getUniforms().setValue(s,"morphTargetInfluences",d),u.getUniforms().setValue(s,"morphTargetsTexture",_.texture,t),u.getUniforms().setValue(s,"morphTargetsTextureSize",_.size)}else{const p=d===void 0?0:d.length;let g=n[h.id];if(g===void 0||g.length!==p){g=[];for(let x=0;x<p;x++)g[x]=[x,0];n[h.id]=g}for(let x=0;x<p;x++){const T=g[x];T[0]=x,T[1]=d[x]}g.sort(Qf);for(let x=0;x<8;x++)x<p&&g[x][1]?(o[x][0]=g[x][0],o[x][1]=g[x][1]):(o[x][0]=Number.MAX_SAFE_INTEGER,o[x][1]=0);o.sort(Jf);const _=h.morphAttributes.position,m=h.morphAttributes.normal;let f=0;for(let x=0;x<8;x++){const T=o[x],A=T[0],w=T[1];A!==Number.MAX_SAFE_INTEGER&&w?(_&&h.getAttribute("morphTarget"+x)!==_[A]&&h.setAttribute("morphTarget"+x,_[A]),m&&h.getAttribute("morphNormal"+x)!==m[A]&&h.setAttribute("morphNormal"+x,m[A]),i[x]=w,f+=w):(_&&h.hasAttribute("morphTarget"+x)===!0&&h.deleteAttribute("morphTarget"+x),m&&h.hasAttribute("morphNormal"+x)===!0&&h.deleteAttribute("morphNormal"+x),i[x]=0)}const E=h.morphTargetsRelative?1:1-f;u.getUniforms().setValue(s,"morphTargetBaseInfluence",E),u.getUniforms().setValue(s,"morphTargetInfluences",i)}}return{update:c}}function tp(s,e,t,n){let i=new WeakMap;function r(c){const l=n.render.frame,h=c.geometry,u=e.get(c,h);if(i.get(u)!==l&&(e.update(u),i.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),i.get(c)!==l&&(t.update(c.instanceMatrix,s.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,s.ARRAY_BUFFER),i.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;i.get(d)!==l&&(d.update(),i.set(d,l))}return u}function a(){i=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:a}}class Fc extends pt{constructor(e,t,n,i,r,a,o,c,l,h){if(h=h!==void 0?h:zn,h!==zn&&h!==Mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===zn&&(n=Sn),n===void 0&&h===Mi&&(n=Hn),super(null,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:ut,this.minFilter=c!==void 0?c:ut,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const Oc=new pt,Bc=new Fc(1,1);Bc.compareFunction=Ec;const Hc=new wc,zc=new Bh,Gc=new Uc,To=[],Ao=[],bo=new Float32Array(16),wo=new Float32Array(9),Ro=new Float32Array(4);function wi(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=To[i];if(r===void 0&&(r=new Float32Array(i),To[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function at(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function ot(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ks(s,e){let t=Ao[e];t===void 0&&(t=new Int32Array(e),Ao[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function np(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function ip(s,e){const t=this.cache;
vendor: 14,105 bytes, lines 3587-3604
3587if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;s.uniform2fv(this.addr,e),ot(t,e)}}function sp(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;s.uniform3fv(this.addr,e),ot(t,e)}}function rp(s,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)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;s.uniform4fv(this.addr,e),ot(t,e)}}function ap(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Ro.set(n),s.uniformMatrix2fv(this.addr,!1,Ro),ot(t,n)}}function op(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;wo.set(n),s.uniformMatrix3fv(this.addr,!1,wo),ot(t,n)}}function cp(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;bo.set(n),s.uniformMatrix4fv(this.addr,!1,bo),ot(t,n)}}function lp(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function hp(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;s.uniform2iv(this.addr,e),ot(t,e)}}function up(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;s.uniform3iv(this.addr,e),ot(t,e)}}function dp(s,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)&&(s.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(at(t,e))return;s.uniform4iv(this.addr,e),ot(t,e)}}function fp(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function pp(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;s.uniform2uiv(this.addr,e),ot(t,e)}}function mp(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;s.uniform3uiv(this.addr,e),ot(t,e)}}function gp(s,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)&&(s.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(at(t,e))return;s.uniform4uiv(this.addr,e),ot(t,e)}}function _p(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);const r=this.type===s.SAMPLER_2D_SHADOW?Bc:Oc;t.setTexture2D(e||r,i)}function xp(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||zc,i)}function vp(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Gc,i)}function Mp(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Hc,i)}function Sp(s){switch(s){case 5126:return np;case 35664:return ip;case 35665:return sp;case 35666:return rp;case 35674:return ap;case 35675:return op;case 35676:return cp;case 5124:case 35670:return lp;case 35667:case 35671:return hp;case 35668:case 35672:return up;case 35669:case 35673:return dp;case 5125:return fp;case 36294:return pp;case 36295:return mp;case 36296:return gp;case 35678:case 36198:case 36298:case 36306:case 35682:return _p;case 35679:case 36299:case 36307:return xp;case 35680:case 36300:case 36308:case 36293:return vp;case 36289:case 36303:case 36311:case 36292:return Mp}}function yp(s,e){s.uniform1fv(this.addr,e)}function Ep(s,e){const t=wi(e,this.size,2);s.uniform2fv(this.addr,t)}function Tp(s,e){const t=wi(e,this.size,3);s.uniform3fv(this.addr,t)}function Ap(s,e){const t=wi(e,this.size,4);s.uniform4fv(this.addr,t)}function bp(s,e){const t=wi(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function wp(s,e){const t=wi(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function Rp(s,e){const t=wi(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function Cp(s,e){s.uniform1iv(this.addr,e)}function Lp(s,e){s.uniform2iv(this.addr,e)}function Pp(s,e){s.uniform3iv(this.addr,e)}function Ip(s,e){s.uniform4iv(this.addr,e)}function Dp(s,e){s.uniform1uiv(this.addr,e)}function Up(s,e){s.uniform2uiv(this.addr,e)}function Np(s,e){s.uniform3uiv(this.addr,e)}function Fp(s,e){s.uniform4uiv(this.addr,e)}function Op(s,e,t){const n=this.cache,i=e.length,r=ks(t,i);at(n,r)||(s.uniform1iv(this.addr,r),ot(n,r));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||Oc,r[a])}function Bp(s,e,t){const n=this.cache,i=e.length,r=ks(t,i);at(n,r)||(s.uniform1iv(this.addr,r),ot(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||zc,r[a])}function Hp(s,e,t){const n=this.cache,i=e.length,r=ks(t,i);at(n,r)||(s.uniform1iv(this.addr,r),ot(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Gc,r[a])}function zp(s,e,t){const n=this.cache,i=e.length,r=ks(t,i);at(n,r)||(s.uniform1iv(this.addr,r),ot(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Hc,r[a])}function Gp(s){switch(s){case 5126:return yp;case 35664:return Ep;case 35665:return Tp;case 35666:return Ap;case 35674:return bp;case 35675:return wp;case 35676:return Rp;case 5124:case 35670:return Cp;case 35667:case 35671:return Lp;case 35668:case 35672:return Pp;case 35669:case 35673:return Ip;case 5125:return Dp;case 36294:return Up;case 36295:return Np;case 36296:return Fp;case 35678:case 36198:case 36298:case 36306:case 35682:return Op;case 35679:case 36299:case 36307:return Bp;case 35680:case 36300:case 36308:case 36293:return Hp;case 36289:case 36303:case 36311:case 36292:return zp}}class kp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Sp(t.type)}}class Vp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Gp(t.type)}}class Wp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const o=i[r];o.setValue(e,t[o.id],n)}}}const Tr=/(\w+)(\])?(\[|\.)?/g;function Co(s,e){s.seq.push(e),s.map[e.id]=e}function Xp(s,e,t){const n=s.name,i=n.length;for(Tr.lastIndex=0;;){const r=Tr.exec(n),a=Tr.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){Co(t,l===void 0?new kp(o,s,e):new Vp(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new Wp(o),Co(t,u)),t=u}}}class Cs{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=e.getActiveUniform(t,i),a=e.getUniformLocation(t,r.name);Xp(r,a,this)}}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function Lo(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const qp=37297;let Yp=0;function jp(s,e){const t=s.split(` 3588`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3589`)}function Kp(s){const e=qe.getPrimaries(qe.workingColorSpace),t=qe.getPrimaries(s);let n;switch(e===t?n="":e===Ns&&t===Us?n="LinearDisplayP3ToLinearSRGB":e===Us&&t===Ns&&(n="LinearSRGBToLinearDisplayP3"),s){case mt:case Hs:return[n,"LinearTransferOETF"];case it:case Qr:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",s),[n,"LinearTransferOETF"]}}function Po(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const a=parseInt(r[1]);return t.toUpperCase()+` 3590 3591`+i+` 3592 3593`+jp(s.getShaderSource(e),a)}else return i}function Zp(s,e){const t=Kp(e);return`vec4 ${s}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function $p(s,e){let t;switch(e){case Vl:t="Linear";break;case Wl:t="Reinhard";break;case Xl:t="OptimizedCineon";break;case ql:t="ACESFilmic";break;case Yl:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Jp(s){return[s.extensionDerivatives||s.envMapCubeUVHeight||s.bumpMap||s.normalMapTangentSpace||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Gi).join(` 3594`)}function Qp(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3595`)}function em(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),a=r.name;let o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function Gi(s){return s!==""}function Io(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.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 Do(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vr(s){return s.replace(tm,im)}const nm=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function im(s,e){let t=Ie[e];if(t===void 0){const n=nm.get(e);if(n!==void 0)t=Ie[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Vr(t)}const sm=/#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 Uo(s){return s.replace(sm,rm)}function rm(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function No(s){let e="precision "+s.precision+` float; 3596precision `+s.precision+" int;";return s.precision==="highp"?e+=` 3597#define HIGH_PRECISION`:s.precision==="mediump"?e+=` 3598#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=` 3599#define LOW_PRECISION`),e}function am(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===lc?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===_l?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===on&&(e="SHADOWMAP_TYPE_VSM"),e}function om(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case _i:case xi:e="ENVMAP_TYPE_CUBE";break;case Bs:e="ENVMAP_TYPE_CUBE_UV";break}return e}function cm(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case xi:e="ENVMAP_MODE_REFRACTION";break}return e}function lm(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case hc:e="ENVMAP_BLENDING_MULTIPLY";break;case Gl:e="ENVMAP_BLENDING_MIX";break;case kl:e="ENVMAP_BLENDING_ADD";break}return e}function hm(s){const e=s.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 um(s,e,t,n){const i=s.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=am(t),l=om(t),h=cm(t),u=lm(t),d=hm(t),p=t.isWebGL2?"":Jp(t),g=Qp(r),_=i.createProgram();let m,f,E=t.glslVersion?"#version "+t.glslVersion+` 3600`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Gi).join(` 3601`),m.length>0&&(m+=` 3602`),f=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Gi).join(` 3603`),f.length>0&&(f+=` 3604`)):(m=[No(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.batching?"#define USE_BATCHING":"",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 "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3604IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",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",` 3605`].filter(Gi).join(` 3606`),f=[p,No(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IR
3606IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==En?"#define TONE_MAPPING":"",t.toneMapping!==En?Ie.tonemapping_pars_fragment:"",t.toneMapping!==En?$p("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ie.colorspace_pars_fragment,Zp("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3607`].filter(Gi).join(` 3608`)),a=Vr(a),a=Io(a,t),a=Do(a,t),o=Vr(o),o=Io(o,t),o=Do(o,t),a=Uo(a),o=Uo(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(E=`#version 300 es 3609`,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3610`)+` 3611`+m,f=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Ja?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ja?"":"#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(` 3612`)+` 3613`+f);const x=E+m+a,T=E+f+o,A=Lo(i,i.VERTEX_SHADER,x),w=Lo(i,i.FRAGMENT_SHADER,T);i.attachShader(_,A),i.attachShader(_,w),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(k){if(s.debug.checkShaderErrors){const X=i.getProgramInfoLog(_).trim(),J=i.getShaderInfoLog(A).trim(),P=i.getShaderInfoLog(w).trim();let H=!0,q=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(H=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,A,w);else{const V=Po(i,A,"vertex"),ne=Po(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` 3614 3615Program Info Log: `+X+` 3616`+V+` 3617`+ne)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(J===""||P==="")&&(q=!1);q&&(k.diagnostics={runnable:H,programLog:X,vertexShader:{log:J,prefix:m},fragmentShader:{log:P,prefix:f}})}i.deleteShader(A),i.deleteShader(w),B=new Cs(i,_),M=em(i,_)}let B;this.getUniforms=function(){return B===void 0&&C(this),B};let M;this.getAttributes=function(){return M===void 0&&C(this),M};let b=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return b===!1&&(b=i.getProgramParameter(_,qp)),b},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Yp++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=w,this}let dm=0;class fm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.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 pm(e),t.set(e,n)),n}}class pm{constructor(e){this.id=dm++,this.code=e,this.usedTimes=0}}function mm(s,e,t,n,i,r,a){const o=new Rc,c=new fm,l=[],h=i.isWebG
vendor: 28,240 bytes, lines 3617-3645
3617L2,u=i.logarithmicDepthBuffer,d=i.vertexTextures;let p=i.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M){return M===0?"uv":`uv${M}`}function m(M,b,k,X,J){const P=X.fog,H=J.geometry,q=M.isMeshStandardMaterial?X.environment:null,V=(M.isMeshStandardMaterial?t:e).get(M.envMap||q),ne=V&&V.mapping===Bs?V.image.height:null,W=g[M.type];M.precision!==null&&(p=i.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const j=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Q=j!==void 0?j.length:0;let ue=0;H.morphAttributes.position!==void 0&&(ue=1),H.morphAttributes.normal!==void 0&&(ue=2),H.morphAttributes.color!==void 0&&(ue=3);let z,Y,ae,pe;if(W){const St=qt[W];z=St.vertexShader,Y=St.fragmentShader}else z=M.vertexShader,Y=M.fragmentShader,c.update(M),ae=c.getVertexShaderID(M),pe=c.getFragmentShaderID(M);const me=s.getRenderTarget(),Pe=J.isInstancedMesh===!0,be=J.isBatchedMesh===!0,Te=!!M.map,De=!!M.matcap,D=!!V,Mt=!!M.aoMap,ge=!!M.lightMap,He=!!M.bumpMap,Me=!!M.normalMap,Qe=!!M.displacementMap,Ne=!!M.emissiveMap,Ce=!!M.metalnessMap,Ye=!!M.roughnessMap,dt=M.anisotropy>0,ft=M.clearcoat>0,y=M.iridescence>0,v=M.sheen>0,U=M.transmission>0,ee=dt&&!!M.anisotropyMap,K=ft&&!!M.clearcoatMap,te=ft&&!!M.clearcoatNormalMap,de=ft&&!!M.clearcoatRoughnessMap,se=y&&!!M.iridescenceMap,oe=y&&!!M.iridescenceThicknessMap,Se=v&&!!M.sheenColorMap,We=v&&!!M.sheenRoughnessMap,$=!!M.specularMap,je=!!M.specularColorMap,we=!!M.specularIntensityMap,ye=U&&!!M.transmissionMap,_e=U&&!!M.thicknessMap,he=!!M.gradientMap,ze=!!M.alphaMap,R=M.alphaTest>0,ce=!!M.alphaHash,Z=!!M.extensions,G=!!H.attributes.uv1,ie=!!H.attributes.uv2,ve=!!H.attributes.uv3;let Ve=En;return M.toneMapped&&(me===null||me.isXRRenderTarget===!0)&&(Ve=s.toneMapping),{isWebGL2:h,shaderID:W,shaderType:M.type,shaderName:M.name,vertexShader:z,fragmentShader:Y,defines:M.defines,customVertexShaderID:ae,customFragmentShaderID:pe,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:be,instancing:Pe,instancingColor:Pe&&J.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:me===null?s.outputColorSpace:me.isXRRenderTarget===!0?me.texture.colorSpace:mt,map:Te,matcap:De,envMap:D,envMapMode:D&&V.mapping,envMapCubeUVHeight:ne,aoMap:Mt,lightMap:ge,bumpMap:He,normalMap:Me,displacementMap:d&&Qe,emissiveMap:Ne,normalMapObjectSpace:Me&&M.normalMapType===hh,normalMapTangentSpace:Me&&M.normalMapType===yc,metalnessMap:Ce,roughnessMap:Ye,anisotropy:dt,anisotropyMap:ee,clearcoat:ft,clearcoatMap:K,clearcoatNormalMap:te,clearcoatRoughnessMap:de,iridescence:y,iridescenceMap:se,iridescenceThicknessMap:oe,sheen:v,sheenColorMap:Se,sheenRoughnessMap:We,specularMap:$,specularColorMap:je,specularIntensityMap:we,transmission:U,transmissionMap:ye,thicknessMap:_e,gradientMap:he,opaque:M.transparent===!1&&M.blending===pi,alphaMap:ze,alphaTest:R,alphaHash:ce,combine:M.combine,mapUv:Te&&_(M.map.channel),aoMapUv:Mt&&_(M.aoMap.channel),lightMapUv:ge&&_(M.lightMap.channel),bumpMapUv:He&&_(M.bumpMap.channel),normalMapUv:Me&&_(M.normalMap.channel),displacementMapUv:Qe&&_(M.displacementMap.channel),emissiveMapUv:Ne&&_(M.emissiveMap.channel),metalnessMapUv:Ce&&_(M.metalnessMap.channel),roughnessMapUv:Ye&&_(M.roughnessMap.channel),anisotropyMapUv:ee&&_(M.anisotropyMap.channel),clearcoatMapUv:K&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:te&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:de&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:se&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:oe&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:Se&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:We&&_(M.sheenRoughnessMap.channel),specularMapUv:$&&_(M.specularMap.channel),specularColorMapUv:je&&_(M.specularColorMap.channel),specularIntensityMapUv:we&&_(M.specularIntensityMap.channel),transmissionMapUv:ye&&_(M.transmissionMap.channel),thicknessMapUv:_e&&_(M.thicknessMap.channel),alphaMapUv:ze&&_(M.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(Me||dt),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:G,vertexUv2s:ie,vertexUv3s:ve,pointsUvs:J.isPoints===!0&&!!H.attributes.uv&&(Te||ze),fog:!!P,useFog:M.fog===!0,fogExp2:P&&P.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:J.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Q,morphTextureStride:ue,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,numLightProbes:b.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:s.shadowMap.enabled&&k.length>0,shadowMapType:s.shadowMap.type,toneMapping:Ve,useLegacyLights:s._useLegacyLights,decodeVideoTexture:Te&&M.map.isVideoTexture===!0&&qe.getTransfer(M.map.colorSpace)===Je,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Yt,flipSided:M.side===Rt,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:Z&&M.extensions.derivatives===!0,extensionFragDepth:Z&&M.extensions.fragDepth===!0,extensionDrawBuffers:Z&&M.extensions.drawBuffers===!0,extensionShaderTextureLOD:Z&&M.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()}}function f(M){const b=[];if(M.shaderID?b.push(M.shaderID):(b.push(M.customVertexShaderID),b.push(M.customFragmentShaderID)),M.defines!==void 0)for(const k in M.defines)b.push(k),b.push(M.defines[k]);return M.isRawShaderMaterial===!1&&(E(b,M),x(b,M),b.push(s.outputColorSpace)),b.push(M.customProgramCacheKey),b.join()}function E(M,b){M.push(b.precision),M.push(b.outputColorSpace),M.push(b.envMapMode),M.push(b.envMapCubeUVHeight),M.push(b.mapUv),M.push(b.alphaMapUv),M.push(b.lightMapUv),M.push(b.aoMapUv),M.push(b.bumpMapUv),M.push(b.normalMapUv),M.push(b.displacementMapUv),M.push(b.emissiveMapUv),M.push(b.metalnessMapUv),M.push(b.roughnessMapUv),M.push(b.anisotropyMapUv),M.push(b.clearcoatMapUv),M.push(b.clearcoatNormalMapUv),M.push(b.clearcoatRoughnessMapUv),M.push(b.iridescenceMapUv),M.push(b.iridescenceThicknessMapUv),M.push(b.sheenColorMapUv),M.push(b.sheenRoughnessMapUv),M.push(b.specularMapUv),M.push(b.specularColorMapUv),M.push(b.specularIntensityMapUv),M.push(b.transmissionMapUv),M.push(b.thicknessMapUv),M.push(b.combine),M.push(b.fogExp2),M.push(b.sizeAttenuation),M.push(b.morphTargetsCount),M.push(b.morphAttributeCount),M.push(b.numDirLights),M.push(b.numPointLights),M.push(b.numSpotLights),M.push(b.numSpotLightMaps),M.push(b.numHemiLights),M.push(b.numRectAreaLights),M.push(b.numDirLightShadows),M.push(b.numPointLightShadows),M.push(b.numSpotLightShadows),M.push(b.numSpotLightShadowsWithMaps),M.push(b.numLightProbes),M.push(b.shadowMapType),M.push(b.toneMapping),M.push(b.numClippingPlanes),M.push(b.numClipIntersection),M.push(b.depthPacking)}function x(M,b){o.disableAll(),b.isWebGL2&&o.enable(0),b.supportsVertexTextures&&o.enable(1),b.instancing&&o.enable(2),b.instancingColor&&o.enable(3),b.matcap&&o.enable(4),b.envMap&&o.enable(5),b.normalMapObjectSpace&&o.enable(6),b.normalMapTangentSpace&&o.enable(7),b.clearcoat&&o.enable(8),b.iridescence&&o.enable(9),b.alphaTest&&o.enable(10),b.vertexColors&&o.enable(11),b.vertexAlphas&&o.enable(12),b.vertexUv1s&&o.enable(13),b.vertexUv2s&&o.enable(14),b.vertexUv3s&&o.enable(15),b.vertexTangents&&o.enable(16),b.anisotropy&&o.enable(17),b.alphaHash&&o.enable(18),b.batching&&o.enable(19),M.push(o.mask),o.disableAll(),b.fog&&o.enable(0),b.useFog&&o.enable(1),b.flatShading&&o.enable(2),b.logarithmicDepthBuffer&&o.enable(3),b.skinning&&o.enable(4),b.morphTargets&&o.enable(5),b.morphNormals&&o.enable(6),b.morphColors&&o.enable(7),b.premultipliedAlpha&&o.enable(8),b.shadowMapEnabled&&o.enable(9),b.useLegacyLights&&o.enable(10),b.doubleSided&&o.enable(11),b.flipSided&&o.enable(12),b.useDepthPacking&&o.enable(13),b.dithering&&o.enable(14),b.transmission&&o.enable(15),b.sheen&&o.enable(16),b.opaque&&o.enable(17),b.pointsUvs&&o.enable(18),b.decodeVideoTexture&&o.enable(19),M.push(o.mask)}function T(M){const b=g[M.type];let k;if(b){const X=qt[b];k=$h.clone(X.uniforms)}else k=M.uniforms;return k}function A(M,b){let k;for(let X=0,J=l.length;X<J;X++){const P=l[X];if(P.cacheKey===b){k=P,++k.usedTimes;break}}return k===void 0&&(k=new um(s,b,M,r),l.push(k)),k}function w(M){if(--M.usedTimes===0){const b=l.indexOf(M);l[b]=l[l.length-1],l.pop(),M.destroy()}}function C(M){c.remove(M)}function B(){c.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:T,acquireProgram:A,releaseProgram:w,releaseShaderCache:C,programs:l,dispose:B}}function gm(){let s=new WeakMap;function e(r){let a=s.get(r);return a===void 0&&(a={},s.set(r,a)),a}function t(r){s.delete(r)}function n(r,a,o){s.get(r)[a]=o}function i(){s=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function _m(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Fo(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Oo(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(u,d,p,g,_,m){let f=s[e];return f===void 0?(f={id:u.id,object:u,geometry:d,material:p,groupOrder:g,renderOrder:u.renderOrder,z:_,group:m},s[e]=f):(f.id=u.id,f.object=u,f.geometry=d,f.material=p,f.groupOrder=g,f.renderOrder=u.renderOrder,f.z=_,f.group=m),e++,f}function o(u,d,p,g,_,m){const f=a(u,d,p,g,_,m);p.transmission>0?n.push(f):p.transparent===!0?i.push(f):t.push(f)}function c(u,d,p,g,_,m){const f=a(u,d,p,g,_,m);p.transmission>0?n.unshift(f):p.transparent===!0?i.unshift(f):t.unshift(f)}function l(u,d){t.length>1&&t.sort(u||_m),n.length>1&&n.sort(d||Fo),i.length>1&&i.sort(d||Fo)}function h(){for(let u=e,d=s.length;u<d;u++){const p=s[u];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:i,init:r,push:o,unshift:c,finish:h,sort:l}}function xm(){let s=new WeakMap;function e(n,i){const r=s.get(n);let a;return r===void 0?(a=new Oo,s.set(n,[a])):i>=r.length?(a=new Oo,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function vm(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new L,color:new Ae};break;case"SpotLight":t={position:new L,direction:new L,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":t={color:new Ae,position:new L,halfWidth:new L,halfHeight:new L};break}return s[e.id]=t,t}}}function Mm(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let Sm=0;function ym(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function Em(s,e){const t=new vm,n=Mm(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)i.probe.push(new L);const r=new L,a=new Be,o=new Be;function c(h,u){let d=0,p=0,g=0;for(let X=0;X<9;X++)i.probe[X].set(0,0,0);let _=0,m=0,f=0,E=0,x=0,T=0,A=0,w=0,C=0,B=0,M=0;h.sort(ym);const b=u===!0?Math.PI:1;for(let X=0,J=h.length;X<J;X++){const P=h[X],H=P.color,q=P.intensity,V=P.distance,ne=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)d+=H.r*q*b,p+=H.g*q*b,g+=H.b*q*b;else if(P.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(P.sh.coefficients[W],q);M++}else if(P.isDirectionalLight){const W=t.get(P);if(W.color.copy(P.color).multiplyScalar(P.intensity*b),P.castShadow){const j=P.shadow,Q=n.get(P);Q.shadowBias=j.bias,Q.shadowNormalBias=j.normalBias,Q.shadowRadius=j.radius,Q.shadowMapSize=j.mapSize,i.directionalShadow[_]=Q,i.directionalShadowMap[_]=ne,i.directionalShadowMatrix[_]=P.shadow.matrix,T++}i.directional[_]=W,_++}else if(P.isSpotLight){const W=t.get(P);W.position.setFromMatrixPosition(P.matrixWorld),W.color.copy(H).multiplyScalar(q*b),W.distance=V,W.coneCos=Math.cos(P.angle),W.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),W.decay=P.decay,i.spot[f]=W;const j=P.shadow;if(P.map&&(i.spotLightMap[C]=P.map,C++,j.updateMatrices(P),P.castShadow&&B++),i.spotLightMatrix[f]=j.matrix,P.castShadow){const Q=n.get(P);Q.shadowBias=j.bias,Q.shadowNormalBias=j.normalBias,Q.shadowRadius=j.radius,Q.shadowMapSize=j.mapSize,i.spotShadow[f]=Q,i.spotShadowMap[f]=ne,w++}f++}else if(P.isRectAreaLight){const W=t.get(P);W.color.copy(H).multiplyScalar(q),W.halfWidth.set(P.width*.5,0,0),W.halfHeight.set(0,P.height*.5,0),i.rectArea[E]=W,E++}else if(P.isPointLight){const W=t.get(P);if(W.color.copy(P.color).multiplyScalar(P.intensity*b),W.distance=P.distance,W.decay=P.decay,P.castShadow){const j=P.shadow,Q=n.get(P);Q.shadowBias=j.bias,Q.shadowNormalBias=j.normalBias,Q.shadowRadius=j.radius,Q.shadowMapSize=j.mapSize,Q.shadowCameraNear=j.camera.near,Q.shadowCameraFar=j.camera.far,i.pointShadow[m]=Q,i.pointShadowMap[m]=ne,i.pointShadowMatrix[m]=P.shadow.matrix,A++}i.point[m]=W,m++}else if(P.isHemisphereLight){const W=t.get(P);W.skyColor.copy(P.color).multiplyScalar(q*b),W.groundColor.copy(P.groundColor).multiplyScalar(q*b),i.hemi[x]=W,x++}}E>0&&(e.isWebGL2||s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=re.LTC_FLOAT_1,i.rectAreaLTC2=re.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=re.LTC_HALF_1,i.rectAreaLTC2=re.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=d,i.ambient[1]=p,i.ambient[2]=g;const k=i.hash;(k.directionalLength!==_||k.pointLength!==m||k.spotLength!==f||k.rectAreaLength!==E||k.hemiLength!==x||k.numDirectionalShadows!==T||k.numPointShadows!==A||k.numSpotShadows!==w||k.numSpotMaps!==C||k.numLightProbes!==M)&&(i.directional.length=_,i.spot.length=f,i.rectArea.length=E,i.point.length=m,i.hemi.length=x,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=w+C-B,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=B,i.numLightProbes=M,k.directionalLength=_,k.pointLength=m,k.spotLength=f,k.rectAreaLength=E,k.hemiLength=x,k.numDirectionalShadows=T,k.numPointShadows=A,k.numSpotShadows=w,k.numSpotMaps=C,k.numLightProbes=M,i.version=Sm++)}function l(h,u){let d=0,p=0,g=0,_=0,m=0;const f=u.matrixWorldInverse;for(let E=0,x=h.length;E<x;E++){const T=h[E];if(T.isDirectionalLight){const A=i.directional[d];A.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(f),d++}else if(T.isSpotLight){const A=i.spot[g];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(f),A.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(f),g++}else if(T.isRectAreaLight){const A=i.rectArea[_];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(f),o.identity(),a.copy(T.matrixWorld),a.premultiply(f),o.extractRotation(a),A.halfWidth.set(T.width*.5,0,0),A.halfHeight.set(0,T.height*.5,0),A.halfWidth.applyMatrix4(o),A.halfHeight.applyMatrix4(o),_++}else if(T.isPointLight){const A=i.point[p];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(f),p++}else if(T.isHemisphereLight){const A=i.hemi[m];A.direction.setFromMatrixPosition(T.matrixWorld),A.direction.transformDirection(f),m++}}}return{setup:c,setupView:l,state:i}}function Bo(s,e){const t=new Em(s,e),n=[],i=[];function r(){n.length=0,i.length=0}function a(u){n.push(u)}function o(u){i.push(u)}function c(u){t.setup(n,u)}function l(u){t.setupView(n,u)}return{init:r,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:c,setupLightsView:l,pushLight:a,pushShadow:o}}function Tm(s,e){let t=new WeakMap;function n(r,a=0){const o=t.get(r);let c;return o===void 0?(c=new Bo(s,e),t.set(r,[c])):a>=o.length?(c=new Bo(s,e),o.push(c)):c=o[a],c}function i(){t=new WeakMap}return{get:n,dispose:i}}class Am extends Kt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ch,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 bm extends Kt{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 wm=`void main() { 3618 gl_Position = vec4( position, 1.0 ); 3619}`,Rm=`uniform sampler2D shadow_pass; 3620uniform vec2 resolution; 3621uniform float radius; 3622#include <packing> 3623void main() { 3624 const float samples = float( VSM_SAMPLES ); 3625 float mean = 0.0; 3626 float squared_mean = 0.0; 3627 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3628 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3629 for ( float i = 0.0; i < samples; i ++ ) { 3630 float uvOffset = uvStart + i * uvStride; 3631 #ifdef HORIZONTAL_PASS 3632 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3633 mean += distribution.x; 3634 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3635 #else 3636 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3637 mean += depth; 3638 squared_mean += depth * depth; 3639 #endif 3640 } 3641 mean = mean / samples; 3642 squared_mean = squared_mean / samples; 3643 float std_dev = sqrt( squared_mean - mean * mean ); 3644 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3645}`;function Cm(s,e,t){let n=new ta;const i=new ke,r=new ke,a=new Ze,o=new Am({depthPacking:lh}),c=new bm,l={},h=t.maxTextureSize,u={[un]:Rt,[Rt]:un,[Yt]:Yt},d=new Wn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ke},radius:{value:4}},vertexShader:wm,fragmentShader:Rm}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new $t;g.setAttribute("position",new bt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Bt(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lc;let f=this.type;this.render=function(A,w,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;const B=s.getRenderTarget(),M=s.getActiveCubeFace(),b=s.getActiveMipmapLevel(),k=s.state;k.setBlending(yn),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const X=f!==on&&this.type===on,J=f===on&&this.type!==on;for(let P=0,H=A.length;P<H;P++){const q=A[P],V=q.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",q,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);const ne=V.getFrameExtents();if(i.multiply(ne),r.copy(V.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/ne.x),i.x=r.x*ne.x,V.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/ne.y),i.y=r.y*ne.y,V.mapSize.y=r.y)),V.map===null||X===!0||J===!0){const j=this.type!==on?{minFilter:ut,magFilter:ut}:{};V.map!==null&&V.map.dispose(),V.map=new Vn(i.x,i.y,j),V.map.texture.name=q.name+".shadowMap",V.camera.updateProjectionMatrix()}s.setRenderTarget(V.map),s.clear();const W=V.getViewportCount();for(let j=0;j<W;j++){const Q=V.getViewport(j);a.set(r.x*Q.x,r.y*Q.y,r.x*Q.z,r.y*Q.w),k.viewport(a),V.updateMatrices(q,j),n=V.getFrustum(),T(w,C,V.camera,q,this.type)}V.isPointLightShadow!==!0&&this.type===on&&E(V,C),V.needsUpdate=!1}f=this.type,m.needsUpdate=!1,s.setRenderTarget(B,M,b)};function E(A,w){const C=e.update(_);d.defines.VSM_SAMPLES!==A.blurSamples&&(d.defines.VSM_SAMPLES=A.blurSamples,p.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Vn(i.x,i.y)),d.uniforms.shadow_pass.value=A.map.texture,d.uniforms.resolution.value=A.mapSize,d.uniforms.radius.value=A.radius,s.setRenderTarget(A.mapPass),s.clear(),s.renderBufferDirect(w,null,C,d,_,null),p.uniforms.shadow_pass.value=A.mapPass.texture,p.uniforms.resolution.value=A.mapSize,p.uniforms.radius.value=A.radius,s.setRenderTarget(A.map),s.clear(),s.renderBufferDirect(w,null,C,p,_,null)}function x(A,w,C,B){let M=null;const b=C.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(b!==void 0)M=b;else if(M=C.isPointLight===!0?c:o,s.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const k=M.uuid,X=w.uuid;let J=l[k];J===void 0&&(J={},l[k]=J);let P=J[X];P===void 0&&(P=M.clone(),J[X]=P),M=P}if(M.visible=w.visible,M.wireframe=w.wireframe,B===on?M.side=w.shadowSide!==null?w.shadowSide:w.side:M.side=w.shadowSide!==null?w.shadowSide:u[w.side],M.alphaMap=w.alphaMap,M.alphaTest=w.alphaTest,M.map=w.map,M.clipShadows=w.clipShadows,M.clippingPlanes=w.clippingPlanes,M.clipIntersection=w.clipIntersection,M.displacementMap=w.displacementMap,M.displacementScale=w.displacementScale,M.displacementBias=w.displacementBias,M.wireframeLinewidth=w.wireframeLinewidth,M.linewidth=w.linewidth,C.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const k=s.properties.get(M);k.light=C}return M}function T(A,w,C,B,M){if(A.visible===!1)return;if(A.layers.test(w.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&M===on)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,A.matrixWorld);const X=e.update(A),J=A.material;if(Array.isArray(J)){const P=X.groups;for(let H=0,q=P.length;H<q;H++){const V=P[H],ne=J[V.materialIndex];if(ne&&ne.visible){const W=x(A,ne,B,M);A.onBeforeShadow(s,A,w,C,X,W,V),s.renderBufferDirect(C,null,X,W,A,V),A.onAfterShadow(s,A,w,C,X,W,V)}}}else if(J.visible){const P=x(A,J,B,M);A.onBeforeShadow(s,A,w,C,X,P,null),s.renderBufferDirect(C,null,X,P,A,null),A.onAfterShadow(s,A,w,C,X,P,null)}}const k=A.children;for(let X=0,J=k.length;X<J;X++)T(k[X],w,C,B,M)}}function Lm(s,e,t){const n=t.isWebGL2;function i(){let R=!1;const ce=new Ze;let Z=null;const G=new Ze(0,0,0,0);return{setMask:function(ie){Z!==ie&&!R&&(s.colorMask(ie,ie,ie,ie),Z=ie)},setLocked:function(ie){R=ie},setClear:function(ie,ve,Ve,ct,St){St===!0&&(ie*=ct,ve*=ct,Ve*=ct),ce.set(ie,ve,Ve,ct),G.equals(ce)===!1&&(s.clearColor(ie,ve,Ve,ct),G.copy(ce))},reset:function(){R=!1,Z=null,G.set(-1,0,0,0)}}}function r(){let R=!1,ce=null,Z=null,G=null;return{setTest:function(ie){ie?be(s.DEPTH_TEST):Te(s.DEPTH_TEST)},setMask:function(ie){ce!==ie&&!R&&(s.depthMask(ie),ce=ie)},setFunc:function(ie){if(Z!==ie){switch(ie){case Ul:s.depthFunc(s.NEVER);break;case Nl:s.depthFunc(s.ALWAYS);break;case Fl:s.depthFunc(s.LESS);break;case Ls:s.depthFunc(s.LEQUAL);break;case Ol:s.depthFunc(s.EQUAL);break;case Bl:s.depthFunc(s.GEQUAL);break;case Hl:s.depthFunc(s.GREATER);break;case zl:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Z=ie}},setLocked:function(ie){R=ie},setClear:function(ie){G!==ie&&(s.clearDepth(ie),G=ie)},reset:function(){R=!1,ce=null,Z=null,G=null}}}function a(){let R=!1,ce=null,Z=null,G=null,ie=null,ve=null,Ve=null,ct=null,St=null;return{setTest:function($e){R||($e?be(s.STENCIL_TEST):Te(s.STENCIL_TEST))},setMask:function($e){ce!==$e&&!R&&(s.stencilMask($e),ce=$e)},setFunc:function($e,yt,Xt){(Z!==$e||G!==yt||ie!==Xt)&&(s.stencilFunc($e,yt,Xt),Z=$e,G=yt,ie=Xt)},setOp:function($e,yt,Xt){(ve!==$e||Ve!==yt||ct!==Xt)&&(s.stencilOp($e,yt,Xt),ve=$e,Ve=yt,ct=Xt)},setLocked:function($e){R=$e},setClear:function($e){St!==$e&&(s.clearStencil($e),St=$e)},reset:function(){R=!1,ce=null,Z=null,G=null,ie=null,ve=null,Ve=null,ct=null,St=null}}}const o=new i,c=new r,l=new a,h=new WeakMap,u=new WeakMap;let d={},p={},g=new WeakMap,_=[],m=null,f=!1,E=null,x=null,T=null,A=null,w=null,C=null,B=null,M=new Ae(0,0,0),b=0,k=!1,X=null,J=null,P=null,H=null,q=null;const V=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ne=!1,W=0;const j=s.getParameter(s.VERSION);j.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(j)[1]),ne=W>=1):j.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),ne=W>=2);let Q=null,ue={};const z=s.getParameter(s.SCISSOR_BOX),Y=s.getParameter(s.VIEWPORT),ae=new Ze().fromArray(z),pe=new Ze().fromArray(Y);function me(R,ce,Z,G){const ie=new Uint8Array(4),ve=s.createTexture();s.bindTexture(R,ve),s.texParameteri(R,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(R,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Ve=0;Ve<Z;Ve++)n&&(R===s.TEXTURE_3D||R===s.TEXTURE_2D_ARRAY)?s.texImage3D(ce,0,s.RGBA,1,1,G,0,s.RGBA,s.UNSIGNED_BYTE,ie):s.texImage2D(ce+Ve,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,ie);return ve}const Pe={};Pe[s.TEXTURE_2D]=me(s.TEXTURE_2D,s.TEXTURE_2D,1),Pe[s.TEXTURE_CUBE_MAP]=me(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(Pe[s.TEXTURE_2D_ARRAY]=me(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),Pe[s.TEXTURE_3D]=me(s.TEXTURE_3D,s.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),c.setClear(1),l.setClear(0),be(s.DEPTH_TEST),c.setFunc(Ls),Ne(!1),Ce(va),be(s.CULL_FACE),Me(yn);function be(R){d[R]!==!0&&(s.enable(R),d[R]=!0)}function Te(R){d[R]!==!1&&(s.disable(R),d[R]=!1)}function De(R,ce){return p[R]!==ce?(s.bindFramebuffer(R,ce),p[R]=ce,n&&(R===s.DRAW_FRAMEBUFFER&&(p[s.FRAMEBUFFER]=ce),R===s.FRAMEBUFFER&&(p[s.DRAW_FRAMEBUFFER]=ce)),!0):!1}function D(R,ce){let Z=_,G=!1;
vendor: 4,903 bytes, line 3645
3645if(R)if(Z=g.get(ce),Z===void 0&&(Z=[],g.set(ce,Z)),R.isWebGLMultipleRenderTargets){const ie=R.texture;if(Z.length!==ie.length||Z[0]!==s.COLOR_ATTACHMENT0){for(let ve=0,Ve=ie.length;ve<Ve;ve++)Z[ve]=s.COLOR_ATTACHMENT0+ve;Z.length=ie.length,G=!0}}else Z[0]!==s.COLOR_ATTACHMENT0&&(Z[0]=s.COLOR_ATTACHMENT0,G=!0);else Z[0]!==s.BACK&&(Z[0]=s.BACK,G=!0);G&&(t.isWebGL2?s.drawBuffers(Z):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Z))}function Mt(R){return m!==R?(s.useProgram(R),m=R,!0):!1}const ge={[Nn]:s.FUNC_ADD,[vl]:s.FUNC_SUBTRACT,[Ml]:s.FUNC_REVERSE_SUBTRACT};if(n)ge[Ea]=s.MIN,ge[Ta]=s.MAX;else{const R=e.get("EXT_blend_minmax");R!==null&&(ge[Ea]=R.MIN_EXT,ge[Ta]=R.MAX_EXT)}const He={[Sl]:s.ZERO,[yl]:s.ONE,[El]:s.SRC_COLOR,[Ur]:s.SRC_ALPHA,[Cl]:s.SRC_ALPHA_SATURATE,[wl]:s.DST_COLOR,[Al]:s.DST_ALPHA,[Tl]:s.ONE_MINUS_SRC_COLOR,[Nr]:s.ONE_MINUS_SRC_ALPHA,[Rl]:s.ONE_MINUS_DST_COLOR,[bl]:s.ONE_MINUS_DST_ALPHA,[Ll]:s.CONSTANT_COLOR,[Pl]:s.ONE_MINUS_CONSTANT_COLOR,[Il]:s.CONSTANT_ALPHA,[Dl]:s.ONE_MINUS_CONSTANT_ALPHA};function Me(R,ce,Z,G,ie,ve,Ve,ct,St,$e){if(R===yn){f===!0&&(Te(s.BLEND),f=!1);return}if(f===!1&&(be(s.BLEND),f=!0),R!==xl){if(R!==E||$e!==k){if((x!==Nn||w!==Nn)&&(s.blendEquation(s.FUNC_ADD),x=Nn,w=Nn),$e)switch(R){case pi:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ma:s.blendFunc(s.ONE,s.ONE);break;case Sa:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case ya:s.blendFuncSeparate(s.ZERO,s.SRC_COLOR,s.ZERO,s.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",R);break}else switch(R){case pi:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ma:s.blendFunc(s.SRC_ALPHA,s.ONE);break;case Sa:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case ya:s.blendFunc(s.ZERO,s.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",R);break}T=null,A=null,C=null,B=null,M.set(0,0,0),b=0,E=R,k=$e}return}ie=ie||ce,ve=ve||Z,Ve=Ve||G,(ce!==x||ie!==w)&&(s.blendEquationSeparate(ge[ce],ge[ie]),x=ce,w=ie),(Z!==T||G!==A||ve!==C||Ve!==B)&&(s.blendFuncSeparate(He[Z],He[G],He[ve],He[Ve]),T=Z,A=G,C=ve,B=Ve),(ct.equals(M)===!1||St!==b)&&(s.blendColor(ct.r,ct.g,ct.b,St),M.copy(ct),b=St),E=R,k=!1}function Qe(R,ce){R.side===Yt?Te(s.CULL_FACE):be(s.CULL_FACE);let Z=R.side===Rt;ce&&(Z=!Z),Ne(Z),R.blending===pi&&R.transparent===!1?Me(yn):Me(R.blending,R.blendEquation,R.blendSrc,R.blendDst,R.blendEquationAlpha,R.blendSrcAlpha,R.blendDstAlpha,R.blendColor,R.blendAlpha,R.premultipliedAlpha),c.setFunc(R.depthFunc),c.setTest(R.depthTest),c.setMask(R.depthWrite),o.setMask(R.colorWrite);const G=R.stencilWrite;l.setTest(G),G&&(l.setMask(R.stencilWriteMask),l.setFunc(R.stencilFunc,R.stencilRef,R.stencilFuncMask),l.setOp(R.stencilFail,R.stencilZFail,R.stencilZPass)),dt(R.polygonOffset,R.polygonOffsetFactor,R.polygonOffsetUnits),R.alphaToCoverage===!0?be(s.SAMPLE_ALPHA_TO_COVERAGE):Te(s.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(R){X!==R&&(R?s.frontFace(s.CW):s.frontFace(s.CCW),X=R)}function Ce(R){R!==ml?(be(s.CULL_FACE),R!==J&&(R===va?s.cullFace(s.BACK):R===gl?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Te(s.CULL_FACE),J=R}function Ye(R){R!==P&&(ne&&s.lineWidth(R),P=R)}function dt(R,ce,Z){R?(be(s.POLYGON_OFFSET_FILL),(H!==ce||q!==Z)&&(s.polygonOffset(ce,Z),H=ce,q=Z)):Te(s.POLYGON_OFFSET_FILL)}function ft(R){R?be(s.SCISSOR_TEST):Te(s.SCISSOR_TEST)}function y(R){R===void 0&&(R=s.TEXTURE0+V-1),Q!==R&&(s.activeTexture(R),Q=R)}function v(R,ce,Z){Z===void 0&&(Q===null?Z=s.TEXTURE0+V-1:Z=Q);let G=ue[Z];G===void 0&&(G={type:void 0,texture:void 0},ue[Z]=G),(G.type!==R||G.texture!==ce)&&(Q!==Z&&(s.activeTexture(Z),Q=Z),s.bindTexture(R,ce||Pe[R]),G.type=R,G.texture=ce)}function U(){const R=ue[Q];R!==void 0&&R.type!==void 0&&(s.bindTexture(R.type,null),R.type=void 0,R.texture=void 0)}function ee(){try{s.compressedTexImage2D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function K(){try{s.compressedTexImage3D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function te(){try{s.texSubImage2D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function de(){try{s.texSubImage3D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function se(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function oe(){try{s.compressedTexSubImage3D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function Se(){try{s.texStorage2D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function We(){try{s.texStorage3D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function $(){try{s.texImage2D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function je(){try{s.texImage3D.apply(s,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}
3645function we(R){ae.equals(R)===!1&&(s.scissor(R.x,R.y,R.z,R.w),ae.copy(R))}function ye(R){pe.equals(R)===!1&&(s.viewport(R.x,R.y,R.z,R.w),pe.copy(R))}function _e(R,ce){let Z=u.get(ce);Z===void 0&&(Z=new WeakMap,u.set(ce,Z));let G=Z.get(R);G===void 0&&(G=s.getUniformBlockIndex(ce,R.name),Z.set(R,G))}function he(R,ce){const G=u.get(ce).get(R);h.get(ce)!==G&&(s.uniformBlockBinding(ce,G,R.__bindingPointIndex),h.set(ce,G))}function ze(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),n===!0&&(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null)),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),d={},Q=null,ue={},p={},g=new WeakMap,_=[],m=null,f=!1,E=null,x=null,T=null,A=null,w=null,C=null,B=null,M=new Ae(0,0,0),b=0,k=!1,X=null,J=null,P=null,H=null,q=null,ae.set(0,0,s.canvas.width,s.canvas.height),pe.set(0,0,s.canvas.width,s.canvas.height),o.reset(),c.reset(),l.reset()}return{buffers:{color:o,depth:c,stencil:l},enable:be,disable:Te,bindFramebuffer:De,drawBuffers:D,useProgram:Mt,setBlending:Me,setMaterial:Qe,setFlipSided:Ne,setCullFace:Ce,setLineWidth:Ye,setPolygonOffset:dt,setScissorTest:ft,activeTexture:y,bindTexture:v,unbindTexture:U,compressedTexImage2D:ee,compressedTexImage3D:K,texImage2D:$,texImage3D:je,updateUBOMapping:_e,uniformBlockBinding:he,texStorage2D:Se,texStorage3D:We,texSubImage2D:te,texSubImage3D:de,compressedTexSubImage2D:se,compressedTexSubImage3D:oe,scissor:we,viewport:ye,reset:ze}}function Pm(s,e,t,n,i,r,a){const o=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,h=i.maxTextureSize,u=i.maxSamples,d=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),g=new WeakMap;let _;const m=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function E(y,v){return f?new OffscreenCanvas(y,v):ji("canvas")}function x(y,v,U,ee){let K=1;if((y.width>ee||y.height>ee)&&(K=ee/Math.max(y.width,y.height)),K<1||v===!0)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap){const te=v?Os:Math.floor,de=te(K*y.width),se=te(K*y.height);_===void 0&&(_=E(de,se));const oe=U?E(de,se):_;return oe.width=de,oe.height=se,oe.getContext("2d").drawImage(y,0,0,de,se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+y.width+"x"+y.height+") to ("+de+"x"+se+")."),oe}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+y.width+"x"+y.height+")."),y;return y}function T(y){return kr(y.width)&&kr(y.height)}function A(y){return o?!1:y.wrapS!==Nt||y.wrapT!==Nt||y.minFilter!==ut&&y.minFilter!==wt}function w(y,v){return y.generateMipmaps&&v&&y.minFilter!==ut&&y.minFilter!==wt}function C(y){s.generateMipmap(y)}function B(y,v,U,ee,K=!1){if(o===!1)return v;if(y!==null){if(s[y]!==void 0)return s[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let te=v;if(v===s.RED&&(U===s.FLOAT&&(te=s.R32F),U===s.HALF_FLOAT&&(te=s.R16F),U===s.UNSIGNED_BYTE&&(te=s.R8)),v===s.RED_INTEGER&&(U===s.UNSIGNED_BYTE&&(te=s.R8UI),U===s.UNSIGNED_SHORT&&(te=s.R16UI),U===s.UNSIGNED_INT&&(te=s.R32UI),U===s.BYTE&&(te=s.R8I),U===s.SHORT&&(te=s.R16I),U===s.INT&&(te=s.R32I)),v===s.RG&&(U===s.FLOAT&&(te=s.RG32F),U===s.HALF_FLOAT&&(te=s.RG16F),U===s.UNSIGNED_BYTE&&(te=s.RG8)),v===s.RGBA){const de=K?Ds:qe.getTransfer(ee);U===s.FLOAT&&(te=s.RGBA32F),U===s.HALF_FLOAT&&(te=s.RGBA16F),U===s.UNSIGNED_BYTE&&(te=de===Je?s.SRGB8_ALPHA8:s.RGBA8),U===s.UNSIGNED_SHORT_4_4_4_4&&(te=s.RGBA4),U===s.UNSIGNED_SHORT_5_5_5_1&&(te=s.RGB5_A1)}return(te===s.R16F||te===s.R32F||te===s.RG16F||te===s.RG32F||te===s.RGBA16F||te===s.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function M(y,v,U){return w(y,U)===!0||y.isFramebufferTexture&&y.minFilter!==ut&&y.minFilter!==wt?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function b(y){return y===ut||y===Br||y===Rs?s.NEAREST:s.LINEAR}function k(y){const v=y.target;v.removeEventListener("dispose",k),J(v),v.isVideoTexture&&g.delete(v)}function X(y){const v=y.target;v.removeEventListener("dispose",X),H(v)}function J(y){const v=n.get(y);if(v.__webglInit===void 0)return;const U=y.source,ee=m.get(U);if(ee){const K=ee[v.__cacheKey];K.usedTimes--,K.usedTimes===0&&P(y),Object.keys(ee).length===0&&m.delete(U)}n.remove(y)}function P(y){const v=n.get(y);s.deleteTexture(v.__webglTexture);const U=y.source,ee=m.get(U);delete ee[v.__cacheKey],a.memory.textures--}function H(y){const v=y.texture,U=n.get(y),ee=n.get(v);if(ee.__webglTexture!==void 0&&(s.deleteTexture(ee.__webglTexture),a.memory.textures--),y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRen
3645derTarget)for(let K=0;K<6;K++){if(Array.isArray(U.__webglFramebuffer[K]))for(let te=0;te<U.__webglFramebuffer[K].length;te++)s.deleteFramebuffer(U.__webglFramebuffer[K][te]);else s.deleteFramebuffer(U.__webglFramebuffer[K]);U.__webglDepthbuffer&&s.deleteRenderbuffer(U.__webglDepthbuffer[K])}else{if(Array.isArray(U.__webglFramebuffer))for(let K=0;K<U.__webglFramebuffer.length;K++)s.deleteFramebuffer(U.__webglFramebuffer[K]);else s.deleteFramebuffer(U.__webglFramebuffer);if(U.__webglDepthbuffer&&s.deleteRenderbuffer(U.__webglDepthbuffer),U.__webglMultisampledFramebuffer&&s.deleteFramebuffer(U.__webglMultisampledFramebuffer),U.__webglColorRenderbuffer)for(let K=0;K<U.__webglColorRenderbuffer.length;K++)U.__webglColorRenderbuffer[K]&&s.deleteRenderbuffer(U.__webglColorRenderbuffer[K]);U.__webglDepthRenderbuffer&&s.deleteRenderbuffer(U.__webglDepthRenderbuffer)}if(y.isWebGLMultipleRenderTargets)for(let K=0,te=v.length;K<te;K++){const de=n.get(v[K]);de.__webglTexture&&(s.deleteTexture(de.__webglTexture),a.memory.textures--),n.remove(v[K])}n.remove(v),n.remove(y)}let q=0;function V(){q=0}function ne(){const y=q;return y>=c&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+c),q+=1,y}function W(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function j(y,v){const U=n.get(y);if(y.isVideoTexture&&dt(y),y.isRenderTargetTexture===!1&&y.version>0&&U.__version!==y.version){const ee=y.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(U,y,v);return}}t.bindTexture(s.TEXTURE_2D,U.__webglTexture,s.TEXTURE0+v)}function Q(y,v){const U=n.get(y);if(y.version>0&&U.__version!==y.version){be(U,y,v);return}t.bindTexture(s.TEXTURE_2D_ARRAY,U.__webglTexture,s.TEXTURE0+v)}function ue(y,v){const U=n.get(y);if(y.version>0&&U.__version!==y.version){be(U,y,v);return}t.bindTexture(s.TEXTURE_3D,U.__webglTexture,s.TEXTURE0+v)}function z(y,v){const U=n.get(y);if(y.version>0&&U.__version!==y.version){Te(U,y,v);return}t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+v)}const Y={[vi]:s.REPEAT,[Nt]:s.CLAMP_TO_EDGE,[Ps]:s.MIRRORED_REPEAT},ae={[ut]:s.NEAREST,[Br]:s.NEAREST_MIPMAP_NEAREST,[Rs]:s.NEAREST_MIPMAP_LINEAR,[wt]:s.LINEAR,[dc]:s.LINEAR_MIPMAP_NEAREST,[kn]:s.LINEAR_MIPMAP_LINEAR},pe={[uh]:s.NEVER,[_h]:s.ALWAYS,[dh]:s.LESS,[Ec]:s.LEQUAL,[fh]:s.EQUAL,[gh]:s.GEQUAL,[ph]:s.GREATER,[mh]:s.NOTEQUAL};function me(y,v,U){if(U?(s.texParameteri(y,s.TEXTURE_WRAP_S,Y[v.wrapS]),s.texParameteri(y,s.TEXTURE_WRAP_T,Y[v.wrapT]),(y===s.TEXTURE_3D||y===s.TEXTURE_2D_ARRAY)&&s.texParameteri(y,s.TEXTURE_WRAP_R,Y[v.wrapR]),s.texParameteri(y,s.TEXTURE_MAG_FILTER,ae[v.magFilter]),s.texParameteri(y,s.TEXTURE_MIN_FILTER,ae[v.minFilter])):(s.texParameteri(y,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(y,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),(y===s.TEXTURE_3D||y===s.TEXTURE_2D_ARRAY)&&s.texParameteri(y,s.TEXTURE_WRAP_R,s.CLAMP_TO_EDGE),(v.wrapS!==Nt||v.wrapT!==Nt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(y,s.TEXTURE_MAG_FILTER,b(v.magFilter)),s.texParameteri(y,s.TEXTURE_MIN_FILTER,b(v.minFilter)),v.minFilter!==ut&&v.minFilter!==wt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),v.compareFunction&&(s.texParameteri(y,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(y,s.TEXTURE_COMPARE_FUNC,pe[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ee=e.get("EXT_texture_filter_anisotropic");if(v.magFilter===ut||v.minFilter!==Rs&&v.minFilter!==kn||v.type===cn&&e.has("OES_texture_float_linear")===!1||o===!1&&v.type===qi&&e.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||n.get(v).__currentAnisotropy)&&(s.texParameterf(y,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,i.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy)}}function Pe(y,v){let U=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",k));const ee=v.source;let K=m.get(ee);K===void 0&&(K={},m.set(ee,K));const te=W(v);
3645if(te!==y.__cacheKey){K[te]===void 0&&(K[te]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,U=!0),K[te].usedTimes++;const de=K[y.__cacheKey];de!==void 0&&(K[y.__cacheKey].usedTimes--,de.usedTimes===0&&P(v)),y.__cacheKey=te,y.__webglTexture=K[te].texture}return U}function be(y,v,U){let ee=s.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(ee=s.TEXTURE_2D_ARRAY),v.isData3DTexture&&(ee=s.TEXTURE_3D);const K=Pe(y,v),te=v.source;t.bindTexture(ee,y.__webglTexture,s.TEXTURE0+U);const de=n.get(te);if(te.version!==de.__version||K===!0){t.activeTexture(s.TEXTURE0+U);const se=qe.getPrimaries(qe.workingColorSpace),oe=v.colorSpace===Ot?null:qe.getPrimaries(v.colorSpace),Se=v.colorSpace===Ot||se===oe?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,v.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,v.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const We=A(v)&&T(v.image)===!1;let $=x(v.image,We,!1,h);$=ft(v,$);const je=T($)||o,we=r.convert(v.format,v.colorSpace);let ye=r.convert(v.type),_e=B(v.internalFormat,we,ye,v.colorSpace,v.isVideoTexture);me(ee,v,je);let he;const ze=v.mipmaps,R=o&&v.isVideoTexture!==!0&&_e!==vc,ce=de.__version===void 0||K===!0,Z=M(v,$,je);if(v.isDepthTexture)_e=s.DEPTH_COMPONENT,o?v.type===cn?_e=s.DEPTH_COMPONENT32F:v.type===Sn?_e=s.DEPTH_COMPONENT24:v.type===Hn?_e=s.DEPTH24_STENCIL8:_e=s.DEPTH_COMPONENT16:v.type===cn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===zn&&_e===s.DEPTH_COMPONENT&&v.type!==$r&&v.type!==Sn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=Sn,ye=r.convert(v.type)),v.format===Mi&&_e===s.DEPTH_COMPONENT&&(_e=s.DEPTH_STENCIL,v.type!==Hn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=Hn,ye=r.convert(v.type))),ce&&(R?t.texStorage2D(s.TEXTURE_2D,1,_e,$.width,$.height):t.texImage2D(s.TEXTURE_2D,0,_e,$.width,$.height,0,we,ye,null));else if(v.isDataTexture)if(ze.length>0&&je){R&&ce&&t.texStorage2D(s.TEXTURE_2D,Z,_e,ze[0].width,ze[0].height);for(let G=0,ie=ze.length;G<ie;G++)he=ze[G],R?t.texSubImage2D(s.TEXTURE_2D,G,0,0,he.width,he.height,we,ye,he.data):t.texImage2D(s.TEXTURE_2D,G,_e,he.width,he.height,0,we,ye,he.data);v.generateMipmaps=!1}else R?(ce&&t.texStorage2D(s.TEXTURE_2D,Z,_e,$.width,$.height),t.texSubImage2D(s.TEXTURE_2D,0,0,0,$.width,$.height,we,ye,$.data)):t.texImage2D(s.TEXTURE_2D,0,_e,$.width,$.height,0,we,ye,$.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){R&&ce&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Z,_e,ze[0].width,ze[0].height,$.depth);for(let G=0,ie=ze.length;G<ie;G++)he=ze[G],v.format!==Ft?we!==null?R?t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,G,0,0,0,he.width,he.height,$.depth,we,he.data,0,0):t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,G,_e,he.width,he.height,$.depth,0,he.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):R?t.texSubImage3D(s.TEXTURE_2D_ARRAY,G,0,0,0,he.width,he.height,$.depth,we,ye,he.data):t.texImage3D(s.TEXTURE_2D_ARRAY,G,_e,he.width,he.height,$.depth,0,we,ye,he.data)}else{R&&ce&&t.texStorage2D(s.TEXTURE_2D,Z,_e,ze[0].width,ze[0].height);for(let G=0,ie=ze.length;G<ie;G++)he=ze[G],v.format!==Ft?we!==null?R?t.compressedTexSubImage2D(s.TEXTURE_2D,G,0,0,he.width,he.height,we,he.data):t.compressedTexImage2D(s.TEXTURE_2D,G,_e,he.width,he.height,0,he.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):R?t.texSubImage2D(s.TEXTURE_2D,G,0,0,he.width,he.height,we,ye,he.data):t.texImage2D(s.TEXTURE_2D,G,_e,he.width,he.height,0,we,ye,he.data)}else if(v.isDataArrayTexture)R?(ce&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Z,_e,$.width,$.height,$.depth),t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,we,ye,$.data)):t.texImage3D(s.TEXTURE_2D_ARRAY,0,_e,$.width,$.height,$.depth,0,we,ye,$.data);else if(v.isData3DTexture)R?(ce&&t.texStorage3D(s.TEXTURE_3D,Z,_e,$.width,$.height,$.depth),t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,we,ye,$.data)):t.texImage3D(s.TEXTURE_3D,0,_e,$.width,$.height,$.depth,0,we,ye,$.data);else if(v.isFramebufferTexture){if(ce)if(R)t.texStorage2D(s.TEXTURE_2D,Z,_e,$.width,$.height);else{let G=$.width,ie=$.height;for(let ve=0;ve<Z;ve++)t.texImage2D(s.TEXTURE_2D,ve,_e,G,ie,0,we,ye,null),G>>=1,ie>>=1}}else if(ze.length>0&&je){R&&ce&&t.texStorage2D(s.TEXTURE_2D,Z,_e,ze[0].width,ze[0].height);for(let G=0,ie=ze.length;G<ie;G++)he=ze[G],R?t.texSubImage2D(s.TEXTURE_2D,G,0,0,we,ye,he):t.texImage2D(s.TEXTURE_2D,G,_e,we,ye,he);v.generateMipmaps=!1}else R?(ce&&t.texStorage2D(s.TEXTURE_2D,Z,_e,$.width,$.height),t.texSubImage2D(s.TEXTURE_2D,0,0,0,we,ye,$)):t.texImage2D(s.TEXTURE_2D,0,_e,we,ye,$);w(v,je)&&C(ee),de.__version=te.version,v.onUpdate&&v.onUpdate(v)}y.__version=v.version}function Te(y,v,U){if(v.image.length!==6)return;const ee=Pe(y,v),K=v.source;t.bindTexture(s.TEXTURE_CUBE_MAP,y.__webglTexture,s.TEXTURE0+U);const te=n.get(K);if(K.version!==te.__version||ee===!0){t.activeTexture(s.TEXTURE0+U);
3645const de=qe.getPrimaries(qe.workingColorSpace),se=v.colorSpace===Ot?null:qe.getPrimaries(v.colorSpace),oe=v.colorSpace===Ot||de===se?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,v.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,v.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,oe);const Se=v.isCompressedTexture||v.image[0].isCompressedTexture,We=v.image[0]&&v.image[0].isDataTexture,$=[];for(let G=0;G<6;G++)!Se&&!We?$[G]=x(v.image[G],!1,!0,l):$[G]=We?v.image[G].image:v.image[G],$[G]=ft(v,$[G]);const je=$[0],we=T(je)||o,ye=r.convert(v.format,v.colorSpace),_e=r.convert(v.type),he=B(v.internalFormat,ye,_e,v.colorSpace),ze=o&&v.isVideoTexture!==!0,R=te.__version===void 0||ee===!0;let ce=M(v,je,we);me(s.TEXTURE_CUBE_MAP,v,we);let Z;if(Se){ze&&R&&t.texStorage2D(s.TEXTURE_CUBE_MAP,ce,he,je.width,je.height);for(let G=0;G<6;G++){Z=$[G].mipmaps;for(let ie=0;ie<Z.length;ie++){const ve=Z[ie];v.format!==Ft?ye!==null?ze?t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie,0,0,ve.width,ve.height,ye,ve.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie,he,ve.width,ve.height,0,ve.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ze?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie,0,0,ve.width,ve.height,ye,_e,ve.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie,he,ve.width,ve.height,0,ye,_e,ve.data)}}}else{Z=v.mipmaps,ze&&R&&(Z.length>0&&ce++,t.texStorage2D(s.TEXTURE_CUBE_MAP,ce,he,$[0].width,$[0].height));for(let G=0;G<6;G++)if(We){ze?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,0,0,$[G].width,$[G].height,ye,_e,$[G].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,he,$[G].width,$[G].height,0,ye,_e,$[G].data);for(let ie=0;ie<Z.length;ie++){const Ve=Z[ie].image[G].image;ze?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie+1,0,0,Ve.width,Ve.height,ye,_e,Ve.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie+1,he,Ve.width,Ve.height,0,ye,_e,Ve.data)}}else{ze?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,0,0,ye,_e,$[G]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,he,ye,_e,$[G]);for(let ie=0;ie<Z.length;ie++){const ve=Z[ie];ze?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie+1,0,0,ye,_e,ve.image[G]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+G,ie+1,he,ye,_e,ve.image[G])}}}w(v,we)&&C(s.TEXTURE_CUBE_MAP),te.__version=K.version,v.onUpdate&&v.onUpdate(v)}y.__version=v.version}function De(y,v,U,ee,K,te){const de=r.convert(U.format,U.colorSpace),se=r.convert(U.type),oe=B(U.internalFormat,de,se,U.colorSpace);if(!n.get(v).__hasExternalTextures){const We=Math.max(1,v.width>>te),$=Math.max(1,v.height>>te);K===s.TEXTURE_3D||K===s.TEXTURE_2D_ARRAY?t.texImage3D(K,te,oe,We,$,v.depth,0,de,se,null):t.texImage2D(K,te,oe,We,$,0,de,se,null)}t.bindFramebuffer(s.FRAMEBUFFER,y),Ye(v)?d.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ee,K,n.get(U).__webglTexture,0,Ce(v)):(K===s.TEXTURE_2D||K>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,ee,K,n.get(U).__webglTexture,te),t.bindFramebuffer(s.FRAMEBUFFER,null)}function D(y,v,U){if(s.bindRenderbuffer(s.RENDERBUFFER,y),v.depthBuffer&&!v.stencilBuffer){let ee=o===!0?s.DEPTH_COMPONENT24:s.DEPTH_COMPONENT16;if(U||Ye(v)){const K=v.depthTexture;K&&K.isDepthTexture&&(K.type===cn?ee=s.DEPTH_COMPONENT32F:K.type===Sn&&(ee=s.DEPTH_COMPONENT24));const te=Ce(v);Ye(v)?d.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,te,ee,v.width,v.height):s.renderbufferStorageMultisample(s.RENDERBUFFER,te,ee,v.width,v.height)}else s.renderbufferStorage(s.RENDERBUFFER,ee,v.width,v.height);s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,y)}else if(v.depthBuffer&&v.stencilBuffer){const ee=Ce(v);U&&Ye(v)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,ee,s.DEPTH24_STENCIL8,v.width,v.height):Ye(v)?d.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ee,s.DEPTH24_STENCIL8,v.width,v.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,v.width,v.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,y)}else{const ee=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let K=0;K<ee.length;K++){const te=ee[K],de=r.convert(te.format,te.colorSpace),se=r.convert(te.type),oe=B(te.internalFormat,de,se,te.colorSpace),Se=Ce(v);U&&Ye(v)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,Se,oe,v.width,v.height):Ye(v)?d.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Se,oe,v.width,v.height):s.renderbufferStorage(s.RENDERBUFFER,oe,v.width,v.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}
3645function Mt(y,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(s.FRAMEBUFFER,y),!(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 ee=n.get(v.depthTexture).__webglTexture,K=Ce(v);if(v.depthTexture.format===zn)Ye(v)?d.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,ee,0,K):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,ee,0);else if(v.depthTexture.format===Mi)Ye(v)?d.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,ee,0,K):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,ee,0);else throw new Error("Unknown depthTexture format")}function ge(y){const v=n.get(y),U=y.isWebGLCubeRenderTarget===!0;if(y.depthTexture&&!v.__autoAllocateDepthBuffer){if(U)throw new Error("target.depthTexture not supported in Cube render targets");Mt(v.__webglFramebuffer,y)}else if(U){v.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)t.bindFramebuffer(s.FRAMEBUFFER,v.__webglFramebuffer[ee]),v.__webglDepthbuffer[ee]=s.createRenderbuffer(),D(v.__webglDepthbuffer[ee],y,!1)}else t.bindFramebuffer(s.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer=s.createRenderbuffer(),D(v.__webglDepthbuffer,y,!1);t.bindFramebuffer(s.FRAMEBUFFER,null)}function He(y,v,U){const ee=n.get(y);v!==void 0&&De(ee.__webglFramebuffer,y,y.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),U!==void 0&&ge(y)}function Me(y){const v=y.texture,U=n.get(y),ee=n.get(v);y.addEventListener("dispose",X),y.isWebGLMultipleRenderTargets!==!0&&(ee.__webglTexture===void 0&&(ee.__webglTexture=s.createTexture()),ee.__version=v.version,a.memory.textures++);const K=y.isWebGLCubeRenderTarget===!0,te=y.isWebGLMultipleRenderTargets===!0,de=T(y)||o;if(K){U.__webglFramebuffer=[];for(let se=0;se<6;se++)if(o&&v.mipmaps&&v.mipmaps.length>0){U.__webglFramebuffer[se]=[];for(let oe=0;oe<v.mipmaps.length;oe++)U.__webglFramebuffer[se][oe]=s.createFramebuffer()}else U.__webglFramebuffer[se]=s.createFramebuffer()}else{if(o&&v.mipmaps&&v.mipmaps.length>0){U.__webglFramebuffer=[];for(let se=0;se<v.mipmaps.length;se++)U.__webglFramebuffer[se]=s.createFramebuffer()}else U.__webglFramebuffer=s.createFramebuffer();if(te)if(i.drawBuffers){const se=y.texture;for(let oe=0,Se=se.length;oe<Se;oe++){const We=n.get(se[oe]);We.__webglTexture===void 0&&(We.__webglTexture=s.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&y.samples>0&&Ye(y)===!1){const se=te?v:[v];U.__webglMultisampledFramebuffer=s.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let oe=0;oe<se.length;oe++){const Se=se[oe];U.__webglColorRenderbuffer[oe]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,U.__webglColorRenderbuffer[oe]);const We=r.convert(Se.format,Se.colorSpace),$=r.convert(Se.type),je=B(Se.internalFormat,We,$,Se.colorSpace,y.isXRRenderTarget===!0),we=Ce(y);s.renderbufferStorageMultisample(s.RENDERBUFFER,we,je,y.width,y.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+oe,s.RENDERBUFFER,U.__webglColorRenderbuffer[oe])}s.bindRenderbuffer(s.RENDERBUFFER,null),y.depthBuffer&&(U.__webglDepthRenderbuffer=s.createRenderbuffer(),D(U.__webglDepthRenderbuffer,y,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(K){t.bindTexture(s.TEXTURE_CUBE_MAP,ee.__webglTexture),me(s.TEXTURE_CUBE_MAP,v,de);for(let se=0;se<6;se++)if(o&&v.mipmaps&&v.mipmaps.length>0)for(let oe=0;oe<v.mipmaps.length;oe++)De(U.__webglFramebuffer[se][oe],y,v,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+se,oe);else De(U.__webglFramebuffer[se],y,v,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+se,0);w(v,de)&&C(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(te){const se=y.texture;for(let oe=0,Se=se.length;oe<Se;oe++){const We=se[oe],$=n.get(We);t.bindTexture(s.TEXTURE_2D,$.__webglTexture),me(s.TEXTURE_2D,We,de),De(U.__webglFramebuffer,y,We,s.COLOR_ATTACHMENT0+oe,s.TEXTURE_2D,0),w(We,de)&&C(s.TEXTURE_2D)}t.unbindTexture()}else{let se=s.TEXTURE_2D;
3645if((y.isWebGL3DRenderTarget||y.isWebGLArrayRenderTarget)&&(o?se=y.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(se,ee.__webglTexture),me(se,v,de),o&&v.mipmaps&&v.mipmaps.length>0)for(let oe=0;oe<v.mipmaps.length;oe++)De(U.__webglFramebuffer[oe],y,v,s.COLOR_ATTACHMENT0,se,oe);else De(U.__webglFramebuffer,y,v,s.COLOR_ATTACHMENT0,se,0);w(v,de)&&C(se),t.unbindTexture()}y.depthBuffer&&ge(y)}function Qe(y){const v=T(y)||o,U=y.isWebGLMultipleRenderTargets===!0?y.texture:[y.texture];for(let ee=0,K=U.length;ee<K;ee++){const te=U[ee];if(w(te,v)){const de=y.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,se=n.get(te).__webglTexture;t.bindTexture(de,se),C(de),t.unbindTexture()}}}function Ne(y){if(o&&y.samples>0&&Ye(y)===!1){const v=y.isWebGLMultipleRenderTargets?y.texture:[y.texture],U=y.width,ee=y.height;let K=s.COLOR_BUFFER_BIT;const te=[],de=y.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,se=n.get(y),oe=y.isWebGLMultipleRenderTargets===!0;if(oe)for(let Se=0;Se<v.length;Se++)t.bindFramebuffer(s.FRAMEBUFFER,se.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Se,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,se.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Se,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,se.__webglMultisampledFramebuffer),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,se.__webglFramebuffer);for(let Se=0;Se<v.length;Se++){te.push(s.COLOR_ATTACHMENT0+Se),y.depthBuffer&&te.push(de);const We=se.__ignoreDepthValues!==void 0?se.__ignoreDepthValues:!1;if(We===!1&&(y.depthBuffer&&(K|=s.DEPTH_BUFFER_BIT),y.stencilBuffer&&(K|=s.STENCIL_BUFFER_BIT)),oe&&s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,se.__webglColorRenderbuffer[Se]),We===!0&&(s.invalidateFramebuffer(s.READ_FRAMEBUFFER,[de]),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[de])),oe){const $=n.get(v[Se]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,$,0)}s.blitFramebuffer(0,0,U,ee,0,0,U,ee,K,s.NEAREST),p&&s.invalidateFramebuffer(s.READ_FRAMEBUFFER,te)}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),oe)for(let Se=0;Se<v.length;Se++){t.bindFramebuffer(s.FRAMEBUFFER,se.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Se,s.RENDERBUFFER,se.__webglColorRenderbuffer[Se]);const We=n.get(v[Se]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,se.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Se,s.TEXTURE_2D,We,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,se.__webglMultisampledFramebuffer)}}function Ce(y){return Math.min(u,y.samples)}function Ye(y){const v=n.get(y);return o&&y.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function dt(y){const v=a.render.frame;g.get(y)!==v&&(g.set(y,v),y.update())}function ft(y,v){const U=y.colorSpace,ee=y.format,K=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||y.format===Gr||U!==mt&&U!==Ot&&(qe.getTransfer(U)===Je?o===!1?e.has("EXT_sRGB")===!0&&ee===Ft?(y.format=Gr,y.minFilter=wt,y.generateMipmaps=!1):v=Ac.sRGBToLinear(v):(ee!==Ft||K!==Tn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),v}this.allocateTextureUnit=ne,this.resetTextureUnits=V,this.setTexture2D=j,this.setTexture2DArray=Q,this.setTexture3D=ue,this.setTextureCube=z,this.rebindTextures=He,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=Qe,this.updateMultisampleRenderTarget=Ne,this.setupDepthRenderbuffer=ge,this.setupFrameBufferTexture=De,this.useMultisampledRTT=Ye}function Im(s,e,t){const n=t.isWebGL2;function i(r,a=Ot){let o;const c=qe.getTransfer(a);if(r===Tn)return s.UNSIGNED_BYTE;if(r===pc)return s.UNSIGNED_SHORT_4_4_4_4;if(r===mc)return s.UNSIGNED_SHORT_5_5_5_1;if(r===Kl)return s.BYTE;if(r===Zl)return s.SHORT;if(r===$r)return s.UNSIGNED_SHORT;if(r===fc)return s.INT;if(r===Sn)return s.UNSIGNED_INT;if(r===cn)return s.FLOAT;if(r===qi)return n?s.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(r===$l)return s.ALPHA;if(r===Ft)return s.RGBA;if(r===Jl)return s.LUMINANCE;if(r===Ql)return s.LUMINANCE_ALPHA;if(r===zn)return s.DEPTH_COMPONENT;if(r===Mi)return s.DEPTH_STENCIL;if(r===Gr)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(r===eh)return s.RED;if(r===gc)return s.RED_INTEGER;if(r===th)return s.RG;if(r===_c)return s.RG_INTEGER;if(r===xc)return s.RGBA_INTEGER;if(r===$s||r===Js||r===Qs||r===er)if(c===Je)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(r===$s)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Js)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Qs)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===er)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(r===$s)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Js)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Qs)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===er)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===ba||r===wa||r===Ra||r===Ca)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(r===ba)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===wa)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Ra)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Ca)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===vc)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===La||r===Pa)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(r===La)return c===Je?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(r===Pa)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Ia||r===Da||r===Ua||r===Na||r===Fa||r===Oa||r===Ba||r===Ha||r===za||r===Ga||r===ka||r===Va||r===Wa||r===Xa)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(r===Ia)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Da)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Ua)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Na)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;
vendor: 17,283 bytes, line 3645
3645if(r===Fa)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Oa)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ba)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Ha)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===za)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Ga)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===ka)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Va)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Wa)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Xa)return c===Je?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===tr||r===qa||r===Ya)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(r===tr)return c===Je?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===qa)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===Ya)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===nh||r===ja||r===Ka||r===Za)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(r===tr)return o.COMPRESSED_RED_RGTC1_EXT;if(r===ja)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Ka)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Za)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Hn?n?s.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):s[r]!==void 0?s[r]:null}return{convert:i}}class Dm extends At{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Bn extends tt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Um={type:"move"};class Ar{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bn,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 Bn,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 Bn,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 i=null,r=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),f=this._getHandJoint(l,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),p=.02,g=.005;l.inputState.pinching&&d>p+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=p-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Um)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Bn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Nm extends qn{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,p=null,g=null;const _=t.getContextAttributes();let m=null,f=null;const E=[],x=[],T=new ke;let A=null;const w=new At;w.layers.enable(1),w.viewport=new Ze;const C=new At;C.layers.enable(2),C.viewport=new Ze;const B=[w,C],M=new Dm;M.layers.enable(1),M.layers.enable(2);let b=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let Y=E[z];return Y===void 0&&(Y=new Ar,E[z]=Y),Y.getTargetRaySpace()},this.getControllerGrip=function(z){let Y=E[z];return Y===void 0&&(Y=new Ar,E[z]=Y),Y.getGripSpace()},this.getHand=function(z){let Y=E[z];return Y===void 0&&(Y=new Ar,E[z]=Y),Y.getHandSpace()};function X(z){const Y=x.indexOf(z.inputSource);if(Y===-1)return;const ae=E[Y];ae!==void 0&&(ae.update(z.inputSource,z.frame,l||a),ae.dispatchEvent({type:z.type,data:z.inputSource}))}function J(){i.removeEventListener("select",X),i.removeEventListener("selectstart",X),i.removeEventListener("selectend",X),i.removeEventListener("squeeze",X),i.removeEventListener("squeezestart",X),i.removeEventListener("squeezeend",X),i.removeEventListener("end",J),i.removeEventListener("inputsourceschange",P);for(let z=0;z<E.length;z++){const Y=x[z];Y!==null&&(x[z]=null,E[z].disconnect(Y))}b=null,k=null,e.setRenderTarget(m),p=null,d=null,u=null,i=null,f=null,ue.stop(),n.isPresenting=!1,e.setPixelRatio(A),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){r=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){o=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(z){l=z},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(z){if(i=z,i!==null){if(m=e.getRenderTarget(),i.addEventListener("select",X),i.addEventListener("selectstart",X),i.addEventListener("selectend",X),i.addEventListener("squeeze",X),i.addEventListener("squeezestart",X),i.addEventListener("squeezeend",X),i.addEventListener("end",J),i.addEventListener("inputsourceschange",P),_.xrCompatible!==!0&&await t.makeXRCompatible(),A=e.getPixelRatio(),e.getSize(T),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const Y={antialias:i.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,Y),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),f=new Vn(p.framebufferWidth,p.framebufferHeight,{format:Ft,type:Tn,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})}else{let Y=null,ae=null,pe=null;_.depth&&(pe=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Y=_.stencil?Mi:zn,ae=_.stencil?Hn:Sn);const me={colorFormat:t.RGBA8,depthFormat:pe,scaleFactor:r};u=new XRWebGLBinding(i,t),d=u.createProjectionLayer(me),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),f=new Vn(d.textureWidth,d.textureHeight,{format:Ft,type:Tn,depthTexture:new Fc(d.textureWidth,d.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,Y),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0});const Pe=e.properties.get(f);Pe.__ignoreDepthValues=d.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),ue.setContext(i),ue.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function P(z){for(let Y=0;Y<z.removed.length;Y++){const ae=z.removed[Y],pe=x.indexOf(ae);pe>=0&&(x[pe]=null,E[pe].disconnect(ae))}for(let Y=0;Y<z.added.length;Y++){const ae=z.added[Y];let pe=x.indexOf(ae);if(pe===-1){for(let Pe=0;Pe<E.length;Pe++)if(Pe>=x.length){x.push(ae),pe=Pe;break}else if(x[Pe]===null){x[Pe]=ae,pe=Pe;break}if(pe===-1)break}const me=E[pe];me&&me.connect(ae)}}const H=new L,q=new L;function V(z,Y,ae){H.setFromMatrixPosition(Y.matrixWorld),q.setFromMatrixPosition(ae.matrixWorld);const pe=H.distanceTo(q),me=Y.projectionMatrix.elements,Pe=ae.projectionMatrix.elements,be=me[14]/(me[10]-1),Te=me[14]/(me[10]+1),De=(me[9]+1)/me[5],D=(me[9]-1)/me[5],Mt=(me[8]-1)/me[0],ge=(Pe[8]+1)/Pe[0],He=be*Mt,Me=be*ge,Qe=pe/(-Mt+ge),Ne=Qe*-Mt;Y.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(Ne),z.translateZ(Qe),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert();const Ce=be+Qe,Ye=Te+Qe,dt=He-Ne,ft=Me+(pe-Ne),y=De*Te/Ye*Ce,v=D*Te/Ye*Ce;z.projectionMatrix.makePerspective(dt,ft,y,v,Ce,Ye),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}function ne(z,Y){Y===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices(Y.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(i===null)return;M.near=C.near=w.near=z.near,M.far=C.far=w.far=z.far,(b!==M.near||k!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,k=M.far);const Y=z.parent,ae=M.cameras;ne(M,Y);for(let pe=0;pe<ae.length;pe++)ne(ae[pe],Y);ae.length===2?V(M,w,C):M.projectionMatrix.copy(w.projectionMatrix),W(z,M,Y)};function W(z,Y,ae){ae===null?z.matrix.copy(Y.matrixWorld):(z.matrix.copy(ae.matrixWorld),z.matrix.invert(),z.matrix.multiply(Y.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy(Y.projectionMatrix),z.projectionMatrixInverse.copy(Y.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=yi*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(z){c=z,d!==null&&(d.fixedFoveation=z),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=z)};let j=null;function Q(z,Y){if(h=Y.getViewerPose(l||a),g=Y,h!==null){const ae=h.views;p!==null&&(e.setRenderTargetFramebuffer(f,p.framebuffer),e.setRenderTarget(f));let pe=!1;ae.length!==M.cameras.length&&(M.cameras.length=0,pe=!0);for(let me=0;me<ae.length;me++){const Pe=ae[me];let be=null;if(p!==null)be=p.getViewport(Pe);else{const De=u.getViewSubImage(d,Pe);be=De.viewport,me===0&&(e.setRenderTargetTextures(f,De.colorTexture,d.ignoreDepthValues?void 0:De.depthStencilTexture),e.setRenderTarget(f))}let Te=B[me];Te===void 0&&(Te=new At,Te.layers.enable(me),Te.viewport=new Ze,B[me]=Te),Te.matrix.fromArray(Pe.transform.matrix),Te.matrix.decompose(Te.position,Te.quaternion,Te.scale),Te.projectionMatrix.fromArray(Pe.projectionMatrix),Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert(),Te.viewport.set(be.x,be.y,be.width,be.height),me===0&&(M.matrix.copy(Te.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),pe===!0&&M.cameras.push(Te)}}for(let ae=0;ae<E.length;ae++){const pe=x[ae],me=E[ae];pe!==null&&me!==void 0&&me.update(pe,Y,l||a)}j&&j(z,Y),Y.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Y}),g=null}const ue=new Nc;ue.setAnimationLoop(Q),this.setAnimationLoop=function(z){j=z},this.dispose=function(){}}}function Fm(s,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Ic(s)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,E,x,T){f.isMeshBasicMaterial||f.isMeshLambertMaterial?r(m,f):f.isMeshToonMaterial?(r(m,f),u(m,f)):f.isMeshPhongMaterial?(r(m,f),h(m,f)):f.isMeshStandardMaterial?(r(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,T)):f.isMeshMatcapMaterial?(r(m,f),g(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),_(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?c(m,f,E,x):f.isSpriteMaterial?l(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Rt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Rt&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const E=e.get(f).envMap;if(E&&(m.envMap.value=E,m.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const x=s._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*x,t(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function c(m,f,E,x){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*E,m.scale.value=x*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,E){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Rt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.
3645iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const E=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Om(s,e,t,n){let i={},r={},a=[];const o=t.isWebGL2?s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(E,x){const T=x.program;n.uniformBlockBinding(E,T)}function l(E,x){let T=i[E.id];T===void 0&&(g(E),T=h(E),i[E.id]=T,E.addEventListener("dispose",m));const A=x.program;n.updateUBOMapping(E,A);const w=e.render.frame;r[E.id]!==w&&(d(E),r[E.id]=w)}function h(E){const x=u();E.__bindingPointIndex=x;const T=s.createBuffer(),A=E.__size,w=E.usage;return s.bindBuffer(s.UNIFORM_BUFFER,T),s.bufferData(s.UNIFORM_BUFFER,A,w),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,x,T),T}function u(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(E){const x=i[E.id],T=E.uniforms,A=E.__cache;s.bindBuffer(s.UNIFORM_BUFFER,x);for(let w=0,C=T.length;w<C;w++){const B=T[w];if(p(B,w,A)===!0){const M=B.__offset,b=Array.isArray(B.value)?B.value:[B.value];let k=0;for(let X=0;X<b.length;X++){const J=b[X],P=_(J);typeof J=="number"?(B.__data[0]=J,s.bufferSubData(s.UNIFORM_BUFFER,M+k,B.__data)):J.isMatrix3?(B.__data[0]=J.elements[0],B.__data[1]=J.elements[1],B.__data[2]=J.elements[2],B.__data[3]=J.elements[0],B.__data[4]=J.elements[3],B.__data[5]=J.elements[4],B.__data[6]=J.elements[5],B.__data[7]=J.elements[0],B.__data[8]=J.elements[6],B.__data[9]=J.elements[7],B.__data[10]=J.elements[8],B.__data[11]=J.elements[0]):(J.toArray(B.__data,k),k+=P.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,M,B.__data)}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(E,x,T){const A=E.value;if(T[x]===void 0){if(typeof A=="number")T[x]=A;else{const w=Array.isArray(A)?A:[A],C=[];for(let B=0;B<w.length;B++)C.push(w[B].clone());T[x]=C}return!0}else if(typeof A=="number"){if(T[x]!==A)return T[x]=A,!0}else{const w=Array.isArray(T[x])?T[x]:[T[x]],C=Array.isArray(A)?A:[A];for(let B=0;B<w.length;B++){const M=w[B];if(M.equals(C[B])===!1)return M.copy(C[B]),!0}}return!1}function g(E){const x=E.uniforms;let T=0;const A=16;let w=0;for(let C=0,B=x.length;C<B;C++){const M=x[C],b={boundary:0,storage:0},k=Array.isArray(M.value)?M.value:[M.value];for(let X=0,J=k.length;X<J;X++){const P=k[X],H=_(P);b.boundary+=H.boundary,b.storage+=H.storage}if(M.__data=new Float32Array(b.storage/Float32Array.BYTES_PER_ELEMENT),M.__offset=T,C>0){w=T%A;const X=A-w;w!==0&&X-b.boundary<0&&(T+=A-w,M.__offset=T)}T+=b.storage}return w=T%A,w>0&&(T+=A-w),E.__size=T,E.__cache={},this}function _(E){const x={boundary:0,storage:0};return typeof E=="number"?(x.boundary=4,x.storage=4):E.isVector2?(x.boundary=8,x.storage=8):E.isVector3||E.isColor?(x.boundary=16,x.storage=12):E.isVector4?(x.boundary=16,x.storage=16):E.isMatrix3?(x.boundary=48,x.storage=48):E.isMatrix4?(x.boundary=64,x.storage=64):E.isTexture?c
3645onsole.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),x}function m(E){const x=E.target;x.removeEventListener("dispose",m);const T=a.indexOf(x.__bindingPointIndex);a.splice(T,1),s.deleteBuffer(i[x.id]),delete i[x.id],delete r[x.id]}function f(){for(const E in i)s.deleteBuffer(i[E]);a=[],i={},r={}}return{bind:c,update:l,dispose:f}}class kc{constructor(e={}){const{canvas:t=Dh(),context:n=null,depth:i=!0,stencil:r=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let d;n!==null?d=n.getContextAttributes().alpha:d=a;const p=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const f=[],E=[];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=it,this._useLegacyLights=!1,this.toneMapping=En,this.toneMappingExposure=1;const x=this;let T=!1,A=0,w=0,C=null,B=-1,M=null;const b=new Ze,k=new Ze;let X=null;const J=new Ae(0);let P=0,H=t.width,q=t.height,V=1,ne=null,W=null;const j=new Ze(0,0,H,q),Q=new Ze(0,0,H,q);let ue=!1;const z=new ta;let Y=!1,ae=!1,pe=null;const me=new Be,Pe=new ke,be=new L,Te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function De(){return C===null?V:1}let D=n;function Mt(S,I){for(let F=0;F<S.length;F++){const O=S[F],N=t.getContext(O,I);if(N!==null)return N}return null}try{const S={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zr}`),t.addEventListener("webglcontextlost",ze,!1),t.addEventListener("webglcontextrestored",R,!1),t.addEventListener("webglcontextcreationerror",ce,!1),D===null){const I=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&I.shift(),D=Mt(I,S),D===null)throw Mt(I)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&D instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),D.getShaderPrecisionFormat===void 0&&(D.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let ge,He,Me,Qe,Ne,Ce,Ye,dt,ft,y,v,U,ee,K,te,de,se,oe,Se,We,$,je,we,ye;function _e(){ge=new jf(D),He=new kf(D,ge,e),ge.init(He),je=new Im(D,ge,He),Me=new Lm(D,ge,He),Qe=new $f(D),Ne=new gm,Ce=new Pm(D,ge,Me,Ne,He,je,Qe),Ye=new Wf(x),dt=new Yf(x),ft=new su(D,He),we=new zf(D,ge,ft,He),y=new Kf(D,ft,Qe,we),v=new tp(D,y,ft,Qe),Se=new ep(D,He,Ce),de=new Vf(Ne),U=new mm(x,Ye,dt,ge,He,we,de),ee=new Fm(x,Ne),K=new xm,te=new Tm(ge,He),oe=new Hf(x,Ye,dt,Me,v,d,c),se=new Cm(x,v,He),ye=new Om(D,Qe,He,Me),We=new Gf(D,ge,Qe,He),$=new Zf(D,ge,Qe,He),Qe.programs=U.programs,x.capabilities=He,x.extensions=ge,x.properties=Ne,x.renderLists=K,x.shadowMap=se,x.state=Me,x.info=Qe}_e();const he=new Nm(x,D);this.xr=he,this.getContext=function(){return D},this.getContextAttributes=function(){return D.getContextAttributes()},this.forceContextLoss=function(){const S=ge.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=ge.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(S){S!==void 0&&(V=S,this.setSize(H,q,!1))},this.getSize=function(S){return S.set(H,q)},this.setSize=function(S,I,F=!0){if(he.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=S,q=I,t.width=Math.floor(S*V),t.height=Math.floor(I*V),F===!0&&(t.style.width=S+"px",t.style.height=I+"px"),this.setViewport(0,0,S,I)},this.getDrawingBufferSize=function(S){return S.set(H*V,q*V).floor()},this.setDrawingBufferSize=function(S,I,F){H=S,q=I,V=F,t.width=Math.floor(S*F),t.height=Math.floor(I*F),this.setViewport(0,0,S,I)},this.getCurrentViewport=function(S){return S.copy(b)},this.getViewport=function(S){return S.copy(j)},this.setViewport=function(S,I,F,O){S.isVector4?j.set(S.x,S.y,S.z,S.w):j.set(S,I,F,O),Me.viewport(b.copy(j).multiplyScalar(V).floor())}
vendor: 17,676 bytes, line 3645
3645,this.getScissor=function(S){return S.copy(Q)},this.setScissor=function(S,I,F,O){S.isVector4?Q.set(S.x,S.y,S.z,S.w):Q.set(S,I,F,O),Me.scissor(k.copy(Q).multiplyScalar(V).floor())},this.getScissorTest=function(){return ue},this.setScissorTest=function(S){Me.setScissorTest(ue=S)},this.setOpaqueSort=function(S){ne=S},this.setTransparentSort=function(S){W=S},this.getClearColor=function(S){return S.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor.apply(oe,arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha.apply(oe,arguments)},this.clear=function(S=!0,I=!0,F=!0){let O=0;if(S){let N=!1;if(C!==null){const le=C.texture.format;N=le===xc||le===_c||le===gc}if(N){const le=C.texture.type,fe=le===Tn||le===Sn||le===$r||le===Hn||le===pc||le===mc,xe=oe.getClearColor(),Ee=oe.getClearAlpha(),Ue=xe.r,Re=xe.g,Le=xe.b;fe?(p[0]=Ue,p[1]=Re,p[2]=Le,p[3]=Ee,D.clearBufferuiv(D.COLOR,0,p)):(g[0]=Ue,g[1]=Re,g[2]=Le,g[3]=Ee,D.clearBufferiv(D.COLOR,0,g))}else O|=D.COLOR_BUFFER_BIT}I&&(O|=D.DEPTH_BUFFER_BIT),F&&(O|=D.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),D.clear(O)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ze,!1),t.removeEventListener("webglcontextrestored",R,!1),t.removeEventListener("webglcontextcreationerror",ce,!1),K.dispose(),te.dispose(),Ne.dispose(),Ye.dispose(),dt.dispose(),v.dispose(),we.dispose(),ye.dispose(),U.dispose(),he.dispose(),he.removeEventListener("sessionstart",St),he.removeEventListener("sessionend",$e),pe&&(pe.dispose(),pe=null),yt.stop()};function ze(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function R(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const S=Qe.autoReset,I=se.enabled,F=se.autoUpdate,O=se.needsUpdate,N=se.type;_e(),Qe.autoReset=S,se.enabled=I,se.autoUpdate=F,se.needsUpdate=O,se.type=N}function ce(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Z(S){const I=S.target;I.removeEventListener("dispose",Z),G(I)}function G(S){ie(S),Ne.remove(S)}function ie(S){const I=Ne.get(S).programs;I!==void 0&&(I.forEach(function(F){U.releaseProgram(F)}),S.isShaderMaterial&&U.releaseShaderCache(S))}this.renderBufferDirect=function(S,I,F,O,N,le){I===null&&(I=Te);const fe=N.isMesh&&N.matrixWorld.determinant()<0,xe=Qc(S,I,F,O,N);Me.setMaterial(O,fe);let Ee=F.index,Ue=1;if(O.wireframe===!0){if(Ee=y.getWireframeAttribute(F),Ee===void 0)return;Ue=2}const Re=F.drawRange,Le=F.attributes.position;let st=Re.start*Ue,Ct=(Re.start+Re.count)*Ue;le!==null&&(st=Math.max(st,le.start*Ue),Ct=Math.min(Ct,(le.start+le.count)*Ue)),Ee!==null?(st=Math.max(st,0),Ct=Math.min(Ct,Ee.count)):Le!=null&&(st=Math.max(st,0),Ct=Math.min(Ct,Le.count));const lt=Ct-st;if(lt<0||lt===1/0)return;we.setup(N,O,xe,F,Ee);let Qt,et=We;if(Ee!==null&&(Qt=ft.get(Ee),et=$,et.setIndex(Qt)),N.isMesh)O.wireframe===!0?(Me.setLineWidth(O.wireframeLinewidth*De()),et.setMode(D.LINES)):et.setMode(D.TRIANGLES);else if(N.isLine){let Fe=O.linewidth;Fe===void 0&&(Fe=1),Me.setLineWidth(Fe*De()),N.isLineSegments?et.setMode(D.LINES):N.isLineLoop?et.setMode(D.LINE_LOOP):et.setMode(D.LINE_STRIP)}else N.isPoints?et.setMode(D.POINTS):N.isSprite&&et.setMode(D.TRIANGLES);if(N.isBatchedMesh)et.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else if(N.isInstancedMesh)et.renderInstances(st,lt,N.count);else if(F.isInstancedBufferGeometry){const Fe=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,Ws=Math.min(F.instanceCount,Fe);et.renderInstances(st,lt,Ws)}else et.render(st,lt)};function ve(S,I,F){S.transparent===!0&&S.side===Yt&&S.forceSinglePass===!1?(S.side=Rt,S.needsUpdate=!0,Ji(S,I,F),S.side=un,S.needsUpdate=!0,Ji(S,I,F),S.side=Yt):Ji(S,I,F)}this.compile=function(S,I,F=null){F===null&&(F=S),m=te.get(F),m.init(),E.push(m),F.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(m.pushLight(N),N.castShadow&&m.pushShadow(N))}),S!==F&&S.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(m.pushLight(N),N.castShadow&&m.pushShadow(N))}),m.setupLights(x._useLegacyLights);const O=new Set;return S.traverse(function(N){const le=N.material;if(le)if(Array.isArray(le))for(let fe=0;fe<le.length;fe++){const xe=le[fe];ve(xe,F,N),O.add(xe)}else ve(le,F,N),O.add(le)}),E.pop(),m=null,O},this.compileAsync=function(S,I,F=null){const O=this.compile(S,I,F);return new Promise(N=>{function le(){if(O.forEach(function(fe){Ne.get(fe).currentProgram.isReady()&&O.delete(fe)}),O.size===0){N(S);return}setTimeout(le,10)}ge.get("KHR_parallel_shader_compile")!==null?le():setTimeout(le,10)})};let Ve=null;function ct(S){Ve&&Ve(S)}function St(){yt.stop()}function $e(){yt.start()}const yt=new Nc;yt.setAnimationLoop(ct),typeof self<"u"&&yt.setContext(self),this.setAnimationLoop=function(S){Ve=S,he.setAnimationLoop(S),S===null?yt.stop():yt.start()},he.addEventListener("sessionstart",St),he.addEventListener("sessionend",$e),this.render=function(S,I){if(I!==void 0&&I.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),he.enabled===!0&&he.isPresenting===!0&&(he.cameraAutoUpdate===!0&&he.updateCamera(I),I=he.getCamera()),S.isScene===!0&&S.onBeforeRender(x,S,I,C),m=te.get(S,E.length),m.init(),E.push(m),me.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),z.setFromProjectionMatrix(me),ae=this.localClippingEnabled,Y=de.init(this.clippingPlanes,ae),_=K.get(S,f.length),_.init(),f.push(_),Xt(S,I,0,x.sortObjects),_.finish(),x.sortObjects===!0&&_.sort(ne,W),this.info.render.frame++,Y===!0&&de.beginShadows();const F=m.state.shadowsArray;if(se.render(F,S,I),Y===!0&&de.endShadows(),this.info.autoReset===!0&&this.info.reset(),oe.render(_,S),m.setupLights(x._useLegacyLights),I.isArrayCamera){const O=I.cameras;for(let N=0,le=O.length;N<le;N++){const fe=O[N];da(_,S,fe,fe.viewport)}}else da(_,S,I);C!==null&&(Ce.updateMultisampleRenderTarget(C),Ce.updateRenderTargetMipmap(C)),S.isScene===!0&&S.onAfterRender(x,S,I),we.resetDefaultState(),B=-1,M=null,E.pop(),E.length>0?m=E[E.length-1]:m=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function Xt(S,I,F,O){if(S.visible===!1)return;if(S.layers.test(I.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(I);else if(S.isLight)m.pushLight(S),S.castShadow&&m.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||z.intersectsSprite(S)){O&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(me);const fe=v.update(S),xe=S.material;xe.visible&&_.push(S,fe,xe,F,be.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||z.intersectsObject(S))){const fe=v.update(S),xe=S.material;if(O&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),be.copy(S.boundingSphere.center)):(fe.boundingSphere===null&&fe.computeBoundingSphere(),be.copy(fe.boundingSphere.center)),be.applyMatrix4(S.matrixWorld).applyMatrix4(me)),Array.isArray(xe)){const Ee=fe.groups;for(let Ue=0,Re=Ee.length;Ue<Re;Ue++){const Le=Ee[Ue],st=xe[Le.materialIndex];st&&st.visible&&_.push(S,fe,st,F,be.z,Le)}}else xe.visible&&_.push(S,fe,xe,F,be.z,null)}}const le=S.children;for(let fe=0,xe=le.length;fe<xe;fe++)Xt(le[fe],I,F,O)}function da(S,I,F,O){const N=S.opaque,le=S.transmissive,fe=S.transparent;m.setupLightsView(F),Y===!0&&de.setGlobalState(x.clippingPlanes,F),le.length>0&&Jc(N,le,I,F),O&&Me.viewport(b.copy(O)),N.length>0&&$i(N,I,F),le.length>0&&$i(le,I,F),fe.length>0&&$i(fe,I,F),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function Jc(S,I,F,O){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;const le=He.isWebGL2;pe===null&&(pe=new Vn(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")?qi:Tn,minFilter:kn,samples:le?4:0})),x.getDrawingBufferSize(Pe),le?pe.setSize(Pe.x,Pe.y):pe.setSize(Os(Pe.x),Os(Pe.y));const fe=x.getRenderTarget();x.setRenderTarget(pe),x.getClearColor(J),P=x.getClearAlpha(),P<1&&x.setClearColor(16777215,.5),x.clear();const xe=x.toneMapping;x.toneMapping=En,$i(S,F,O),Ce.updateMultisampleRenderTarget(pe),Ce.updateRenderTargetMipmap(pe);let Ee=!1;for(let Ue=0,Re=I.length;Ue<Re;Ue++){const Le=I[Ue],st=Le.object,Ct=Le.geometry,lt=Le.material,Qt=Le.group;if(lt.side===Yt&&st.layers.test(O.layers)){const et=lt.side;lt.side=Rt,lt.needsUpdate=!0,fa(st,F,O,Ct,lt,Qt),lt.side=et,lt.needsUpdate=!0,Ee=!0}}Ee===!0&&(Ce.updateMultisampleRenderTarget(pe),Ce.updateRenderTargetMipmap(pe)),x.setRenderTarget(fe),x.setClearColor(J,P),x.toneMapping=xe}function $i(S,I,F){const O=I.isScene===!0?I.overrideMaterial:null;for(let N=0,le=S.length;N<le;N++){const fe=S[N],xe=fe.object,Ee=fe.geometry,Ue=O===null?fe.material:O,Re=fe.group;xe.layers.test(F.layers)&&fa(xe,I,F,Ee,Ue,Re)}}function fa(S,I,F,O,N,le){S.onBeforeRender(x,I,F,O,N,le),S.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),N.onBeforeRender(x,I,F,O,S,le),N.transparent===!0&&N.side===Yt&&N.forceSinglePass===!1?(N.side=Rt,N.needsUpdate=!0,x.renderBufferDirect(F,I,O,N,S,le),N.side=un,N.needsUpdate=!0,x.renderBufferDirect(F,I,O,N,S,le),N.side=Yt):x.renderBufferDirect(F,I,O,N,S,le),S.onAfterRender(x,I,F,O,N,le)}function Ji(S,I,F){I.isScene!==!0&&(I=Te);const O=Ne.get(S),N=m.state.lights,le=m.state.shadowsArray,fe=N.state.version,xe=U.getParameters(S,N.state,le,I,F),Ee=U.getProgramCacheKey(xe);let Ue=O.programs;O.environment=S.isMeshStandardMaterial?I.environment:null,O.fog=I.fog,O.envMap=(S.isMeshStandardMaterial?dt:Ye).get(S.envMap||O.environment),Ue===void 0&&(S.addEventListener("dispose",Z),Ue=new Map,O.programs=Ue);let Re=Ue.get(Ee);if(Re!==void 0){if(O.currentProgram===Re&&O.lightsStateVersion===fe)return ma(S,xe),Re}else xe.uniforms=U.getUniforms(S),S.onBuild(F,xe,x),S.onBeforeCompile(xe,x),Re=U.acquireProgram(xe,Ee),Ue.set(Ee,Re),O.uniforms=xe.uniforms;const Le=O.uniforms;return(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Le.clippingPlanes=de.uniform),ma(S,xe),O.needsLights=tl(S),O.lightsStateVersion=fe,O.needsLights&&(Le.ambientLightColor.value=N.state.ambient,Le.lightProbe.value=N.state.probe,Le.directionalLights.value=N.state.directional,Le.directionalLightShadows.value=N.state.directionalShadow,Le.spotLights.value=N.state.spot,Le.spotLightShadows.value=N.state.spotShadow,Le.rectAreaLights.value=N.state.rectArea,Le.ltc_1.value=N.state.rectAreaLTC1,Le.ltc_2.value=N.state.rectAreaLTC2,Le.pointLights.value=N.state.point,Le.pointLightShadows.value=N.state.pointShadow,Le.hemisphereLights.value=N.state.hemi,Le.directionalShadowMap.value=N.state.directionalShadowMap,Le.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Le.spotShadowMap.value=N.state.spotShadowMap,Le.spotLightMatrix.value=N.state.spotLightMatrix,Le.spotLightMap.value=N.state.spotLightMap,Le.pointShadowMap.value=N.state.pointShadowMap,Le.pointShadowMatrix.value=N.state.pointShadowMatrix),O.currentProgram=Re,O.uniformsList=null,Re}function pa(S){if(S.uniformsList===null){const I=S.currentProgram.getUniforms();S.uniformsList=Cs.seqWithValue(I.seq,S.uniforms)}return S.uniformsList}function ma(S,I){const F=Ne.get(S);F.outputColorSpace=I.outputColorSpace,F.batching=I.batching,F.instancing=I.instancing,F.instancingColor=I.instancingColor,F.skinning=I.skinning,F.morphTargets=I.morphTargets,F.morphNormals=I.morphNormals,F.morphColors=I.morphColors,F.morphTargetsCount=I.morphTargetsCount,F.numClippingPlanes=I.numClippingPlanes,F.numIntersection=I.numClipIntersection,F.vertexAlphas=I.vertexAlphas,F.vertexTangents=I.vertexTangents,F.toneMapping=I.toneMapping}function Qc(S,I,F,O,N){I.isScene!==!0&&(I=Te),Ce.resetTextureUnits();const le=I.fog,fe=O.isMeshStandardMaterial?I.environment:null,xe=C===null?x.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:mt,Ee=(O.isMeshStandardMaterial?dt:Ye).get(O.envMap||fe),Ue=O.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,Re=!!F.attributes.tangent&&(!!O.normalMap||O.anisotropy>0),Le=!!F.morphAttributes.position,st=!!F.morphAttributes.normal,Ct=!!F.morphAttributes.color;let lt=En;O.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(lt=x.toneMapping);const Qt=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,et=Qt!==void 0?Qt.length:0,Fe=Ne.get(O),Ws=m.state.lights;if(Y===!0&&(ae===!0||S!==M)){const It=S===M&&O.id===B;de.setState(O,S,It)}let nt=!1;O.version===Fe.__version?(Fe.needsLights&&Fe.lightsStateVersion!==Ws.state.version||Fe.outputColorSpace!==xe||N.isBatchedMesh&&Fe.batching===!1||!N.isBatchedMesh&&Fe.batching===!0||N.isInstancedMesh&&Fe.instancing===!1||!N.isInstancedMesh&&Fe.instancing===!0||N.isSkinnedMesh&&Fe.skinning===!1||!N.isSkinnedMesh&&Fe.skinning===!0||N.isInstancedMesh&&Fe.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Fe.instancingColor===!1&&N.instanceColor!==null||Fe.envMap!==Ee||O.fog===!0&&Fe.fog!==le||Fe.numClippingPlanes!==void 0&&(Fe.numClippingPlanes!==de.numPlanes||Fe.numIntersection!==de.numIntersection)||Fe.vertexAlphas!==Ue||Fe.vertexTangents!==Re||Fe.morphTargets!==Le||Fe.morphNormals!==st||Fe.morphColors!==Ct||Fe.toneMapping!==lt||He.isWebGL2===!0&&Fe.morphTargetsCount!==et)&&(nt=!0):(nt=!0,Fe.__version=O.version);let An=Fe.currentProgram;nt===!0&&(An=Ji(O,I,N));let ga=!1,Pi=!1,Xs=!1;const gt=An.getUniforms(),bn=Fe.uniforms;if(Me.useProgram(An.program)&&(ga=!0,Pi=!0,Xs=!0),O.id!==B&&(B=O.id,Pi=!0),ga||M!==S){gt.setValue(D,"projectionMatrix",S.projectionMatrix),gt.setValue(D,"viewMatrix",S.matrixWorldInverse);const It=gt.map.cameraPosition;It!==void 0&&It.setValue(D,be.setFromMatrixPosition(S.matrixWorld)),He.logarithmicDepthBuffer&>.setValue(D,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&>.setValue(D,"isOrthographic",S.isOrthographicCamera===!0),M!==S&&(M=S,Pi=!0,Xs=!0)}if(N.isSkinnedMesh){gt.setOptional(D,N,"bindMatrix"),gt.setOptional(D,N,"bindMatrixInverse");const It=N.skeleton;It&&(He.floatVertexTextures?(It.boneTexture===null&&It.computeBoneTexture(),gt.setValue(D,"boneTexture",It.boneTexture,Ce)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}N.isBatchedMesh&&(gt.setOptional(D,N,"batchingTexture"),gt.setValue(D,"batchingTexture",N._matricesTexture,Ce));const qs=F.morphAttributes;if((qs.position!==void 0||qs.normal!==void 0||qs.color!==void 0&&He.isWebGL2===!0)&&Se.update(N,F,An),(Pi||Fe.receiveShadow!==N.receiveShadow)&&(Fe.receiveShadow=N.receiveShadow,gt.setValue(D,"receiveShadow",N.receiveShadow)),O.isMeshGouraudMaterial&&O.envMap!==null&&(bn.envMap.value=Ee,bn.flipEnvMap.value=Ee.isCubeTexture&&Ee.isRenderTargetTexture===!1?-1:1),Pi&&(gt.setValue(D,"toneMappingExposure",x.toneMappingExposure),Fe.needsLights&&el(bn,Xs),le&&O.fog===!0&&ee.refreshFogUniforms(bn,le),ee.refreshMaterialUniforms(bn,O,V,q,pe),Cs.upload(D,pa(Fe),bn,Ce)),O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(Cs.upload(D,pa(Fe),bn,Ce),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&>.setValue(D,"center",N.center),gt.setValue(D,"modelViewMatrix",N.modelViewMatrix),gt.setValue(D,"normalMatrix",N.normalMatrix),gt.setValue(D,"modelMatrix",N.matrixWorld),O.isShaderMaterial||O.isRawShaderMaterial){const It=O.uniformsGroups;for(let Ys=0,nl=It.length;Ys<nl;Ys++)if(He.isWebGL2){const _a=It[Ys];ye.update(_a,An),ye.bind(_a,An)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return An}function el(S,I){S.ambientLightColor.needsUpdate=I,S.lightProbe.needsUpdate=I,S.directionalLights.needsUpdate=I,S.directionalLightShadows.needsUpdate=I,S.pointLights.needsUpdate=I,S.pointLightShadows.needsUpdate=I,S.spotLights.needsUpdate=I,S.spotLightShadows.needsUpdate=I,S.rectAreaLights.needsUpdate=I,S.hemisphereLights.needsUpdate=I}function tl(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(S,I,F){Ne.get(S.texture).__webglTexture=I,Ne.get(S.depthTexture).__webglTexture=F;const O=Ne.get(S);O.__hasExternalTextures=!0,O.__hasExternalTextures&&(O.__autoAllocateDepthBuffer=F===void 0,O.__autoAllocateDepthBuffer||ge.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),O.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(S,I){const F=Ne.get(S);F.__webglFramebuffer=I,F.__useDefaultFramebuffer=I===void 0},this.setRenderTarget=function(S,I=0,F=0){C=S,A=I,w=F;let O=!0,N=null,le=!1,fe=!1;if(S){const Ee=Ne.get(S);Ee.__useDefaultFramebuffer!==void 0?(Me.bindFramebuffer(D.FRAMEBUFFER,null),O=!1):Ee.__webglFramebuffer===void 0?Ce.setupRenderTarget(S):Ee.__hasExternalTextures&&Ce.rebindTextures(S,Ne.get(S.texture).__webglTexture,Ne.get(S.depthTexture).__webglTexture);const Ue=S.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(fe=!0);const Re=Ne.get(S).__webglFramebuffer;
3645S.isWebGLCubeRenderTarget?(Array.isArray(Re[I])?N=Re[I][F]:N=Re[I],le=!0):He.isWebGL2&&S.samples>0&&Ce.useMultisampledRTT(S)===!1?N=Ne.get(S).__webglMultisampledFramebuffer:Array.isArray(Re)?N=Re[F]:N=Re,b.copy(S.viewport),k.copy(S.scissor),X=S.scissorTest}else b.copy(j).multiplyScalar(V).floor(),k.copy(Q).multiplyScalar(V).floor(),X=ue;if(Me.bindFramebuffer(D.FRAMEBUFFER,N)&&He.drawBuffers&&O&&Me.drawBuffers(S,N),Me.viewport(b),Me.scissor(k),Me.setScissorTest(X),le){const Ee=Ne.get(S.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+I,Ee.__webglTexture,F)}else if(fe){const Ee=Ne.get(S.texture),Ue=I||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,Ee.__webglTexture,F||0,Ue)}B=-1},this.readRenderTargetPixels=function(S,I,F,O,N,le,fe){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let xe=Ne.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&fe!==void 0&&(xe=xe[fe]),xe){Me.bindFramebuffer(D.FRAMEBUFFER,xe);try{const Ee=S.texture,Ue=Ee.format,Re=Ee.type;if(Ue!==Ft&&je.convert(Ue)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Le=Re===qi&&(ge.has("EXT_color_buffer_half_float")||He.isWebGL2&&ge.has("EXT_color_buffer_float"));if(Re!==Tn&&je.convert(Re)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Re===cn&&(He.isWebGL2||ge.has("OES_texture_float")||ge.has("WEBGL_color_buffer_float")))&&!Le){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=S.width-O&&F>=0&&F<=S.height-N&&D.readPixels(I,F,O,N,je.convert(Ue),je.convert(Re),le)}finally{const Ee=C!==null?Ne.get(C).__webglFramebuffer:null;Me.bindFramebuffer(D.FRAMEBUFFER,Ee)}}},this.copyFramebufferToTexture=function(S,I,F=0){const O=Math.pow(2,-F),N=Math.floor(I.image.width*O),le=Math.floor(I.image.height*O);Ce.setTexture2D(I,0),D.copyTexSubImage2D(D.TEXTURE_2D,F,0,0,S.x,S.y,N,le),Me.unbindTexture()},this.copyTextureToTexture=function(S,I,F,O=0){const N=I.image.width,le=I.image.height,fe=je.convert(F.format),xe=je.convert(F.type);Ce.setTexture2D(F,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,F.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,F.unpackAlignment),I.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,O,S.x,S.y,N,le,fe,xe,I.image.data):I.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,O,S.x,S.y,I.mipmaps[0].width,I.mipmaps[0].height,fe,I.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,O,S.x,S.y,fe,xe,I.image),O===0&&F.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),Me.unbindTexture()},this.copyTextureToTexture3D=function(S,I,F,O,N=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const le=S.max.x-S.min.x+1,fe=S.max.y-S.min.y+1,xe=S.max.z-S.min.z+1,Ee=je.convert(O.format),Ue=je.convert(O.type);let Re;if(O.isData3DTexture)Ce.setTexture3D(O,0),Re=D.TEXTURE_3D;else if(O.isDataArrayTexture)Ce.setTexture2DArray(O,0),Re=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,O.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,O.unpackAlignment);const Le=D.getParameter(D.UNPACK_ROW_LENGTH),st=D.getParameter(D.UNPACK_IMAGE_HEIGHT),Ct=D.getParameter(D.UNPACK_SKIP_PIXELS),lt=D.getParameter(D.UNPACK_SKIP_ROWS),Qt=D.getParameter(D.UNPACK_SKIP_IMAGES),et=F.isCompressedTexture?F.mipmaps[0]:F.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,et.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,et.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,S.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,S.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,S.min.z),F.isDataTexture||F.isData3DTexture?D.texSubImage3D(Re,N,I.x,I.y,I.z,le,fe,xe,Ee,Ue,et.data):F.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(Re,N,I.x,I.y,I.z,le,fe,xe,Ee,et.data)):D.texSubImage3D(Re,N,I.x,I.y,I.z,le,fe,xe,Ee,Ue,et),D.pixelStorei(D.UNPACK_ROW_LENGTH,Le),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,st),D.pixelStorei(D.UNPACK_SKIP_PIXELS,Ct),D.pixelStorei(D.UNPACK_SKIP_ROWS,lt),D.pixelStorei(D.UNPACK_SKIP_IMAGES,Qt),N===0&&O.generateMipmaps&&D.generateMipmap(Re),Me.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),Me.unbindTexture()},this.resetState=function(){A=0,w=0,C=null,Me.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ln}get outputColorSpace(){return this._outputColorSpace}
vendor: 58,837 bytes, line 3645
3645set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Qr?"display-p3":"srgb",t.unpackColorSpace=qe.workingColorSpace===Hs?"display-p3":"srgb"}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===it?Gn:Sc}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Gn?it:mt}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Bm extends kc{}Bm.prototype.isWebGL1Renderer=!0;class Hm extends tt{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}}class zm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=zr,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Vt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Vt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Vt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Et=new L;class ra{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix4(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyNormalMatrix(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.transformDirection(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}setX(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=jt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=jt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=jt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=jt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),i=Ke(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ke(t,this.array),n=Ke(n,this.array),i=Ke(i,this.array),r=Ke(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new bt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new ra(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Ho=new L,zo=new Ze,Go=new Ze,Gm=new L,ko=new Be,ys=new L,br=new Zt,Vo=new Be,wr=new zs;class km extends Bt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Aa,this.bindMatrix=new Be,this.bindMatrixInverse=new Be,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new dn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ys),this.boundingBox.expandByPoint(ys)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Zt),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ys),this.boundingSphere.expandByPoint(ys)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),br.copy(this.boundingSphere),br.applyMatrix4(i),e.ray.intersectsSphere(br)!==!1&&(Vo.copy(i).invert(),wr.copy(e.ray).applyMatrix4(Vo),!(this.boundingBox!==null&&wr.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,wr)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Ze,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Aa?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===jl?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;zo.fromBufferAttribute(i.attributes.skinIndex,e),Go.fromBufferAttribute(i.attributes.skinWeight,e),Ho.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=Go.getComponent(r);if(a!==0){const o=zo.getComponent(r);ko.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Gm.copy(Ho).applyMatrix4(ko),a)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class Vc extends tt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Vm extends pt{constructor(e=null,t=1,n=1,i,r,a,o,c,l=ut,h=ut,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Wo=new Be,Wm=new Be;class aa{constructor(e=[],t=[]){this.uuid=Vt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Be)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Be;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:Wm;Wo.multiplyMatrices(o,t[r]),Wo.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new aa(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Vm(t,e,e,Ft,cn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let a=t[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new Vc),this.bones.push(a),this.boneInverses.push(new Be().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Wr extends bt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const li=new Be,Xo=new Be,Es=[],qo=new dn,Xm=new Be,Oi=new Bt,Bi=new Zt;class qm extends Bt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Wr(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Xm)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new dn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,li),qo.copy(e.boundingBox).applyMatrix4(li),this.boundingBox.union(qo)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,li),Bi.copy(e.boundingSphere).applyMatrix4(li),this.boundingSphere.union(Bi)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Oi.geometry=this.geometry,Oi.material=this.material,Oi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Bi.copy(this.boundingSphere),Bi.applyMatrix4(n),e.ray.intersectsSphere(Bi)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,li),Xo.multiplyMatrices(n,li),Oi.matrixWorld=Xo,Oi.raycast(e,Es);for(let a=0,o=Es.length;a<o;a++){const c=Es[a];c.instanceId=r,c.object=this,t.push(c)}Es.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Wr(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class Wc extends Kt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ae(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 Yo=new L,jo=new L,Ko=new Be,Rr=new zs,Ts=new Zt;class oa extends tt{constructor(e=new $t,t=new Wc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Yo.fromBufferAttribute(t,i-1),jo.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Yo.distanceTo(jo);e.setAttribute("lineDistance",new hn(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ts.copy(n.boundingSphere),Ts.applyMatrix4(i),Ts.radius+=r,e.ray.intersectsSphere(Ts)===!1)return;Ko.copy(i).invert(),Rr.copy(e.ray).applyMatrix4(Ko);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=new L,h=new L,u=new L,d=new L,p=this.isLineSegments?2:1,g=n.index,m=n.attributes.position;if(g!==null){const f=Math.max(0,a.start),E=Math.min(g.count,a.start+a.count);for(let x=f,T=E-1;x<T;x+=p){const A=g.getX(x),w=g.getX(x+1);if(l.fromBufferAttribute(m,A),h.fromBufferAttribute(m,w),Rr.distanceSqToSegment(l,h,d,u)>c)continue;d.applyMatrix4(this.matrixWorld);const B=e.ray.origin.distanceTo(d);B<e.near||B>e.far||t.push({distance:B,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),E=Math.min(m.count,a.start+a.count);for(let x=f,T=E-1;x<T;x+=p){if(l.fromBufferAttribute(m,x),h.fromBufferAttribute(m,x+1),Rr.distanceSqToSegment(l,h,d,u)>c)continue;d.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(d);w<e.near||w>e.far||t.push({distance:w,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}const Zo=new L,$o=new L;class Ym extends oa{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 i=0,r=t.count;i<r;i+=2)Zo.fromBufferAttribute(t,i),$o.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Zo.distanceTo($o);e.setAttribute("lineDistance",new hn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class jm extends oa{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Xc extends Kt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ae(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 Jo=new Be,Xr=new zs,As=new Zt,bs=new L;class Km extends tt{constructor(e=new $t,t=new Xc){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),As.copy(n.boundingSphere),As.applyMatrix4(i),As.radius+=r,e.ray.intersectsSphere(As)===!1)return;Jo.copy(i).invert(),Xr.copy(e.ray).applyMatrix4(Jo);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){const d=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);for(let g=d,_=p;g<_;g++){const m=l.getX(g);bs.fromBufferAttribute(u,m),Qo(bs,m,c,i,e,t,this)}}else{const d=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let g=d,_=p;g<_;g++)bs.fromBufferAttribute(u,g),Qo(bs,g,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Qo(s,e,t,n,i,r,a){const o=Xr.distanceSqToPoint(s);if(o<t){const c=new L;Xr.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,object:a})}}class ca extends Kt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ae(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yc,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fn extends ca{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ke(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ae(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ae(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ae(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function ws(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Zm(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function $m(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ec(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function qc(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push.apply(t,a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}class Zi{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){const o=t[1];e<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Jm extends Zi{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ui,endingEnd:ui}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case di:r=e,o=2*t-n;break;case Is:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case di:a=e,c=2*n-t;break;case Is:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}const l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,p=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,f=-d*m+2*d*_-d*g,E=(1+d)*m+(-1.5-2*d)*_+(-.5+d)*g+1,x=(-1-p)*m+(1.5+p)*_+.5*g,T=p*m-p*_;for(let A=0;A!==o;++A)r[A]=f*a[h+A]+E*a[l+A]+x*a[c+A]+T*a[u+A];return r}}class Yc extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}}class Qm extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Jt{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ws(t,this.TimeBufferType),this.values=ws(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ws(e.times,Array),values:ws(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Qm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Yc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Jm(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Yi:t=this.InterpolantFactoryMethodDiscrete;break;case Si:t=this.InterpolantFactoryMethodLinear;break;case nr:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yi;case this.InterpolantFactoryMethodLinear:return Si;case this.InterpolantFactoryMethodSmooth:return nr}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Zm(i))for(let o=0,c=i.length;o!==c;++o){const l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===nr,r=e.length-1;let a=1;for(let o=1;o<r;++o){let c=!1;const l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{const u=o*n,d=u-n,p=u+n;for(let g=0;g!==n;++g){const _=t[u+g];if(_!==t[d+g]||_!==t[p+g]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let p=0;p!==n;++p)t[d+p]=t[u+p]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Jt.prototype.TimeBufferType=Float32Array;Jt.prototype.ValueBufferType=Float32Array;Jt.prototype.DefaultInterpolation=Si;class Ri extends Jt{}Ri.prototype.ValueTypeName="bool";Ri.prototype.ValueBufferType=Array;Ri.prototype.DefaultInterpolation=Yi;Ri.prototype.InterpolantFactoryMethodLinear=void 0;Ri.prototype.InterpolantFactoryMethodSmooth=void 0;class jc extends Jt{}jc.prototype.ValueTypeName="color";class Ti extends Jt{}Ti.prototype.ValueTypeName="number";class eg extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t);let l=e*o;for(let h=l+o;l!==h;l+=4)Wt.slerpFlat(r,0,a,l-o,a,l,c);return r}}class Xn extends Jt{InterpolantFactoryMethodLinear(e){return new eg(this.times,this.values,this.getValueSize(),e)}}Xn.prototype.ValueTypeName="quaternion";Xn.prototype.DefaultInterpolation=Si;Xn.prototype.InterpolantFactoryMethodSmooth=void 0;class Ci extends Jt{}Ci.prototype.ValueTypeName="string";Ci.prototype.ValueBufferType=Array;Ci.prototype.DefaultInterpolation=Yi;Ci.prototype.InterpolantFactoryMethodLinear=void 0;Ci.prototype.InterpolantFactoryMethodSmooth=void 0;class Ai extends Jt{}Ai.prototype.ValueTypeName="vector";class qr{constructor(e,t=-1,n,i=Jr){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Vt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(ng(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=n.length;r!==a;++r)t.push(Jt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);const h=$m(c);c=ec(c,1,h),l=ec(l,1,h),!i&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new Ti(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],h=l.name.match(r);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(l)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,p,g,_){if(p.length!==0){const m=[],f=[];qc(p,m,f,g),m.length!==0&&_.push(new u(d,m,f))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let _=0;_<d[g].morphTargets.length;_++)p[d[g].morphTargets[_]]=-1;for(const _ in p){const m=[],f=[];for(let E=0;E!==d[g].morphTargets.length;++E){const x=d[g];m.push(x.time),f.push(x.morphTarget===_?1:0)}i.push(new Ti(".morphTargetInfluence["+_+"]",m,f))}c=p.length*a}else{const p=".bones["+t[u].name+"]";n(Ai,p+".position",d,"pos",i),n(Xn,p+".quaternion",d,"rot",i),n(Ai,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function tg(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ti;case"vector":case"vector2":case"vector3":case"vector4":return Ai;case"color":return jc;case"quaternion":return Xn;case"bool":case"boolean":return Ri;case"string":return Ci}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function ng(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=tg(s.type);if(s.times===void 0){const t=[],n=[];qc(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const bi={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class ig{constructor(e,t,n){const i=this;let r=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){const u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){const p=l[u],g=l[u+1];if(p.global&&(p.lastIndex=0),p.test(h))return g}return null}}}const sg=new ig;class Li{constructor(e){this.manager=e!==void 0?e:sg,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}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}}Li.DEFAULT_MATERIAL_NAME="__DEFAULT";const an={};class rg extends Error{constructor(e,t){super(e),this.response=t}}class Kc extends Li{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=bi.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(an[e]!==void 0){an[e].push({onLoad:t,onProgress:n,onError:i});return}an[e]=[],an[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(a).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 h=an[e],u=l.body.getReader(),d=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),p=d?parseInt(d):0,g=p!==0;let _=0;const m=new ReadableStream({start(f){E();function E(){u.read().then(({done:x,value:T})=>{if(x)f.close();else{_+=T.byteLength;const A=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let w=0,C=h.length;w<C;w++){const B=h[w];B.onProgress&&B.onProgress(A)}f.enqueue(T),E()}})}}});return new Response(m)}else throw new rg(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o===void 0)return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(g=>p.decode(g))}}}).then(l=>{bi.add(e,l);const h=an[e];delete an[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onLoad&&p.onLoad(l)}}).catch(l=>{const h=an[e];if(h===void 0)throw this.manager.itemError(e),l;delete an[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];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 ag extends Li{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=bi.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=ji("img");function c(){h(),bi.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){h(),i&&i(u),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class og extends Li{constructor(e){super(e)}load(e,t,n,i){const r=new pt,a=new ag(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class Vs extends tt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ae(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 Cr=new Be,tc=new L,nc=new L;class la{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.map=null,this.mapPass=null,this.matrix=new Be,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ta,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new Ze(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;tc.setFromMatrixPosition(e.matrixWorld),t.position.copy(tc),nc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(nc),t.updateMatrixWorld(),Cr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Cr)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class cg extends la{constructor(){super(new At(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=yi*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class lg extends Vs{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(tt.DEFAULT_UP),this.updateMatrix(),this.target=new tt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new cg}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const ic=new Be,Hi=new L,Lr=new L;class hg extends la{constructor(){super(new At(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ke(4,2),this._viewportCount=6,this._viewports=[new Ze(2,1,1,1),new Ze(0,1,1,1),new Ze(3,1,1,1),new Ze(1,1,1,1),new Ze(3,0,1,1),new Ze(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,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Hi.setFromMatrixPosition(e.matrixWorld),n.position.copy(Hi),Lr.copy(n.position),Lr.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Lr),n.updateMatrixWorld(),i.makeTranslation(-Hi.x,-Hi.y,-Hi.z),ic.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ic)}}class ug extends Vs{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new hg}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 dg extends la{constructor(){super(new ia(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Yr extends Vs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tt.DEFAULT_UP),this.updateMatrix(),this.target=new tt,this.shadow=new dg}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class fg extends Vs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Xi{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class pg extends Li{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=bi.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){bi.add(e,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){i&&i(c),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}class mg{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,r,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Wt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const a=this._workIndex*r;Wt.multiplyQuaternionsFlat(e,a,e,t,e,n),Wt.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){const a=1-i;for(let o=0;o!==r;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const ha="\\[\\]\\.:\\/",gg=new RegExp("["+ha+"]","g"),ua="[^"+ha+"]",_g="[^"+ha.replace("\\.","")+"]",xg=/((?:WC+[\/:])*)/.source.replace("WC",ua),vg=/(WCOD+)?/.source.replace("WCOD",_g),Mg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ua),Sg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ua),yg=new RegExp("^"+xg+vg+Mg+Sg+"$"),Eg=["material","materials","bones","map"];class Tg{constructor(e,t,n){const i=n||Xe.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Xe{constructor(e,t,n){this.path=t,this.parsedPath=n||Xe.parseTrackName(t),this.node=Xe.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Xe.Composite(e,t,n):new Xe(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(gg,"")}static parseTrackName(e){const t=yg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);Eg.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Xe.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[i];if(a===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Xe.Composite=Tg;Xe.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Xe.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Xe.prototype.GetterByBindingType=[Xe.prototype._getValue_direct,Xe.prototype._getValue_array,Xe.prototype._getValue_arrayElement,Xe.prototype._getValue_toArray];Xe.prototype.SetterByBindingTypeAndVersioning=[[Xe.prototype._setValue_direct,Xe.prototype._setValue_direct_setNeedsUpdate,Xe.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Xe.prototype._setValue_array,Xe.prototype._setValue_array_setNeedsUpdate,Xe.prototype._setValue_array_setMatr
vendor: 15,765 bytes, line 3645
3645ixWorldNeedsUpdate],[Xe.prototype._setValue_arrayElement,Xe.prototype._setValue_arrayElement_setNeedsUpdate,Xe.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Xe.prototype._setValue_fromArray,Xe.prototype._setValue_fromArray_setNeedsUpdate,Xe.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Ag{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,o=new Array(a),c={endingStart:ui,endingEnd:ui};for(let l=0;l!==a;++l){const h=r[l].createInterpolant(null);o[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=sh,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case ah:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Jr:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const a=n===rh;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===ih){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=di,i.endingEnd=di):(e?i.endingStart=this.zeroSlopeAtStart?di:ui:i.endingStart=Is,t?i.endingEnd=this.zeroSlopeAtEnd?di:ui:i.endingEnd=Is)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}}const bg=new Float32Array(1);class wg extends qn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){const d=i[u],p=d.name;let g=h[p];if(g!==void 0)++g.referenceCount,a[u]=g;else{if(g=a[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,p));continue}const _=t&&t._propertyBindings[u].binding.parsedPath;g=new mg(Xe.create(n,p,_),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,p),a[u]=g}o[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,a=this._actionsByClip,o=a[r],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Yc(new Float32Array(2),new Float32Array(2),1,bg),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let a=typeof e=="string"?qr.findByName(i,e):e;const o=a!==null?a.uuid:e,c=this._actionsByClip[o];let l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Jr),c!==void 0){const u=c.actionByRoot[r];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;const h=new Ag(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?qr.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);const o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const a=r.knownActions;for(let o=0,c=a.length;o!==c;++o){const l=a[o];this._deactivateAction(l);const h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const a in r){const o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}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);function sc(s,e){if(e===oh)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Hr||e===Mc){let t=s.getIndex();if(t===null){const a=[],o=s.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===Hr)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class Rg extends Li{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Dg(t)}),this.register(function(t){return new kg(t)}),this.register(function(t){return new Vg(t)}),this.register(function(t){return new Wg(t)}),this.register(function(t){return new Ng(t)}),this.register(function(t){return new Fg(t)}),this.register(function(t){return new Og(t)}),this.register(function(t){return new Bg(t)}),this.register(function(t){return new Ig(t)}),this.register(function(t){return new Hg(t)}),this.register(function(t){return new Ug(t)}),this.register(function(t){return new Gg(t)}),this.register(function(t){return new zg(t)}),this.register(function(t){return new Lg(t)}),this.register(function(t){return new Xg(t)}),this.register(function(t){return new qg(t)})}load(e,t,n,i){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=Xi.extractUrlBase(e);a=Xi.resolveURL(l,this.path)}else a=Xi.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){i?i(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new Kc(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},o={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===Zc){try{a[Ge.KHR_BINARY_GLTF]=new Yg(e)}catch(u){i&&i(u);return}r=JSON.parse(a[Ge.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new a_(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const u=r.extensionsUsed[h],d=r.extensionsRequired||[];
vendor: 1,032 bytes, line 3645
3645switch(u){case Ge.KHR_MATERIALS_UNLIT:a[u]=new Pg;break;case Ge.KHR_DRACO_MESH_COMPRESSION:a[u]=new jg(r,this.dracoLoader);break;case Ge.KHR_TEXTURE_TRANSFORM:a[u]=new Kg;break;case Ge.KHR_MESH_QUANTIZATION:a[u]=new Zg;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function Cg(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Ge={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",
vendor: 11,562 bytes, line 3645
3645KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Lg{constructor(e){this.parser=e,this.name=Ge.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let l;const h=new Ae(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],mt);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Yr(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new ug(h),l.distance=u;break;case"spot":l=new lg(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,Mn(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}}class Pg{constructor(){this.name=Ge.KHR_MATERIALS_UNLIT}getMaterialType(){return On}extendParams(e,t,n){const i=[];e.color=new Ae(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],mt),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,it))}return Promise.all(i)}}class Ig{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class Dg{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ke(o,o)}return Promise.all(r)}}class Ug{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class Ng{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Ae(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],mt)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,it)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class Fg{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class Og{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Ae().setRGB(o[0],o[1],o[2],mt),Promise.all(r)}}class Bg{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Hg{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Ae().setRGB(o[0],o[1],o[2],mt),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,it)),Promise.all(r)}}class zg{constructor(e){this.parser=e,this.name=Ge.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class Gg{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:fn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class kg{constructor(e){this.parser=e,this.name=Ge.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class Vg{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Wg{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
3645FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Xg{constructor(e){this.name=Ge.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){const c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(p){return p.buffer}):a.ready.then(function(){const p=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(p),h,u,d,i.mode,i.filter),p})})}else return null}}class qg{constructor(e){this.name=Ge.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==Ut.TRIANGLES&&l.mode!==Ut.TRIANGLE_STRIP&&l.mode!==Ut.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,p=[];for(const g of u){const _=new Be,m=new L,f=new Wt,E=new L(1,1,1),x=new qm(g.geometry,g.material,d);for(let T=0;T<d;T++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,T),c.ROTATION&&f.fromBufferAttribute(c.ROTATION,T),c.SCALE&&E.fromBufferAttribute(c.SCALE,T),x.setMatrixAt(T,_.compose(m,f,E));for(const T in c)if(T==="_COLOR_0"){const A=c[T];x.instanceColor=new Wr(A.array,A.itemSize,A.normalized)}else T!=="TRANSLATION"&&T!=="ROTATION"&&T!=="SCALE"&&g.geometry.setAttribute(T,c[T]);tt.prototype.copy.call(x,g),this.parser.assignFinalMaterial(x),p.push(x)}return h.isGroup?(h.clear(),h.add(...p),h):p[0]}))}}const Zc="glTF",zi=12,rc={JSON:1313821514,BIN:5130562};class Yg{constructor(e){this.name=Ge.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,zi),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Zc)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-zi,r=new DataView(e,zi);let a=0;for(;a<i;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===rc.JSON){const l=new Uint8Array(e,zi+a,o);this.content=n.decode(l)}else if(c===rc.BIN){const l=zi+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class jg{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ge.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const h in a){const u=jr[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=jr[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],p=gi[d.componentType];l[u]=p.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u){i.decodeDracoFile(h,function(d){for(const p in d.attributes){const g=d.attributes[p],_=c[p];_!==void 0&&(g.normalized=_)}u(d)},o,l)})})}}class Kg{constructor(){this.name=Ge.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Zg{constructor(){this.name=Ge.KHR_MESH_QUANTIZATION}}class $c extends Zi{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,p=d*u,g=e*l,_=g-l,m=-2*p+3*d,f=p-d,E=1-m,x=f-d+u;for(let T=0;T!==o;T++){const A=a[_+T+o],w=a[_+T+c]*h,C=a[g+T+o],B=a[g+T]*h;r[T]=E*A+x*w+m*C+f*B}return r}}const $g=new Wt;class Jg extends $c{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return $g.fromArray(r).normalize().toArray(r),r}}const Ut={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},gi={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ac={9728:ut,9729:wt,9984:Br,9985:dc,9986:Rs,9987:kn},oc={33071:Nt,33648:Ps,10497:vi},Pr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},vn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Qg={CUBICSPLINE:void 0,LINEAR:Si,STEP:Yi},Ir={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function e_(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new ca({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:un})),s.DefaultMaterial}function Pn(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Mn(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function t_(s,e,t){let n=!1,i=!1,r=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(i){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(r){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],d=l[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=d
vendor: 9,179 bytes, line 3645
3645),s.morphTargetsRelative=!0,s})}function n_(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function i_(s){let e;const t=s.extensions&&s.extensions[Ge.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Dr(t.attributes):e=s.indices+":"+Dr(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+Dr(s.targets[n]);return e}function Dr(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Kr(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function s_(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const r_=new Be;class a_{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Cg,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&r<98?this.textureLoader=new og(this.options.manager):this.textureLoader=new pg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Kc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return Pn(r,o,i),Mn(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,h]of a.children.entries())r(h,o.children[l])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ge.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(r,a){n.load(Xi.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=Pr[i.type],o=gi[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new bt(l,a,c))}const r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){const o=a[0],c=Pr[i.type],l=gi[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,p=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0;let _,m;if(p&&p!==u){const f=Math.floor(d/p),E="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count;let x=t.cache.get(E);x||(_=new l(o,f*p,i.count*p/h),x=new zm(_,p/h),t.cache.add(E,x)),m=new ra(x,c,d%p/h,g)}else o===null?_=new l(i.count*c):_=new l(o,d,i.count*c),m=new bt(_,c,g);if(i.sparse!==void 0){const f=Pr.SCALAR,E=gi[i.sparse.indices.componentType],x=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,A=new E(a[1],x,i.sparse.count*f),w=new l(a[2],T,i.sparse.count*c);o!==null&&(m=new bt(m.array.slice(),m.itemSize,m.normalized));for(let C=0,B=A.length;C<B;C++){const M=A[C];if(m.setX(M,w[C*c]),c>=2&&m.setY(M,w[C*c+1]),c>=3&&m.setZ(M,w[C*c+2]),c>=4&&m.setW(M,w[C*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const d=(r.samplers||{})[a.sampler]||{};return h.magFilter=ac[d.magFilter]||wt,h.minFilter=ac[d.minFilter]||kn,h.wrapS=oc[d.wrapS]||vi,h.wrapT=oc[d.wrapT]||vi,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=i.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;const d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(_){const m=new pt(_);m.needsUpdate=!0,d(m)}),t.load(Xi.resolveURL(u,r.path),g,void 0,p)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),u.userData.mimeType=a.mimeType||s_(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if
vendor: 6,820 bytes, line 3645
3645(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[Ge.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=r.associations.get(a);a=r.extensions[Ge.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new Xc,Kt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new Wc,Kt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),r&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return ca}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},c=r.extensions||{},l=[];if(c[Ge.KHR_MATERIALS_UNLIT]){const u=i[Ge.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new Ae(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],mt),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,it)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=Yt);const h=r.alphaMode||Ir.OPAQUE;if(h===Ir.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Ir.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==On&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new ke(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==On&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==On){const u=r.emissiveFactor;o.emissive=new Ae().setRGB(u[0],u[1],u[2],mt)}return r.emissiveTexture!==void 0&&a!==On&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,it)),Promise.all(l).then(function(){const u=new a(o);return r.name&&(u.name=r.name),Mn(u,r),t.associations.set(u,{materials:e}),r.extensions&&Pn(i,u,r),u})}createUniqueName(e){const t=Xe.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return cc(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=i_(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[Ge.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=cc(new $t,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const h=a[c].material===void 0?e_(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let p=0,g=h.length;p<g;p++){const _=h[p],m=a[p];let f;const E=l[p];if(m.mode===Ut.TRIANGLES||m.mode===Ut.TRIANGLE_STRIP||m.mode===Ut.TRIANGLE_FAN||m.mode===void 0)f=r.isSkinnedMesh===!0?new km(_,E):new Bt(_,E),f.isSkinnedMesh===!0&&f.normalizeSkinWeights(),m.mode===Ut.TRIANGLE_STRIP?f.geometry=sc(f.geometry,Mc):m.mode===Ut.TRIANGLE_FAN&&(f.geometry=sc(f.geometry,Hr));else if(m.mode===Ut.LINES)f=new Ym(_,E);else if(m.mode===Ut.LINE_STRIP)f=new oa(_,E);else if(m.mode===Ut.LINE_LOOP)f=new jm(_,E);else if(m.mode===Ut.POINTS)f=new Km(_,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(f.geometry.morphAttributes).length>0&&n_(f,r),f.name=t.createUniqueName(r.name||"mesh_"+e),Mn(f,r),m.extensions&&Pn(i,f,m),t.assignFinalMaterial(f),u.push(f)}for(let p=0,g=u.length;p<g;p++)t.associations.set(u[p],{meshes:e,primitives:p});if(u.length===1)return r.extensions&&Pn(i,u[0],r),u[0];const d=new Bn;r.extensions&&Pn(i,d,r),t.associations.set(d,{meshes:e});for(let p=0,g=u.length;p<g;p++)d.add(u[p]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new At(Ih.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new ia(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Mn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const r=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){const u=a[l];if(u){o.push(u);const d=new Be;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new aa(o,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){const p=i.channels[u],g=i.samplers[p.sampler],_=p.target,m=_.node,f=i.parameters!==void 0?i.parameters[g.input]:g.input,E=i.parameters!==void 0?i.parameters[g.output]:g.output;_.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",f)),c.push(this.getDependency("accessor",E)),l.push(g),h.push(_))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const d=u[0],p=u[1],g=u[2],_=u[3],m=u[4],f=[];for(let E=0,x=d.length;E<x;
vendor: 4,633 bytes, line 3645
3645E++){const T=d[E],A=p[E],w=g[E],C=_[E],B=m[E];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const M=n._createAnimationTracks(T,A,w,C,B);if(M)for(let b=0;b<M.length;b++)f.push(M[b])}return new qr(r,void 0,f)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){const a=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){const h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(p){p.isSkinnedMesh&&p.bind(d,r_)});for(let p=0,g=u.length;p<g;p++)h.add(u[p]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(l){return i._getNodeRef(i.cameraCache,r.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(r.isBone===!0?h=new Vc:l.length>1?h=new Bn:l.length===1?h=l[0]:h=new tt,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=a),Mn(h,r),r.extensions&&Pn(n,h,r),r.matrix!==void 0){const u=new Be;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);return i.associations.has(h)||i.associations.set(h,{}),i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Bn;n.name&&(r.name=i.createUniqueName(n.name)),Mn(r,n),n.extensions&&Pn(t,r,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++)r.add(c[h]);const l=h=>{const u=new Map;for(const[d,p]of i.associations)(d instanceof Kt||d instanceof pt)&&u.set(d,p);return h.traverse(d=>{const p=i.associations.get(d);p!=null&&u.set(d,p)}),u};return i.associations=l(r),r})}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,c=[];vn[r.path]===vn.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(vn[r.path]){case vn.weights:l=Ti;break;case vn.rotation:l=Xn;break;case vn.position:case vn.scale:l=Ai;break;default:switch(n.itemSize){case 1:l=Ti;break;case 2:case 3:default:l=Ai;break}break}const h=i.interpolation!==void 0?Qg[i.interpolation]:Si,u=this._getArrayFromAccessor(n);for(let d=0,p=c.length;d<p;d++){const g=new l(c[d]+"."+vn[r.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),a.push(g)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Kr(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Xn?Jg:$c;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function o_(s,e,t){const n=e.attributes,i=new dn;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new L(c[0],c[1],c[2]),new L(l[0],l[1],l[2])),o.normalized){const h=Kr(gi[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const o=new L,c=new L;for(let l=0,h=r.length;l<h;l++){const u=r[l];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),d.normalized){const _=Kr(gi[d.componentType]);c.multiplyScalar(_)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}
3645i.expandByVector(o)}s.boundingBox=i;const a=new Zt;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function cc(s,e,t){const n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){s.setAttribute(o,c)})}for(const a in n){const o=jr[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){const a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return qe.workingColorSpace!==mt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${qe.workingColorSpace}" not supported.`),Mn(s,e),o_(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?t_(s,e.targets,t):s})}const c_={data(){return{lightIntensity:1,fps:30,lastFrame:0,frameCount:0}},computed:{events(){return ol()}},mounted(){this.scene=new Hm,this.camera=new At(25,this.$refs.canvas.getBoundingClientRect().width/this.$refs.canvas.getBoundingClientRect().height,.01,1e4),this.renderer=new kc({antialias:!0,alpha:!0,gammaInput:!0,gammaOutput:!0}),this.renderer.setSize(this.$refs.canvas.getBoundingClientRect().width,this.$refs.canvas.getBoundingClientRect().height),this.$refs.canvas.appendChild(this.renderer.domElement),new Rg().load("models/electra-aero.glb",i=>{this.model=i.scene,this.model.scale.set(.05,.05,.05),new wg(i.scene).clipAction(i.animations[0]).play(),this.scene.add(this.model),this.camera.position.set(35,35,35),this.camera.lookAt(0,0,0)});const e=new Yr(16777215,1.2);e.position.set(3,2,2);const t=new Yr(16777215,2);t.position.set(-.8,-1,-1);const n=new fg(16777215,12);this.scene.add(e,t,n),this.camera.lookAt(0,0,0),this.lastFrame=Date.now(),this.animate()},methods:{animate(){Date.now()-this.lastFrame>1e3/this.fps&&(this.renderer.render(this.scene,this.camera),this.model&&(this.model.rotation.y=0+this.events.mouse.x*.04,this.model.rotation.x=0+this.events.mouse.y*.1),this.lastFrame=Date.now()),this.frameCount+=1,requestAnimationFrame(this.animate)}}},l_={ref:"canvas",class:"renderer"};function h_(s,e,t,n,i,r){return In(),hi("div",l_,null,512)}const u_=al(c_,[["render",h_]]),d_={class:"content-container"},f_={class:"col text-column"},p_={class:"col-inner"},m_={key:0,class:"small-title"},g_={key:1},__={key:2,class:"buttons"},x_={class:"col image-column"},T_={__name:"RenderTextSection",props:{blok:Object,default:()=>({})},setup(s){return(e,t)=>{const n=il,i=sl,r=rl,a=u_,o=pl,c=cl("editable");return In(),hi("div",{class:xa(["storyblok-image-text",{dark:s.blok.dark,invert:s.blok.invert}])},[Qi(o,null,{default:js(()=>[Ii("div",d_,[Ii("div",{class:xa(["row",{invert:s.blok.invert}])},[Ii("div",f_,[Ii("div",p_,[s.blok.smallTitle?(In(),hi("h3",m_,Ks(s.blok.smallTitle),1)):Zs("",!0),s.blok.title?(In(),hi("h2",g_,Ks(s.blok.title),1)):Zs("",!0),ll(Qi(n,{text:s.blok.text},null,8,["text"]),[[c,s.blok.text]]),s.blok.buttons?(In(),hi("div",__,[(In(!0),hi(hl,null,ul(s.blok.buttons,l=>(In(),dl(r,{to:l.url.url,target:l.new_tab?"_self":"_blank",rel:"noopener"},{default:js(()=>[Qi(i,null,{default:js(()=>[fl(Ks(l.text),1)]),_:2},1024)]),_:2},1032,["to","target"]))),256))])):Zs("",!0)])]),Ii("div",x_,[Qi(a)])],2)])]),_:1})],2)}}};export{T_ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.