vendor: 21,828 bytes, lines 1-5
1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();const Yl="/assets/space-ca17ac07.jpg",Kl="/assets/borg-c9faf509.png",Zl="/assets/normal-8e277ece.jpg",$l="/assets/vector-golf-background-golf-ball-texture_1284-43402-7416f384.jpg",Jl="/assets/NormalMap-53b8f43d.png",Ql="/assets/NormalMap2-e2e6decc.png",ec="/assets/Lovoo_Selfie-0fca1f6f.png",tc="/assets/NormalMapGolfball2-00f27520.png";/** 2 * @license 3 * Copyright 2010-2023 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const kr="151",Xn={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},jn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nc=0,ra=1,ic=2,Yo=1,sc=2,Gi=3,an=0,bt=1,jt=2,vn=0,mi=1,aa=2,oa=3,la=4,rc=5,hi=100,ac=101,oc=102,ca=103,ua=104,lc=200,cc=201,uc=202,hc=203,Ko=204,Zo=205,dc=206,fc=207,pc=208,mc=209,gc=210,_c=0,xc=1,vc=2,Tr=3,Mc=4,yc=5,Sc=6,bc=7,$o=0,wc=1,Tc=2,rn=0,Ac=1,Ec=2,Cc=3,Lc=4,Rc=5,Jo=300,Mi=301,yi=302,Ar=303,Er=304,Us=306,Si=1e3,Nt=1001,Ps=1002,ot=1003,Cr=1004,Cs=1005,St=1006,Qo=1007,On=1008,Fn=1009,Pc=1010,Ic=1011,el=1012,Dc=1013,Pn=1014,xn=1015,qi=1016,Nc=1017,Uc=1018,gi=1020,Oc=1021,Ut=1023,Fc=1024,Bc=1025,Nn=1026,bi=1027,zc=1028,kc=1029,Vc=1030,Hc=1031,Gc=1033,Ws=33776,Xs=33777,js=33778,qs=33779,ha=35840,da=35841,fa=35842,pa=35843,Wc=36196,ma=37492,ga=37496,_a=37808,xa=37809,va=37810,Ma=37811,ya=37812,Sa=37813,ba=37814,wa=37815,Ta=37816,Aa=37817,Ea=37818,Ca=37819,La=37820,Ra=37821,Ys=36492,Xc=36283,Pa=36284,Ia=36285,Da=36286,jc=2200,qc=2201,Yc=2202,Yi=2300,wi=2301,Ks=2302,di=2400,fi=2401,Is=2402,Vr=2500,Kc=2501,Zc=0,tl=1,Lr=2,Bn=3e3,ke=3001,$c=3200,Jc=3201,nl=0,Qc=1,Wt="srgb",Ki="srgb-linear",il="display-p3",Zs=7680,eu=519,Rr=35044,Na="300 es",Pr=1035;class yn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e);e.target=null}}}const ft=["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 Ua=1234567;const Xi=Math.PI/180,Ti=180/Math.PI;function Vt(){const o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ft[o&255]+ft[o>>8&255]+ft[o>>16&255]+ft[o>>24&255]+"-"+ft[e&255]+ft[e>>8&255]+"-"+ft[e>>16&15|64]+ft[e>>24&255]+"-"+ft[t&63|128]+ft[t>>8&255]+"-"+ft[t>>16&255]+ft[t>>24&255]+ft[n&255]+ft[n>>8&255]+ft[n>>16&255]+ft[n>>24&255]).toLowerCase()}function lt(o,e,t){return Math.max(e,Math.min(t,o))}function Hr(o,e){return(o%e+e)%e}function tu(o,e,t,n,i){return n+(o-e)*(i-n)/(t-e)}function nu(o,e,t){return o!==e?(t-o)/(e-o):0}function ji(o,e,t){return(1-t)*o+t*e}function iu(o,e,t,n){return ji(o,e,1-Math.exp(-t*n))}function su(o,e=1){return e-Math.abs(Hr(o,e*2)-e)}function ru(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*(3-2*o))}function au(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*o*(o*(o*6-15)+10))}function ou(o,e){return o+Math.floor(Math.random()*(e-o+1))}function lu(o,e){return o+Math.random()*(e-o)}function cu(o){return o*(.5-Math.random())}function uu(o){o!==void 0&&(Ua=o);let e=Ua+=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 hu(o){return o*Xi}function du(o){return o*Ti}function Ir(o){return(o&o-1)===0&&o!==0}function sl(o){return Math.pow(2,Math.ceil(Math.log(o)/Math.LN2))}function rl(o){return Math.pow(2,Math.floor(Math.log(o)/Math.LN2))}function fu(o,e,t,n,i){const s=Math.cos,r=Math.sin,a=s(t/2),l=r(t/2),c=s((e+n)/2),u=r((e+n)/2),h=s((e-n)/2),d=r((e-n)/2),p=s((n-e)/2),g=r((n-e)/2);switch(i){case"XYX":o.set(a*u,l*h,l*d,a*c);break;case"YZY":o.set(l*d,a*u,l*h,a*c);break;case"ZXZ":o.set(l*h,l*d,a*u,a*c);break;case"XZX":o.set(a*u,l*g,l*p,a*c);break;case"YXY":o.set(l*p,a*u,l*g,a*c);break;case"ZYZ":o.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function sn(o,e){switch(e.constructor){case Float32Array:return o;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("Invalid component type.")}}function Ge(o,e){switch(e.constructor){case Float32Array:return o;case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("Invalid component type.")}}const al={DEG2RAD:Xi,RAD2DEG:Ti,generateUUID:Vt,clamp:lt,euclideanModulo:Hr,mapLinear:tu,inverseLerp:nu,lerp:ji,damp:iu,pingpong:su,smoothstep:ru,smootherstep:au,randInt:ou,randFloat:lu,randFloatSpread:cu,seededRandom:uu,degToRad:hu,radToDeg:du,isPowerOfTwo:Ir,ceilPowerOfTwo:sl,floorPowerOfTwo:rl,setQuaternionFromProperEuler:fu,normalize:Ge,denormalize:sn};class Ae{constructor(e=0,t=0){Ae.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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(lt(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),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ue{constructor(){Ue.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,i,s,r,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=r,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],p=n[5],g=n[8],_=i[0],m=i[3],f=i[6],w=i[1],S=i[4],x=i[7],b=i[2],C=i[5],P=i[8];return s[0]=r*_+a*w+l*b,s[3]=r*m+a*S+l*C,s[6]=r*f+a*x+l*P,s[1]=c*_+u*w+h*b,s[4]=c*m+u*S+h*C,s[7]=c*f+u*x+h*P,s[2]=d*_+p*w+g*b,s[5]=d*m+p*S+g*C,s[8]=d*f+p*x+g*P,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*r*u-t*a*c-n*s*u+n*a*l+i*s*c-i*r*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*r-a*c,d=a*l-u*s,p=c*s-r*l,g=t*h+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]=h*_,e[1]=(i*c-u*n)*_,e[2]=(a*n-i*r)*_,e[3]=d*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-a*t)*_,e[6]=p*_,e[7]=(n*l-c*t)*_,e[8]=(r*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*r+c*a)+r+e,-i*c,i*l,-i*(-c*r+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply($s.makeScale(e,t)),this}rotate(e){return this.premultiply($s.makeRotation(-e)),this}translate(e,t){return this.premultiply($s.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let 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 $s=new Ue;function ol(o){for(let e=o.length-1;e>=0;--e)if(o[e]>=65535)return!0;return!1}function Zi(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}function _i(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Js(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}const pu=new Ue().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),mu=new Ue().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function gu(o){return o.convertSRGBToLinear().applyMatrix3(mu)}function _u(o){return o.applyMatrix3(pu).convertLinearToSRGB()}const xu={[Ki]:o=>o,[Wt]:o=>o.convertSRGBToLinear(),[il]:gu},vu={[Ki]:o=>o,[Wt]:o=>o.convertLinearToSRGB(),[il]:_u},At={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(o){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!o},get workingColorSpace(){return Ki},set workingColorSpace(o){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(o,e,t){if(this.enabled===!1||e===t||!e||!t)return o;const n=xu[e],i=vu[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(o))},fromWorkingColorSpace:function(o,e){return this.convert(o,this.workingColorSpace,e)},toWorkingColorSpace:function(o,e){return this.convert(o,e,this.workingColorSpace)}};let qn;class ll{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{qn===void 0&&(qn=Zi("canvas")),qn.width=e.width,qn.height=e.height;const n=qn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=qn}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=Zi("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),s=i.data;for(let r=0;r<s.length;r++)s[r]=_i(s[r]/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(_i(t[n]/255)*255):t[n]=_i(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class cl{constructor(e=null){this.isSource=!0,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 s;if(Array.isArray(i)){s=[];for(let r=0,a=i.length;r<a;r++)i[r].isDataTexture?s.push(Qs(i[r].image)):s.push(Qs(i[r]))}else s=Qs(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Qs(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?ll.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Mu=0;class ct extends yn{constructor(e=ct.DEFAULT_IMAGE,t=ct.DEFAULT_MAPPING,n=Nt,i=Nt,s=St,r=On,a=Ut,l=Fn,c=ct.DEFAULT_ANISOTROPY,u=Bn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Mu++}),this.uuid=Vt(),this.name="",this.source=new cl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ae(0,0),this.repeat=new Ae(1,1),this.center=new Ae(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ue,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,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.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,encoding:this.encoding,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!==Jo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Si: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 Si: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)}}ct.DEFAULT_IMAGE=null;ct.DEFAULT_MAPPING=Jo;ct.DEFAULT_ANISOTROPY=1;class We{constructor(e=0,t=0,n=0,i=1){We.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}
vendor: 21,463 bytes, line 5
5sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*t+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*t+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*t+r[7]*n+r[11]*i+r[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],g=l[9],_=l[2],m=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,x=(p+1)/2,b=(f+1)/2,C=(u+d)/4,P=(h+_)/4,N=(g+m)/4;return S>x&&S>b?S<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(S),i=C/n,s=P/n):x>b?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=C/i,s=N/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=P/s,i=N/s),this.set(n,i,s,t),this}let w=Math.sqrt((m-g)*(m-g)+(h-_)*(h-_)+(d-u)*(d-u));return Math.abs(w)<.001&&(w=1),this.x=(m-g)/w,this.y=(h-_)/w,this.z=(d-u)/w,this.w=Math.acos((c+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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class zn extends yn{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new We(0,0,e,t),this.scissorTest=!1,this.viewport=new We(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new ct(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:St,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.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 cl(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 ul extends ct{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=ot,this.minFilter=ot,this.wrapR=Nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class yu extends ct{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=ot,this.minFilter=ot,this.wrapR=Nt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Lt{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,s,r,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const d=s[r+0],p=s[r+1],g=s[r+2],_=s[r+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==d||c!==p||u!==g){let m=1-a;const f=l*d+c*p+u*g+h*_,w=f>=0?1:-1,S=1-f*f;if(S>Number.EPSILON){const b=Math.sqrt(S),C=Math.atan2(b,f*w);m=Math.sin(m*C)/b,a=Math.sin(a*C)/b}const x=a*w;if(l=l*m+d*x,c=c*m+p*x,u=u*m+g*x,h=h*m+_*x,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[r],d=s[r+1],p=s[r+2],g=s[r+3];return e[t]=a*g+u*h+l*p-c*d,e[t+1]=l*g+u*d+c*h-a*p,e[t+2]=c*g+u*p+a*d-l*h,e[t+3]=u*g-a*h-l*d-c*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,s=e._z,r=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),d=l(n/2),p=l(i/2),g=l(s/2);switch(r){case"XYZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"YXZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"ZXY":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"ZYX":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"YZX":this._x=d*u*h+c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h-d*p*g;break;case"XZY":this._x=d*u*h-c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(r-i)*p}else if(n>a&&n>h){const p=2*Math.sqrt(1+n-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(i+r)/p,this._z=(s+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-n-h);this._w=(s-c)/p,this._x=(i+r)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-n-a);this._w=(r-i)/p,this._x=(s+c)/p,this._y=(l+u)/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(lt(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,s=e._z,r=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+r*a+i*c-s*l,this._y=i*u+r*l+s*a-n*c,this._z=s*u+r*c+n*l-i*a,this._w=r*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,r=this._w;let a=r*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=r,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*r+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=r*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+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(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),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(Oa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Oa.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,a=e.z,l=e.w,c=l*t+r*i-a*n,u=l*n+a*t-s*i,h=l*i+s*n-r*t,d=-s*t-r*n-a*i;return this.x=c*l+d*-s+u*-a-h*-r,this.y=u*l+d*-r+h*-s-c*-a,this.z=h*l+d*-a+c*-r-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,r=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*r-n*l,this.z=n*a-i*r,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 er.copy(this).projectOnVector(e),this.sub(er)}reflect(e){return this.sub(er.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(lt(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 er=new L,Oa=new Lt;class on{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(Zt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Zt.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=Zt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){if(e.updateWorldMatrix(!1,!1),e.boundingBox!==void 0)e.boundingBox===null&&e.computeBoundingBox(),Yn.copy(e.boundingBox),Yn.applyMatrix4(e.matrixWorld),this.union(Yn);else{const i=e.geometry;if(i!==void 0)if(t&&i.attributes!==void 0&&i.attributes.position!==void 0){const s=i.attributes.position;for(let r=0,a=s.count;r<a;r++)Zt.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),this.expandByPoint(Zt)}else i.boundingBox===null&&i.computeBoundingBox(),Yn.copy(i.boundingBox),Yn.applyMatrix4(e.matrixWorld),this.union(Yn)}const n=e.children;for(let i=0,s=n.length;i<s;i++)this.expandByObject(n[i],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,Zt),Zt.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 10,666 bytes, line 5
5s}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ni),ns.subVectors(this.max,Ni),Kn.subVectors(e.a,Ni),Zn.subVectors(e.b,Ni),$n.subVectors(e.c,Ni),un.subVectors(Zn,Kn),hn.subVectors($n,Zn),Tn.subVectors(Kn,$n);let t=[0,-un.z,un.y,0,-hn.z,hn.y,0,-Tn.z,Tn.y,un.z,0,-un.x,hn.z,0,-hn.x,Tn.z,0,-Tn.x,-un.y,un.x,0,-hn.y,hn.x,0,-Tn.y,Tn.x,0];return!tr(t,Kn,Zn,$n,ns)||(t=[1,0,0,0,1,0,0,0,1],!tr(t,Kn,Zn,$n,ns))?!1:(is.crossVectors(un,hn),t=[is.x,is.y,is.z],tr(t,Kn,Zn,$n,ns))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Zt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Zt).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:(Kt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Kt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Kt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Kt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Kt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Kt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Kt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Kt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Kt),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 Kt=[new L,new L,new L,new L,new L,new L,new L,new L],Zt=new L,Yn=new on,Kn=new L,Zn=new L,$n=new L,un=new L,hn=new L,Tn=new L,Ni=new L,ns=new L,is=new L,An=new L;function tr(o,e,t,n,i){for(let s=0,r=o.length-3;s<=r;s+=3){An.fromArray(o,s);const a=i.x*Math.abs(An.x)+i.y*Math.abs(An.y)+i.z*Math.abs(An.z),l=e.dot(An),c=t.dot(An),u=n.dot(An);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Su=new on,Ui=new L,nr=new L;class ln{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):Su.setFromPoints(e).getCenter(n);let i=0;for(let s=0,r=e.length;s<r;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.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):(nr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ui.copy(e.center).add(nr)),this.expandByPoint(Ui.copy(e.center).sub(nr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $t=new L,ir=new L,ss=new L,dn=new L,sr=new L,rs=new L,rr=new L;class Gr{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,$t)),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=$t.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($t.copy(this.origin).addScaledVector(this.direction,t),$t.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ir.copy(e).add(t).multiplyScalar(.5),ss.copy(t).sub(e).normalize(),dn.copy(this.origin).sub(ir);const s=e.distanceTo(t)*.5,r=-this.direction.dot(ss),a=dn.dot(this.direction),l=-dn.dot(ss),c=dn.lengthSq(),u=Math.abs(1-r*r);let h,d,p,g;if(u>0)if(h=r*l-a,d=r*a-l,g=s*u,h>=0)if(d>=-g)if(d<=g){const _=1/u;h*=_,d*=_,p=h*(h+r*d+2*a)+d*(r*h+d+2*l)+c}else d=s,h=Math.max(0,-(r*d+a)),p=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(r*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-r*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(h=Math.max(0,-(r*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c);else d=r>0?-s:s,h=Math.max(0,-(r*d+a)),p=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(ir).addScaledVector(ss,d),p}intersectSphere(e,t){$t.subVectors(e.center,this.origin);const n=$t.dot(this.direction),i=$t.dot($t)-n*n,s=e.radius*e.radius;if(i>s)return null;const r=Math.sqrt(s-i),a=n-r,l=n+r;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,r=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,r=(e.min.y-d.y)*u),n>r||s>i||((s>n||isNaN(n))&&(n=s),(r<i||isNaN(i))&&(i=r),h>=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,$t)!==null}intersectTriangle(e,t,n,i,s){sr.subVectors(t,e),rs.subVectors(n,e),rr.crossVectors(sr,rs);let r=this.direction.dot(rr),a;if(r>0){if(i)return null;a=1}else if(r<0)a=-1,r=-r;else return null;dn.subVectors(this.origin,e);const l=a*this.direction.dot(rs.crossVectors(dn,rs));if(l<0)return null;const c=a*this.direction.dot(sr.cross(dn));if(c<0||l+c>r)return null;const u=-a*dn.dot(rr);return u<0?null:this.at(u/r,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class De{constructor(){De.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,i,s,r,a,l,c,u,h,d,p,g,_,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=i,f[1]=s,f[5]=r,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=h,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 De().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(),s=1/Jn.setFromMatrixColumn(e,1).length(),r=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]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,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,s=e.z,r=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=r*u,p=r*h,g=a*u,_=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+g*c,t[5]=d-_*c,t[9]=-a*l,t[2]=_-d*c,t[6]=g+p*c,t[10]=r*l}else if(e.order==="YXZ"){const d=l*u,p=l*h,g=c*u,_=c*h;t[0]=d+_*a,t[4]=g*a-p,t[8]=r*c,t[1]=r*h,t[5]=r*u,t[9]=-a,t[2]=p*a-g,t[6]=_+d*a,t[10]=r*l}else if(e.order==="ZXY"){const d=l*u,p=l*h,g=c*u,_=c*h;t[0]=d-_*a,t[4]=-r*h,t[8]=g+p*a,t[1]=p+g*a,t[5]=r*u,t[9]=_-d*a,t[2]=-r*c,t[6]=a,t[10]=r*l}else if(e.order==="ZYX"){const d=r*u,p=r*h,g=a*u,_=a*h;t[0]=l*u,t[4]=g*c-p,t[8]=d*c+_,t[1]=l*h,t[5]=_*c+d,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=r*l}else if(e.order==="YZX"){const d=r*l,p=r*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-d*h,t[8]=g*h+p,t[1]=h,t[5]=r*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*h+g,t[10]=d-_*h}else if(e.order==="XZY"){const d=r*l,p=r*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+_,t[5]=r*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=a*u,t[10]=_*h+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(bu,e,wu)}lookAt(e,t,n){const i=this.elements;
vendor: 14,094 bytes, line 5
5return Et.subVectors(e,t),Et.lengthSq()===0&&(Et.z=1),Et.normalize(),fn.crossVectors(n,Et),fn.lengthSq()===0&&(Math.abs(n.z)===1?Et.x+=1e-4:Et.z+=1e-4,Et.normalize(),fn.crossVectors(n,Et)),fn.normalize(),as.crossVectors(Et,fn),i[0]=fn.x,i[4]=as.x,i[8]=Et.x,i[1]=fn.y,i[5]=as.y,i[9]=Et.y,i[2]=fn.z,i[6]=as.z,i[10]=Et.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,s=this.elements,r=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],p=n[13],g=n[2],_=n[6],m=n[10],f=n[14],w=n[3],S=n[7],x=n[11],b=n[15],C=i[0],P=i[4],N=i[8],M=i[12],A=i[1],K=i[5],X=i[9],I=i[13],O=i[2],z=i[6],$=i[10],J=i[14],q=i[3],ne=i[7],ee=i[11],Me=i[15];return s[0]=r*C+a*A+l*O+c*q,s[4]=r*P+a*K+l*z+c*ne,s[8]=r*N+a*X+l*$+c*ee,s[12]=r*M+a*I+l*J+c*Me,s[1]=u*C+h*A+d*O+p*q,s[5]=u*P+h*K+d*z+p*ne,s[9]=u*N+h*X+d*$+p*ee,s[13]=u*M+h*I+d*J+p*Me,s[2]=g*C+_*A+m*O+f*q,s[6]=g*P+_*K+m*z+f*ne,s[10]=g*N+_*X+m*$+f*ee,s[14]=g*M+_*I+m*J+f*Me,s[3]=w*C+S*A+x*O+b*q,s[7]=w*P+S*K+x*z+b*ne,s[11]=w*N+S*X+x*$+b*ee,s[15]=w*M+S*I+x*J+b*Me,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],g=e[3],_=e[7],m=e[11],f=e[15];return g*(+s*l*h-i*c*h-s*a*d+n*c*d+i*a*p-n*l*p)+_*(+t*l*p-t*c*d+s*r*d-i*r*p+i*c*u-s*l*u)+m*(+t*c*h-t*a*p-s*r*h+n*r*p+s*a*u-n*c*u)+f*(-i*a*u-t*l*h+t*a*d+i*r*h-n*r*d+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],g=e[12],_=e[13],m=e[14],f=e[15],w=h*m*c-_*d*c+_*l*p-a*m*p-h*l*f+a*d*f,S=g*d*c-u*m*c-g*l*p+r*m*p+u*l*f-r*d*f,x=u*_*c-g*h*c+g*a*p-r*_*p-u*a*f+r*h*f,b=g*h*l-u*_*l-g*a*d+r*_*d+u*a*m-r*h*m,C=t*w+n*S+i*x+s*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/C;return e[0]=w*P,e[1]=(_*d*s-h*m*s-_*i*p+n*m*p+h*i*f-n*d*f)*P,e[2]=(a*m*s-_*l*s+_*i*c-n*m*c-a*i*f+n*l*f)*P,e[3]=(h*l*s-a*d*s-h*i*c+n*d*c+a*i*p-n*l*p)*P,e[4]=S*P,e[5]=(u*m*s-g*d*s+g*i*p-t*m*p-u*i*f+t*d*f)*P,e[6]=(g*l*s-r*m*s-g*i*c+t*m*c+r*i*f-t*l*f)*P,e[7]=(r*d*s-u*l*s+u*i*c-t*d*c-r*i*p+t*l*p)*P,e[8]=x*P,e[9]=(g*h*s-u*_*s-g*n*p+t*_*p+u*n*f-t*h*f)*P,e[10]=(r*_*s-g*a*s+g*n*c-t*_*c-r*n*f+t*a*f)*P,e[11]=(u*a*s-r*h*s-u*n*c+t*h*c+r*n*p-t*a*p)*P,e[12]=b*P,e[13]=(u*_*i-g*h*i+g*n*d-t*_*d-u*n*m+t*h*m)*P,e[14]=(g*a*i-r*_*i-g*n*l+t*_*l+r*n*m-t*a*m)*P,e[15]=(r*h*i-u*a*i+u*n*l-t*h*l-r*n*d+t*a*d)*P,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,a=e.y,l=e.z,c=s*r,u=s*a;return this.set(c*r+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*r,0,c*l-i*a,u*l+i*r,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,r=t._y,a=t._z,l=t._w,c=s+s,u=r+r,h=a+a,d=s*c,p=s*u,g=s*h,_=r*u,m=r*h,f=a*h,w=l*c,S=l*u,x=l*h,b=n.x,C=n.y,P=n.z;return i[0]=(1-(_+f))*b,i[1]=(p+x)*b,i[2]=(g-S)*b,i[3]=0,i[4]=(p-x)*C,i[5]=(1-(d+f))*C,i[6]=(m+w)*C,i[7]=0,i[8]=(g+S)*P,i[9]=(m-w)*P,i[10]=(1-(d+_))*P,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Jn.set(i[0],i[1],i[2]).length();const r=Jn.set(i[4],i[5],i[6]).length(),a=Jn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ft.copy(this);const c=1/s,u=1/r,h=1/a;return Ft.elements[0]*=c,Ft.elements[1]*=c,Ft.elements[2]*=c,Ft.elements[4]*=u,Ft.elements[5]*=u,Ft.elements[6]*=u,Ft.elements[8]*=h,Ft.elements[9]*=h,Ft.elements[10]*=h,t.setFromRotationMatrix(Ft),n.x=s,n.y=r,n.z=a,this}makePerspective(e,t,n,i,s,r){const a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),d=-(r+s)/(r-s),p=-2*r*s/(r-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,r){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(r-s),h=(t+e)*l,d=(n+i)*c,p=(r+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let 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}}const Jn=new L,Ft=new De,bu=new L(0,0,0),wu=new L(1,1,1),fn=new L,as=new L,Et=new L,Fa=new De,Ba=new Lt;class Os{constructor(e=0,t=0,n=0,i=Os.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,s=i[0],r=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(lt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-lt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(lt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-r,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-lt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-r,c));break;case"YZX":this._z=Math.asin(lt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-lt(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,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 Fa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fa,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ba.setFromEuler(this),this.setFromQuaternion(Ba,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}}Os.DEFAULT_ORDER="XYZ";class hl{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 Tu=0;const za=new L,Qn=new Lt,Jt=new De,os=new L,Oi=new L,Au=new L,Eu=new Lt,ka=new L(1,0,0),Va=new L(0,1,0),Ha=new L(0,0,1),Cu={type:"added"},Ga={type:"removed"};class Ke extends yn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Tu++}),this.uuid=Vt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ke.DEFAULT_UP.clone();const e=new L,t=new Os,n=new Lt,i=new L(1,1,1);function s(){n.setFromEuler(t,!1)}function r(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(r),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 De},normalMatrix:{value:new Ue}}),this.matrix=new De,this.matrixWorld=new De,this.matrixAutoUpdate=Ke.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Ke.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new hl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return 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(ka,e)}rotateY(e){return this.rotateOnAxis(Va,e)}rotateZ(e){return this.rotateOnAxis(Ha,e)}translateOnAxis(e,t){return za.copy(e).applyQuaternion(this.quaternion),this.position.add(za.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ka,e)}translateY(e){return this.translateOnAxis(Va,e)}translateZ(e){return this.translateOnAxis(Ha,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Jt.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),Oi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Jt.lookAt(Oi,os,this.up):Jt.lookAt(os,Oi,this.up),this.quaternion.setFromRotationMatrix(Jt),i&&(Jt.extractRotation(i.matrixWorld),Qn.setFromRotationMatrix(Jt),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(Cu)):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(Ga)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(Ga)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Jt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Jt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Jt),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 r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t){let n=[];this[e]===t&&n.push(this);for(let i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectsByProperty(e,t);r.length>0&&(n=n.concat(r))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,e,Au),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,Eu,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
vendor: 9,175 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,r=i.length;s<r;s++){const a=i[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const 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()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.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=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=r(e.geometries),l=r(e.materials),c=r(e.textures),u=r(e.images),h=r(e.shapes),d=r(e.skeletons),p=r(e.animations),g=r(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=i,n;function r(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.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}}Ke.DEFAULT_UP=new L(0,1,0);Ke.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ke.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new L,Qt=new L,ar=new L,en=new L,ei=new L,ti=new L,Wa=new L,or=new L,lr=new L,cr=new L;let ls=!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),Bt.subVectors(e,t),i.cross(Bt);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Bt.subVectors(i,t),Qt.subVectors(n,t),ar.subVectors(e,t);const r=Bt.dot(Bt),a=Bt.dot(Qt),l=Bt.dot(ar),c=Qt.dot(Qt),u=Qt.dot(ar),h=r*c-a*a;if(h===0)return s.set(-2,-1,-1);const d=1/h,p=(c*l-a*u)*d,g=(r*u-a*l)*d;return s.set(1-p-g,g,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,en),en.x>=0&&en.y>=0&&en.x+en.y<=1}static getUV(e,t,n,i,s,r,a,l){return ls===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ls=!0),this.getInterpolation(e,t,n,i,s,r,a,l)}static getInterpolation(e,t,n,i,s,r,a,l){return this.getBarycoord(e,t,n,i,en),l.setScalar(0),l.addScaledVector(s,en.x),l.addScaledVector(r,en.y),l.addScaledVector(a,en.z),l}static isFrontFacing(e,t,n,i){return Bt.subVectors(n,t),Qt.subVectors(e,t),Bt.cross(Qt).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 Bt.subVectors(this.c,this.b),Qt.subVectors(this.a,this.b),Bt.cross(Qt).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,s){return ls===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ls=!0),kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}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,s=this.c;let r,a;ei.subVectors(i,n),ti.subVectors(s,n),or.subVectors(e,n);const l=ei.dot(or),c=ti.dot(or);if(l<=0&&c<=0)return t.copy(n);lr.subVectors(e,i);const u=ei.dot(lr),h=ti.dot(lr);if(u>=0&&h<=u)return t.copy(i);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return r=l/(l-u),t.copy(n).addScaledVector(ei,r);cr.subVectors(e,s);const p=ei.dot(cr),g=ti.dot(cr);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(n).addScaledVector(ti,a);const m=u*g-p*h;if(m<=0&&h-u>=0&&p-g>=0)return Wa.subVectors(s,i),a=(h-u)/(h-u+(p-g)),t.copy(i).addScaledVector(Wa,a);const f=1/(m+_+d);return r=_*f,a=d*f,t.copy(n).addScaledVector(ei,r).addScaledVector(ti,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Lu=0;class qt extends yn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Lu++}),this.uuid=Vt(),this.name="",this.type="Material",this.blending=mi,this.side=an,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Ko,this.blendDst=Zo,this.blendEquation=hi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Tr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=eu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zs,this.stencilZFail=Zs,this.stencilZPass=Zs,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.5,type:"Material",generator:"Material.toJSON"}};
vendor: 7,634 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.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!==mi&&(n.blending=this.blending),this.side!==an&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const r=[];for(const a in s){const l=s[a];delete l.metadata,r.push(l)}return r}if(t){const s=i(e.textures),r=i(e.images);s.length>0&&(n.textures=s),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const dl={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},zt={h:0,s:0,l:0},cs={h:0,s:0,l:0};function ur(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}class Te{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=At.workingColorSpace){return this.r=e,this.g=t,this.b=n,At.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=At.workingColorSpace){if(e=Hr(e,1),t=lt(t,0,1),n=lt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,r=2*n-s;this.r=ur(r,s,e+1/3),this.g=ur(r,s,e),this.b=ur(r,s,e-1/3)}return At.toWorkingColorSpace(this,i),this}setStyle(e,t=Wt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,At.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,At.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return n(s[4]),this.setHSL(l,c,u,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(r===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wt){const n=dl[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=_i(e.r),this.g=_i(e.g),this.b=_i(e.b),this}copyLinearToSRGB(e){return this.r=Js(e.r),this.g=Js(e.g),this.b=Js(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wt){return At.fromWorkingColorSpace(pt.copy(this),e),lt(pt.r*255,0,255)<<16^lt(pt.g*255,0,255)<<8^lt(pt.b*255,0,255)<<0}getHexString(e=Wt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.fromWorkingColorSpace(pt.copy(this),t);const n=pt.r,i=pt.g,s=pt.b,r=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+r)/2;if(a===r)l=0,c=0;else{const h=r-a;switch(c=u<=.5?h/(r+a):h/(2-r-a),r){case n:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-n)/h+2;break;case s:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=At.workingColorSpace){return At.fromWorkingColorSpace(pt.copy(this),t),e.r=pt.r,e.g=pt.g,e.b
vendor: 5,495 bytes, line 5
5=pt.b,e}getStyle(e=Wt){At.fromWorkingColorSpace(pt.copy(this),e);const t=pt.r,n=pt.g,i=pt.b;return e!==Wt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${t*255|0},${n*255|0},${i*255|0})`}offsetHSL(e,t,n){return this.getHSL(zt),zt.h+=e,zt.s+=t,zt.l+=n,this.setHSL(zt.h,zt.s,zt.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(zt),e.getHSL(cs);const n=ji(zt.h,cs.h,t),i=ji(zt.s,cs.s,t),s=ji(zt.l,cs.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[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 pt=new Te;Te.NAMES=dl;class In extends qt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Te(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=$o,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 nt=new L,us=new Ae;class yt{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=Rr,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)us.fromBufferAttribute(this,t),us.applyMatrix3(e),this.setXY(t,us.x,us.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)nt.fromBufferAttribute(this,t),nt.applyMatrix3(e),this.setXYZ(t,nt.x,nt.y,nt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)nt.fromBufferAttribute(this,t),nt.applyMatrix4(e),this.setXYZ(t,nt.x,nt.y,nt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)nt.fromBufferAttribute(this,t),nt.applyNormalMatrix(e),this.setXYZ(t,nt.x,nt.y,nt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)nt.fromBufferAttribute(this,t),nt.transformDirection(e),this.setXYZ(t,nt.x,nt.y,nt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ge(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ge(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=sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ge(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=sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ge(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ge(t,this.array),n=Ge(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=Ge(t,this.array),n=Ge(n,this.array),i=Ge(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Ge(t,this.array),n=Ge(n,this.array),i=Ge(i,this.array),s=Ge(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 3,484 bytes, line 5
5onUpload(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!==Rr&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class fl extends yt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class pl extends yt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class ut extends yt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Ru=0;const It=new De,hr=new Ke,ni=new L,Ct=new on,Fi=new on,at=new L;class Rt extends yn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ru++}),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(ol(e)?pl:fl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ue().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return It.makeRotationFromQuaternion(e),this.applyMatrix4(It),this}rotateX(e){return It.makeRotationX(e),this.applyMatrix4(It),this}rotateY(e){return It.makeRotationY(e),this.applyMatrix4(It),this}rotateZ(e){return It.makeRotationZ(e),this.applyMatrix4(It),this}translate(e,t,n){return It.makeTranslation(e,t,n),this.applyMatrix4(It),this}scale(e,t,n){return It.makeScale(e,t,n),this.applyMatrix4(It),this}lookAt(e){return hr.lookAt(e),hr.updateMatrix(),this.applyMatrix4(hr.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 s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ut(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new on);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 s=t[n];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(at.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(at),at.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(at)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ln);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(Ct.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){const a=t[s];Fi.setFromBufferAttribute(a),this.morphTargetsRelative?(at.addVectors(Ct.min,Fi.min),Ct.expandByPoint(at),at.addVectors(Ct.max,Fi.max),Ct.expandByPoint(at)):(Ct.expandByPoint(Fi.min),Ct.expandByPoint(Fi.max))}Ct.getCenter(n);let i=0;for(let s=0,r=e.count;s<r;s++)at.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(at));if(t)for(let s=0,r=t.length;s<r;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)at.fromBufferAttribute(a,c),l&&(ni.fromBufferAttribute(e,c),at.add(ni)),i=Math.max(i,n.distanceToSquared(at))}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,s=t.normal.array,r=t.uv.array,a=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new yt(new Float32Array(4*a),4));const l=this.getAttribute("tangent").array,c=[],u=[];for(let A=0;A<a;A++)c[A]=new L,u[A]=new L;const h=new L,d=new L,p=new L,g=new Ae,_=new Ae,m=new Ae,f=new L,w=new L;function S(A,K,X){h.fromArray(i,A*3),d.fromArray(i,K*3),p.fromArray(i,X*3),g.fromArray(r,A*2),_.fromArray(r,K*2),m.fromArray(r,X*2),d.sub(h),p.sub(h),_.sub(g),m.sub(g);const I=1/(_.x*m.y-m.x*_.y);isFinite(I)&&(f.copy(d).multiplyScalar(m.y).addScaledVector(p,-_.y).multiplyScalar(I),w.copy(p).multiplyScalar(_.x).addScaledVector(d,-m.x).multiplyScalar(I),c[A].add(f),c[K].add(f),c[X].add(f),u[A].add(w),u[K].add(w),u[X].add(w))}let x=this.groups;x.length===0&&(x=[{start:0,count:n.length}]);for(let A=0,K=x.length;A<K;++A){const X=x[A],I=X.start,O=X.count;for(let z=I,$=I+O;z<$;z+=3)S(n[z+0],n[z+1],n[z+2])}const b=new L,C=new L,P=new L,N=new L;function M(A){P.fromArray(s,A*3),N.copy(P);const K=c[A];b.copy(K),b.sub(P.multiplyScalar(P.dot(K))).normalize(),C.crossVectors(N,K);const I=C.dot(u[A])<0?-1:1;l[A*4]=b.x,l[A*4+1]=b.y,l[A*4+2]=b.z,l[A*4+3]=I}for(let A=0,K=x.length;A<K;++A){const X=x[A],I=X.start,O=X.count;for(let z=I,$=I+O;z<$;z+=3)M(n[z+0]),M(n[z+1]),M(n[z+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new yt(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,s=new L,r=new L,a=new L,l=new L,c=new L,u=new L,h=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),s.fromBufferAttribute(t,_),r.fromBufferAttribute(t,m),u.subVectors(r,s),h.subVectors(i,s),u.cross(h),a.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),a.add(u),l.add(u),c.add(u),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,p=t.count;d<p;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),r.fromBufferAttribute(t,d+2),u.subVectors(r,s),h.subVectors(i,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)at.fromBufferAttribute(e,t),at.normalize(),e.setXYZ(t,at.x,at.y,at.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let p=0,g=0;for(let _=0,m=l.length;_<m;_++){a.isInterleavedBufferAttribute?p=l[_]*a.data.stride+a.offset:p=l[_]*u;for(let f=0;f<u;f++)d[g++]=c[p++]}return new yt(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Rt,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],p=e(d,n);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let a=0,l=r.length;a<l;a++){const c=r[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 4,852 bytes, line 5
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 l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let c=0,u=r.length;c<u;c++){const h=r[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Xa=new De,Gt=new Gr,hs=new ln,ja=new L,ii=new L,si=new L,ri=new L,dr=new L,ds=new L,fs=new Ae,ps=new Ae,ms=new Ae,qa=new L,Ya=new L,Ka=new L,gs=new L,_s=new L;class mt extends Ke{constructor(e=new Rt,t=new In){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,r=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){ds.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(dr.fromBufferAttribute(h,e),r?ds.addScaledVector(dr,u):ds.addScaledVector(dr.sub(t),u))}t.add(ds)}return this.isSkinnedMesh&&this.applyBoneTransform(e,t),t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),hs.copy(n.boundingSphere),hs.applyMatrix4(s),Gt.copy(e.ray).recast(e.near),hs.containsPoint(Gt.origin)===!1&&(Gt.intersectSphere(hs,ja)===null||Gt.origin.distanceToSquared(ja)>(e.far-e.near)**2))||(Xa.copy(s).invert(),Gt.copy(e.ray).applyMatrix4(Xa),n.boundingBox!==null&&Gt.intersectsBox(n.boundingBox)===!1))return;let r;const a=n.index,l=n.attributes.position,c=n.attributes.uv,u=n.attributes.uv2,h=n.attributes.normal,d=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(i))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=i[m.materialIndex],w=Math.max(m.start,p.start),S=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let x=w,b=S;x<b;x+=3){const C=a.getX(x),P=a.getX(x+1),N=a.getX(x+2);r=xs(this,f,e,Gt,c,u,h,C,P,N),r&&(r.faceIndex=Math.floor(x/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(a.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const w=a.getX(m),S=a.getX(m+1),x=a.getX(m+2);r=xs(this,i,e,Gt,c,u,h,w,S,x),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(i))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=i[m.materialIndex],w=Math.max(m.start,p.start),S=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let x=w,b=S;x<b;x+=3){const C=x,P=x+1,N=x+2;r=xs(this,f,e,Gt,c,u,h,C,P,N),r&&(r.faceIndex=Math.floor(x/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(l.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const w=m,S=m+1,x=m+2;
vendor: 11,627 bytes, lines 5-44
5r=xs(this,i,e,Gt,c,u,h,w,S,x),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function Pu(o,e,t,n,i,s,r,a){let l;if(e.side===bt?l=n.intersectTriangle(r,s,i,!0,a):l=n.intersectTriangle(i,s,r,e.side===an,a),l===null)return null;_s.copy(a),_s.applyMatrix4(o.matrixWorld);const c=t.ray.origin.distanceTo(_s);return c<t.near||c>t.far?null:{distance:c,point:_s.clone(),object:o}}function xs(o,e,t,n,i,s,r,a,l,c){o.getVertexPosition(a,ii),o.getVertexPosition(l,si),o.getVertexPosition(c,ri);const u=Pu(o,e,t,n,ii,si,ri,gs);if(u){i&&(fs.fromBufferAttribute(i,a),ps.fromBufferAttribute(i,l),ms.fromBufferAttribute(i,c),u.uv=kt.getInterpolation(gs,ii,si,ri,fs,ps,ms,new Ae)),s&&(fs.fromBufferAttribute(s,a),ps.fromBufferAttribute(s,l),ms.fromBufferAttribute(s,c),u.uv2=kt.getInterpolation(gs,ii,si,ri,fs,ps,ms,new Ae)),r&&(qa.fromBufferAttribute(r,a),Ya.fromBufferAttribute(r,l),Ka.fromBufferAttribute(r,c),u.normal=kt.getInterpolation(gs,ii,si,ri,qa,Ya,Ka,new L),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new L,materialIndex:0};kt.getNormal(ii,si,ri,h.normal),u.face=h}return u}class Ci extends Rt{constructor(e=1,t=1,n=1,i=1,s=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:r};const a=this;i=Math.floor(i),s=Math.floor(s),r=Math.floor(r);const l=[],c=[],u=[],h=[];let d=0,p=0;g("z","y","x",-1,-1,n,t,e,r,s,0),g("z","y","x",1,-1,n,t,-e,r,s,1),g("x","z","y",1,1,e,n,t,i,r,2),g("x","z","y",1,-1,e,n,-t,i,r,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new ut(c,3)),this.setAttribute("normal",new ut(u,3)),this.setAttribute("uv",new ut(h,2));function g(_,m,f,w,S,x,b,C,P,N,M){const A=x/P,K=b/N,X=x/2,I=b/2,O=C/2,z=P+1,$=N+1;let J=0,q=0;const ne=new L;for(let ee=0;ee<$;ee++){const Me=ee*K-I;for(let ie=0;ie<z;ie++){const V=ie*A-X;ne[_]=V*w,ne[m]=Me*S,ne[f]=O,c.push(ne.x,ne.y,ne.z),ne[_]=0,ne[m]=0,ne[f]=C>0?1:-1,u.push(ne.x,ne.y,ne.z),h.push(ie/P),h.push(1-ee/N),J+=1}}for(let ee=0;ee<N;ee++)for(let Me=0;Me<P;Me++){const ie=d+Me+z*ee,V=d+Me+z*(ee+1),Y=d+(Me+1)+z*(ee+1),ae=d+(Me+1)+z*ee;l.push(ie,V,ae),l.push(V,Y,ae),q+=6}a.addGroup(p,q,M),p+=q,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ci(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ai(o){const e={};for(const t in o){e[t]={};for(const n in o[t]){const i=o[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 vt(o){const e={};for(let t=0;t<o.length;t++){const n=Ai(o[t]);for(const i in n)e[i]=n[i]}return e}function Iu(o){const e=[];for(let t=0;t<o.length;t++)e.push(o[t].clone());return e}function ml(o){return o.getRenderTarget()===null&&o.outputEncoding===ke?Wt:Ki}const Du={clone:Ai,merge:vt};var Nu=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,Uu=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class kn extends qt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Nu,this.fragmentShader=Uu,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],uv2:[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=Ai(e.uniforms),this.uniformsGroups=Iu(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 r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class gl extends Ke{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new De,this.projectionMatrix=new De,this.projectionMatrixInverse=new De}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Mt extends gl{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=Ti*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xi*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ti*2*Math.atan(Math.tan(Xi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,r){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Xi*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const r=this.view;if(this.view!==null&&this.view.enabled){const l=r.fullWidth,c=r.fullHeight;s+=r.offsetX*i/l,t-=r.offsetY*n/c,i*=r.width/l,n*=r.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ai=-90,oi=1;class Ou extends Ke{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new Mt(ai,oi,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new Mt(ai,oi,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const r=new Mt(ai,oi,e,t);r.layers=this.layers,r.up.set(0,0,-1),r.lookAt(0,1,0),this.add(r);const a=new Mt(ai,oi,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Mt(ai,oi,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new Mt(ai,oi,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,r,a,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,d=e.xr.enabled;e.toneMapping=rn,e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,r),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class _l extends ct{constructor(e,t,n,i,s,r,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Mi,super(e,t,n,i,s,r,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Fu extends zn{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];this.texture=new _l(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:St}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},i=new Ci(5,5,5),s=new kn({name:"CubemapFromEquirect",uniforms:Ai(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:bt,blending:vn});s.uniforms.tEquirect.value=t;const r=new mt(i,s),a=t.minFilter;return t.minFilter===On&&(t.minFilter=St),new Ou(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(s)}}const fr=new L,Bu=new L,zu=new Ue;class Cn{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}
vendor: 6,459 bytes, lines 44-55
44setFromCoplanarPoints(e,t,n){const i=fr.subVectors(n,t).cross(Bu.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(fr),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||zu.getNormalMatrix(e),i=this.coplanarPoint(fr).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const En=new ln,vs=new L;class Wr{constructor(e=new Cn,t=new Cn,n=new Cn,i=new Cn,s=new Cn,r=new Cn){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(r),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],r=n[2],a=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],p=n[9],g=n[10],_=n[11],m=n[12],f=n[13],w=n[14],S=n[15];return t[0].setComponents(a-i,h-l,_-d,S-m).normalize(),t[1].setComponents(a+i,h+l,_+d,S+m).normalize(),t[2].setComponents(a+s,h+c,_+p,S+f).normalize(),t[3].setComponents(a-s,h-c,_-p,S-f).normalize(),t[4].setComponents(a-r,h-u,_-g,S-w).normalize(),t[5].setComponents(a+r,h+u,_+g,S+w).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),En.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),En.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(En)}intersectsSprite(e){return En.center.set(0,0,0),En.radius=.7071067811865476,En.applyMatrix4(e.matrixWorld),this.intersectsSphere(En)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(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 xl(){let o=null,e=!1,t=null,n=null;function i(s,r){t(s,r),n=o.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=o.requestAnimationFrame(i),e=!0)},stop:function(){o.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){o=s}}}function ku(o,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const h=c.array,d=c.usage,p=o.createBuffer();o.bindBuffer(u,p),o.bufferData(u,h,d),c.onUploadCallback();let g;if(h instanceof Float32Array)g=5126;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=5123;else if(h instanceof Int16Array)g=5122;else if(h instanceof Uint32Array)g=5125;else if(h instanceof Int32Array)g=5124;else if(h instanceof Int8Array)g=5120;else if(h instanceof Uint8Array)g=5121;else if(h instanceof Uint8ClampedArray)g=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const d=u.array,p=u.updateRange;o.bindBuffer(h,c),p.count===-1?o.bufferSubData(h,0,d):(t?o.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):o.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function r(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(o.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const d=n.get(c);(!d||d.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=n.get(c);h===void 0?n.set(c,i(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:r,remove:a,update:l}}class Xr extends Rt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,r=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,u=l+1,h=e/a,d=t/l,p=[],g=[],_=[],m=[];for(let f=0;f<u;f++){const w=f*d-r;for(let S=0;S<c;S++){const x=S*h-s;g.push(x,-w,0),_.push(0,0,1),m.push(S/a),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let w=0;w<a;w++){const S=w+c*f,x=w+c*(f+1),b=w+1+c*(f+1),C=w+1+c*f;p.push(S,x,C),p.push(x,b,C)}this.setIndex(p),this.setAttribute("position",new ut(g,3)),this.setAttribute("normal",new ut(_,3)),this.setAttribute("uv",new ut(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Vu=`#ifdef USE_ALPHAMAP 45 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 46#endif`,Hu=`#ifdef USE_ALPHAMAP 47 uniform sampler2D alphaMap; 48#endif`,Gu=`#ifdef USE_ALPHATEST 49 if ( diffuseColor.a < alphaTest ) discard; 50#endif`,Wu=`#ifdef USE_ALPHATEST 51 uniform float alphaTest; 52#endif`,Xu=`#ifdef USE_AOMAP 53 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 54 reflectedLight.indirectDiffuse *= ambientOcclusion; 55 #if defined( USE_ENVMAP ) && defined( STANDARD )
56 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 57 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 58 #endif 59#endif`,ju=`#ifdef USE_AOMAP 60 uniform sampler2D aoMap; 61 uniform float aoMapIntensity; 62#endif`,qu="vec3 transformed = vec3( position );",Yu=`vec3 objectNormal = vec3( normal ); 63#ifdef USE_TANGENT 64 vec3 objectTangent = vec3( tangent.xyz ); 65#endif`,Ku=`float G_BlinnPhong_Implicit( ) { 66 return 0.25; 67} 68float D_BlinnPhong( const in float shininess, const in float dotNH ) { 69 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 70} 71vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 72 vec3 halfDir = normalize( lightDir + viewDir ); 73 float dotNH = saturate( dot( normal, halfDir ) ); 74 float dotVH = saturate( dot( viewDir, halfDir ) ); 75 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 76 float G = G_BlinnPhong_Implicit( ); 77 float D = D_BlinnPhong( shininess, dotNH ); 78 return F * ( G * D ); 79} // validated`,Zu=`#ifdef USE_IRIDESCENCE 80 const mat3 XYZ_TO_REC709 = mat3( 81 3.2404542, -0.9692660, 0.0556434, 82 -1.5371385, 1.8760108, -0.2040259, 83 -0.4985314, 0.0415560, 1.0572252 84 ); 85 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 86 vec3 sqrtF0 = sqrt( fresnel0 ); 87 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 88 } 89 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 90 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 91 } 92 float IorToFresnel0( float transmittedIor, float incidentIor ) { 93 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 94 } 95 vec3 evalSensitivity( float OPD, vec3 shift ) { 96 float phase = 2.0 * PI * OPD * 1.0e-9; 97 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 98 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 99 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 100 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 101 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 102 xyz /= 1.0685e-7; 103 vec3 rgb = XYZ_TO_REC709 * xyz; 104 return rgb; 105 } 106 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 107 vec3 I; 108 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 109 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 110 float cosTheta2Sq = 1.0 - sinTheta2Sq; 111 if ( cosTheta2Sq < 0.0 ) { 112 return vec3( 1.0 ); 113 } 114 float cosTheta2 = sqrt( cosTheta2Sq ); 115 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 116 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 117 float R21 = R12;
118 float T121 = 1.0 - R12; 119 float phi12 = 0.0; 120 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 121 float phi21 = PI - phi12; 122 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 123 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 124 vec3 phi23 = vec3( 0.0 ); 125 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 126 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 127 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 128 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 129 vec3 phi = vec3( phi21 ) + phi23; 130 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 131 vec3 r123 = sqrt( R123 ); 132 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 133 vec3 C0 = R12 + Rs; 134 I = C0; 135 vec3 Cm = Rs - T121; 136 for ( int m = 1; m <= 2; ++ m ) { 137 Cm *= r123; 138 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 139 I += Cm * Sm; 140 } 141 return max( I, vec3( 0.0 ) ); 142 } 143#endif`,$u=`#ifdef USE_BUMPMAP 144 uniform sampler2D bumpMap; 145 uniform float bumpScale; 146 vec2 dHdxy_fwd() { 147 vec2 dSTdx = dFdx( vBumpMapUv ); 148 vec2 dSTdy = dFdy( vBumpMapUv ); 149 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 150 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 151 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 152 return vec2( dBx, dBy ); 153 } 154 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 155 vec3 vSigmaX = dFdx( surf_pos.xyz ); 156 vec3 vSigmaY = dFdy( surf_pos.xyz ); 157 vec3 vN = surf_norm; 158 vec3 R1 = cross( vSigmaY, vN ); 159 vec3 R2 = cross( vN, vSigmaX ); 160 float fDet = dot( vSigmaX, R1 ) * faceDirection; 161 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 162 return normalize( abs( fDet ) * surf_norm - vGrad ); 163 } 164#endif`,Ju=`#if NUM_CLIPPING_PLANES > 0 165 vec4 plane; 166 #pragma unroll_loop_start 167 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 168 plane = clippingPlanes[ i ]; 169 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 170 } 171 #pragma unroll_loop_end 172 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 173 bool clipped = true; 174 #pragma unroll_loop_start 175 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 176 plane = clippingPlanes[ i ]; 177 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 178 } 179 #pragma unroll_loop_end 180 if ( clipped ) discard; 181 #endif 182#endif`,Qu=`#if NUM_CLIPPING_PLANES > 0 183 varying vec3 vClipPosition; 184 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 185#endif`,eh=`#if NUM_CLIPPING_PLANES > 0 186 varying vec3 vClipPosition; 187#endif`,th=`#if NUM_CLIPPING_PLANES > 0 188 vClipPosition = - mvPosition.xyz; 189#endif`,nh=`#if defined( USE_COLOR_ALPHA ) 190 diffuseColor *= vColor; 191#elif defined( USE_COLOR ) 192 diffuseColor.rgb *= vColor; 193#endif`,ih=`#if defined( USE_COLOR_ALPHA ) 194 varying vec4 vColor; 195#elif defined( USE_COLOR ) 196 varying vec3 vColor; 197#endif`,sh=`#if defined( USE_COLOR_ALPHA ) 198 varying vec4 vColor; 199#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 200 varying vec3 vColor; 201#endif`,rh=`#if defined( USE_COLOR_ALPHA ) 202 vColor = vec4( 1.0 ); 203#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 204 vColor = vec3( 1.0 ); 205#endif 206#ifdef USE_COLOR 207 vColor *= color; 208#endif 209#ifdef USE_INSTANCING_COLOR 210 vColor.xyz *= instanceColor.xyz; 211#endif`,ah=`#define PI 3.141592653589793 212#define PI2 6.283185307179586 213#define PI_HALF 1.5707963267948966 214#define RECIPROCAL_PI 0.3183098861837907 215#define RECIPROCAL_PI2 0.15915494309189535 216#define EPSILON 1e-6 217#ifndef saturate 218#define saturate( a ) clamp( a, 0.0, 1.0 ) 219#endif 220#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 221float pow2( const in float x ) { return x*x; } 222vec3 pow2( const in vec3 x ) { return x*x; } 223float pow3( const in float x ) { return x*x*x; } 224float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 225float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 226float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 227highp float rand( const in vec2 uv ) { 228 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 229 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 230 return fract( sin( sn ) * c ); 231} 232#ifdef HIGH_PRECISION 233 float precisionSafeLength( vec3 v ) { return length( v ); } 234#else 235 float precisionSafeLength( vec3 v ) { 236 float maxComponent = max3( abs( v ) ); 237 return length( v / maxComponent ) * maxComponent; 238 } 239#endif 240struct IncidentLight { 241 vec3 color; 242 vec3 direction; 243 bool visible; 244}; 245struct ReflectedLight { 246 vec3 directDiffuse; 247 vec3 directSpecular; 248 vec3 indirectDiffuse; 249 vec3 indirectSpecular; 250}; 251struct GeometricContext { 252 vec3 position; 253 vec3 normal; 254 vec3 viewDir; 255#ifdef USE_CLEARCOAT 256 vec3 clearcoatNormal; 257#endif 258}; 259vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 260 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 261} 262vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 263 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 264} 265mat3 transposeMat3( const in mat3 m ) { 266 mat3 tmp; 267 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 268 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 269 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 270 return tmp; 271} 272float luminance( const in vec3 rgb ) { 273 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 274 return dot( weights, rgb ); 275} 276bool isPerspectiveMatrix( mat4 m ) { 277 return m[ 2 ][ 3 ] == - 1.0; 278} 279vec2 equirectUv( in vec3 dir ) { 280 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 281 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 282 return vec2( u, v ); 283}
284vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 285 return RECIPROCAL_PI * diffuseColor; 286} 287vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 288 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 289 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 290} 291float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 292 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 293 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 294} // validated`,oh=`#ifdef ENVMAP_TYPE_CUBE_UV 295 #define cubeUV_minMipLevel 4.0 296 #define cubeUV_minTileSize 16.0 297 float getFace( vec3 direction ) { 298 vec3 absDirection = abs( direction ); 299 float face = - 1.0; 300 if ( absDirection.x > absDirection.z ) { 301 if ( absDirection.x > absDirection.y ) 302 face = direction.x > 0.0 ? 0.0 : 3.0; 303 else 304 face = direction.y > 0.0 ? 1.0 : 4.0; 305 } else { 306 if ( absDirection.z > absDirection.y ) 307 face = direction.z > 0.0 ? 2.0 : 5.0; 308 else 309 face = direction.y > 0.0 ? 1.0 : 4.0; 310 } 311 return face; 312 } 313 vec2 getUV( vec3 direction, float face ) { 314 vec2 uv; 315 if ( face == 0.0 ) { 316 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 317 } else if ( face == 1.0 ) { 318 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 319 } else if ( face == 2.0 ) { 320 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 321 } else if ( face == 3.0 ) { 322 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 323 } else if ( face == 4.0 ) { 324 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 325 } else { 326 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 327 } 328 return 0.5 * ( uv + 1.0 ); 329 } 330 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 331 float face = getFace( direction ); 332 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 333 mipInt = max( mipInt, cubeUV_minMipLevel ); 334 float faceSize = exp2( mipInt ); 335 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 336 if ( face > 2.0 ) { 337 uv.y += faceSize; 338 face -= 3.0; 339 } 340 uv.x += face * faceSize; 341 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 342 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 343 uv.x *= CUBEUV_TEXEL_WIDTH; 344 uv.y *= CUBEUV_TEXEL_HEIGHT; 345 #ifdef texture2DGradEXT 346 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 347 #else 348 return texture2D( envMap, uv ).rgb; 349 #endif 350 } 351 #define cubeUV_r0 1.0 352 #define cubeUV_v0 0.339 353 #define cubeUV_m0 - 2.0 354 #define cubeUV_r1 0.8 355 #define cubeUV_v1 0.276 356 #define cubeUV_m1 - 1.0 357 #define cubeUV_r4 0.4 358 #define cubeUV_v4 0.046 359 #define cubeUV_m4 2.0 360 #define cubeUV_r5 0.305 361 #define cubeUV_v5 0.016 362 #define cubeUV_m5 3.0 363 #define cubeUV_r6 0.21 364 #define cubeUV_v6 0.0038 365 #define cubeUV_m6 4.0 366 float roughnessToMip( float roughness ) { 367 float mip = 0.0; 368 if ( roughness >= cubeUV_r1 ) { 369 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 370 } else if ( roughness >= cubeUV_r4 ) { 371 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 372 } else if ( roughness >= cubeUV_r5 ) { 373 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 374 } else if ( roughness >= cubeUV_r6 ) { 375 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 376 } else { 377 mip = - 2.0 * log2( 1.16 * roughness ); } 378 return mip; 379 } 380 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 381 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 382 float mipF = fract( mip ); 383 float mipInt = floor( mip ); 384 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 385 if ( mipF == 0.0 ) { 386 return vec4( color0, 1.0 ); 387 } else { 388 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 389 return vec4( mix( color0, color1, mipF ), 1.0 ); 390 } 391 } 392#endif`,lh=`vec3 transformedNormal = objectNormal; 393#ifdef USE_INSTANCING 394 mat3 m = mat3( instanceMatrix ); 395 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 396 transformedNormal = m * transformedNormal; 397#endif 398transformedNormal = normalMatrix * transformedNormal; 399#ifdef FLIP_SIDED 400 transformedNormal = - transformedNormal; 401#endif 402#ifdef USE_TANGENT 403 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 404 #ifdef FLIP_SIDED 405 transformedTangent = - transformedTangent; 406 #endif 407#endif`,ch=`#ifdef USE_DISPLACEMENTMAP 408 uniform sampler2D displacementMap; 409 uniform float displacementScale; 410 uniform float displacementBias; 411#endif`,uh=`#ifdef USE_DISPLACEMENTMAP 412 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
412placementBias ); 413#endif`,hh=`#ifdef USE_EMISSIVEMAP 414 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 415 totalEmissiveRadiance *= emissiveColor.rgb; 416#endif`,dh=`#ifdef USE_EMISSIVEMAP 417 uniform sampler2D emissiveMap; 418#endif`,fh="gl_FragColor = linearToOutputTexel( gl_FragColor );",ph=`vec4 LinearToLinear( in vec4 value ) { 419 return value; 420} 421vec4 LinearTosRGB( in vec4 value ) { 422 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 423}`,mh=`#ifdef USE_ENVMAP 424 #ifdef ENV_WORLDPOS 425 vec3 cameraToFrag; 426 if ( isOrthographic ) { 427 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 428 } else { 429 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 430 } 431 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 432 #ifdef ENVMAP_MODE_REFLECTION 433 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 434 #else 435 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 436 #endif 437 #else 438 vec3 reflectVec = vReflect; 439 #endif 440 #ifdef ENVMAP_TYPE_CUBE 441 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 442 #else 443 vec4 envColor = vec4( 0.0 ); 444 #endif 445 #ifdef ENVMAP_BLENDING_MULTIPLY 446 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 447 #elif defined( ENVMAP_BLENDING_MIX ) 448 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 449 #elif defined( ENVMAP_BLENDING_ADD ) 450 outgoingLight += envColor.xyz * specularStrength * reflectivity; 451 #endif 452#endif`,gh=`#ifdef USE_ENVMAP 453 uniform float envMapIntensity; 454 uniform float flipEnvMap; 455 #ifdef ENVMAP_TYPE_CUBE 456 uniform samplerCube envMap; 457 #else 458 uniform sampler2D envMap; 459 #endif 460 461#endif`,_h=`#ifdef USE_ENVMAP 462 uniform float reflectivity; 463 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 464 #define ENV_WORLDPOS 465 #endif 466 #ifdef ENV_WORLDPOS 467 varying vec3 vWorldPosition; 468 uniform float refractionRatio; 469 #else 470 varying vec3 vReflect; 471 #endif 472#endif`,xh=`#ifdef USE_ENVMAP 473 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 474 #define ENV_WORLDPOS 475 #endif 476 #ifdef ENV_WORLDPOS 477 478 varying vec3 vWorldPosition; 479 #else 480 varying vec3 vReflect; 481 uniform float refractionRatio; 482 #endif 483#endif`,vh=`#ifdef USE_ENVMAP 484 #ifdef ENV_WORLDPOS 485 vWorldPosition = worldPosition.xyz; 486 #else 487 vec3 cameraToVertex; 488 if ( isOrthographic ) { 489 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 490 } else {
491 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 492 } 493 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 494 #ifdef ENVMAP_MODE_REFLECTION 495 vReflect = reflect( cameraToVertex, worldNormal ); 496 #else 497 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 498 #endif 499 #endif 500#endif`,Mh=`#ifdef USE_FOG 501 vFogDepth = - mvPosition.z; 502#endif`,yh=`#ifdef USE_FOG 503 varying float vFogDepth; 504#endif`,Sh=`#ifdef USE_FOG 505 #ifdef FOG_EXP2 506 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 507 #else 508 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 509 #endif 510 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 511#endif`,bh=`#ifdef USE_FOG 512 uniform vec3 fogColor; 513 varying float vFogDepth; 514 #ifdef FOG_EXP2 515 uniform float fogDensity; 516 #else 517 uniform float fogNear; 518 uniform float fogFar; 519 #endif 520#endif`,wh=`#ifdef USE_GRADIENTMAP 521 uniform sampler2D gradientMap; 522#endif 523vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 524 float dotNL = dot( normal, lightDirection ); 525 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 526 #ifdef USE_GRADIENTMAP 527 return vec3( texture2D( gradientMap, coord ).r ); 528 #else 529 vec2 fw = fwidth( coord ) * 0.5; 530 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 531 #endif 532}`,Th=`#ifdef USE_LIGHTMAP 533 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 534 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 535 reflectedLight.indirectDiffuse += lightMapIrradiance; 536#endif`,Ah=`#ifdef USE_LIGHTMAP 537 uniform sampler2D lightMap; 538 uniform float lightMapIntensity; 539#endif`,Eh=`LambertMaterial material; 540material.diffuseColor = diffuseColor.rgb; 541material.specularStrength = specularStrength;`,Ch=`varying vec3 vViewPosition; 542struct LambertMaterial { 543 vec3 diffuseColor; 544 float specularStrength; 545}; 546void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 547 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 548 vec3 irradiance = dotNL * directLight.color; 549 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 550} 551void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 552 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 553} 554#define RE_Direct RE_Direct_Lambert 555#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Lh=`uniform bool receiveShadow; 556uniform vec3 ambientLightColor; 557uniform vec3 lightProbe[ 9 ]; 558vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 559 float x = normal.x, y = normal.y, z = normal.z; 560 vec3 result = shCoefficients[ 0 ] * 0.886227; 561 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 562 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 563 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 564 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 565 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 566 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 567 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 568 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 569 return result; 570} 571vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 572 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 573 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 574 return irradiance; 575} 576vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 577 vec3 irradiance = ambientLightColor; 578 return irradiance; 579} 580float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 581 #if defined ( LEGACY_LIGHTS ) 582 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 583 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 584 } 585 return 1.0; 586 #else 587 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 588 if ( cutoffDistance > 0.0 ) { 589 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 590 } 591 return distanceFalloff; 592 #endif 593} 594float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 595 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 596} 597#if NUM_DIR_LIGHTS > 0 598 struct DirectionalLight { 599 vec3 direction; 600 vec3 color; 601 }; 602 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 603 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 604 light.color = directionalLight.color; 605 light.direction = directionalLight.direction; 606 light.visible = true; 607 } 608#endif 609#if NUM_POINT_LIGHTS > 0 610 struct PointLight { 611 vec3 position; 612 vec3 color; 613 float distance; 614 float decay; 615 }; 616 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 617 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 618 vec3 lVector = pointLight.position - geometry.position; 619 light.direction = normalize( lVector ); 620 float lightDistance = length( lVector ); 621 light.color = pointLight.color; 622 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 623 light.visible = ( light.color != vec3( 0.0 ) ); 624 } 625#endif
626#if NUM_SPOT_LIGHTS > 0 627 struct SpotLight { 628 vec3 position; 629 vec3 direction; 630 vec3 color; 631 float distance; 632 float decay; 633 float coneCos; 634 float penumbraCos; 635 }; 636 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 637 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 638 vec3 lVector = spotLight.position - geometry.position; 639 light.direction = normalize( lVector ); 640 float angleCos = dot( light.direction, spotLight.direction ); 641 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 642 if ( spotAttenuation > 0.0 ) { 643 float lightDistance = length( lVector ); 644 light.color = spotLight.color * spotAttenuation; 645 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 646 light.visible = ( light.color != vec3( 0.0 ) ); 647 } else { 648 light.color = vec3( 0.0 ); 649 light.visible = false; 650 } 651 } 652#endif 653#if NUM_RECT_AREA_LIGHTS > 0 654 struct RectAreaLight { 655 vec3 color; 656 vec3 position; 657 vec3 halfWidth; 658 vec3 halfHeight; 659 }; 660 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 661 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 662#endif 663#if NUM_HEMI_LIGHTS > 0 664 struct HemisphereLight { 665 vec3 direction; 666 vec3 skyColor; 667 vec3 groundColor; 668 }; 669 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 670 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 671 float dotNL = dot( normal, hemiLight.direction ); 672 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 673 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 674 return irradiance; 675 } 676#endif`,Rh=`#if defined( USE_ENVMAP ) 677 vec3 getIBLIrradiance( const in vec3 normal ) { 678 #if defined( ENVMAP_TYPE_CUBE_UV ) 679 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 680 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 681 return PI * envMapColor.rgb * envMapIntensity; 682 #else 683 return vec3( 0.0 ); 684 #endif 685 } 686 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 687 #if defined( ENVMAP_TYPE_CUBE_UV ) 688 vec3 reflectVec = reflect( - viewDir, normal ); 689 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 690 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 691 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 692 return envMapColor.rgb * envMapIntensity; 693 #else 694 return vec3( 0.0 ); 695 #endif 696 } 697#endif`,Ph=`ToonMaterial material; 698material.diffuseColor = diffuseColor.rgb;`,Ih=`varying vec3 vViewPosition; 699struct ToonMaterial { 700 vec3 diffuseColor; 701}; 702void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 703 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 704 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 705} 706void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 707 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 708} 709#define RE_Direct RE_Direct_Toon 710#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Dh=`BlinnPhongMaterial material; 711material.diffuseColor = diffuseColor.rgb; 712material.specularColor = specular; 713material.specularShininess = shininess; 714material.specularStrength = specularStrength;`,Nh=`varying vec3 vViewPosition; 715struct BlinnPhongMaterial { 716 vec3 diffuseColor; 717 vec3 specularColor; 718 float specularShininess; 719 float specularStrength; 720}; 721void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 722 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 723 vec3 irradiance = dotNL * directLight.color; 724 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 725 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 726} 727void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 728 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 729} 730#define RE_Direct RE_Direct_BlinnPhong 731#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Uh=`PhysicalMaterial material; 732material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 733vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 734float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 735material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 736material.roughness = min( material.roughness, 1.0 ); 737#ifdef IOR 738 material.ior = ior; 739 #ifdef USE_SPECULAR 740 float specularIntensityFactor = specularIntensity; 741 vec3 specularColorFactor = specularColor; 742 #ifdef USE_SPECULAR_COLORMAP 743 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 744 #endif 745 #ifdef USE_SPECULAR_INTENSITYMAP 746 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 747 #endif 748 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 749 #else 750 float specularIntensityFactor = 1.0; 751 vec3 specularColorFactor = vec3( 1.0 ); 752 material.specularF90 = 1.0; 753 #endif 754 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 755#else 756 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 757 material.specularF90 = 1.0; 758#endif 759#ifdef USE_CLEARCOAT 760 material.clearcoat = clearcoat; 761 material.clearcoatRoughness = clearcoatRoughness; 762 material.clearcoatF0 = vec3( 0.04 ); 763 material.clearcoatF90 = 1.0; 764 #ifdef USE_CLEARCOATMAP 765 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 766 #endif 767 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 768 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 769 #endif 770 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 771 material.clearcoatRoughness += geometryRoughness; 772 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 773#endif
774#ifdef USE_IRIDESCENCE 775 material.iridescence = iridescence; 776 material.iridescenceIOR = iridescenceIOR; 777 #ifdef USE_IRIDESCENCEMAP 778 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 779 #endif 780 #ifdef USE_IRIDESCENCE_THICKNESSMAP 781 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 782 #else 783 material.iridescenceThickness = iridescenceThicknessMaximum; 784 #endif 785#endif 786#ifdef USE_SHEEN 787 material.sheenColor = sheenColor; 788 #ifdef USE_SHEEN_COLORMAP 789 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 790 #endif 791 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 792 #ifdef USE_SHEEN_ROUGHNESSMAP 793 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 794 #endif 795#endif`,Oh=`struct PhysicalMaterial { 796 vec3 diffuseColor; 797 float roughness; 798 vec3 specularColor; 799 float specularF90; 800 #ifdef USE_CLEARCOAT 801 float clearcoat; 802 float clearcoatRoughness; 803 vec3 clearcoatF0; 804 float clearcoatF90; 805 #endif 806 #ifdef USE_IRIDESCENCE 807 float iridescence; 808 float iridescenceIOR; 809 float iridescenceThickness; 810 vec3 iridescenceFresnel; 811 vec3 iridescenceF0; 812 #endif 813 #ifdef USE_SHEEN 814 vec3 sheenColor; 815 float sheenRoughness; 816 #endif 817 #ifdef IOR 818 float ior; 819 #endif 820 #ifdef USE_TRANSMISSION 821 float transmission; 822 float transmissionAlpha; 823 float thickness; 824 float attenuationDistance; 825 vec3 attenuationColor; 826 #endif 827}; 828vec3 clearcoatSpecular = vec3( 0.0 ); 829vec3 sheenSpecular = vec3( 0.0 ); 830vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 831 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 832 float x2 = x * x; 833 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 834 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 835} 836float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 837 float a2 = pow2( alpha ); 838 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 839 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 840 return 0.5 / max( gv + gl, EPSILON ); 841} 842float D_GGX( const in float alpha, const in float dotNH ) { 843 float a2 = pow2( alpha ); 844 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 845 return RECIPROCAL_PI * a2 / pow2( denom ); 846} 847#ifdef USE_CLEARCOAT 848 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 849 vec3 f0 = material.clearcoatF0; 850 float f90 = material.clearcoatF90; 851 float roughness = material.clearcoatRoughness; 852 float alpha = pow2( roughness ); 853 vec3 halfDir = normalize( lightDir + viewDir ); 854 float dotNL = saturate( dot( normal, lightDir ) ); 855 float dotNV = saturate( dot( normal, viewDir ) ); 856 float dotNH = saturate( dot( normal, halfDir ) ); 857 float dotVH = saturate( dot( viewDir, halfDir ) ); 858 vec3 F = F_Schlick( f0, f90, dotVH ); 859 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 860 float D = D_GGX( alpha, dotNH ); 861 return F * ( V * D ); 862 } 863#endif 864vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 865 vec3 f0 = material.specularColor; 866 float f90 = material.specularF90; 867 float roughness = material.roughness; 868 float alpha = pow2( roughness ); 869 vec3 halfDir = normalize( lightDir + viewDir ); 870 float dotNL = saturate( dot( normal, lightDir ) ); 871 float dotNV = saturate( dot( normal, viewDir ) ); 872 float dotNH = saturate( dot( normal, halfDir ) ); 873 float dotVH = saturate( dot( viewDir, halfDir ) ); 874 vec3 F = F_Schlick( f0, f90, dotVH ); 875 #ifdef USE_IRIDESCENCE 876 F = mix( F, material.iridescenceFresnel, material.iridescence ); 877 #endif 878 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 879 float D = D_GGX( alpha, dotNH ); 880 return F * ( V * D ); 881} 882vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 883 const float LUT_SIZE = 64.0; 884 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 885 const float LUT_BIAS = 0.5 / LUT_SIZE; 886 float dotNV = saturate( dot( N, V ) ); 887 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 888 uv = uv * LUT_SCALE + LUT_BIAS; 889 return uv; 890} 891float LTC_ClippedSphereFormFactor( const in vec3 f ) { 892 float l = length( f ); 893 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 894} 895vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 896 float x = dot( v1, v2 ); 897 float y = abs( x ); 898 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 899 float b = 3.4175940 + ( 4.1616724 + y ) * y; 900 float v = a / b; 901 float theta_sintheta = ( x >
901 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 902 return cross( v1, v2 ) * theta_sintheta; 903} 904vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 905 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 906 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 907 vec3 lightNormal = cross( v1, v2 ); 908 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 909 vec3 T1, T2; 910 T1 = normalize( V - N * dot( V, N ) ); 911 T2 = - cross( N, T1 ); 912 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 913 vec3 coords[ 4 ]; 914 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 915 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 916 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 917 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 918 coords[ 0 ] = normalize( coords[ 0 ] ); 919 coords[ 1 ] = normalize( coords[ 1 ] ); 920 coords[ 2 ] = normalize( coords[ 2 ] ); 921 coords[ 3 ] = normalize( coords[ 3 ] ); 922 vec3 vectorFormFactor = vec3( 0.0 ); 923 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 924 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 925 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 926 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 927 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 928 return vec3( result ); 929} 930#if defined( USE_SHEEN ) 931float D_Charlie( float roughness, float dotNH ) { 932 float alpha = pow2( roughness ); 933 float invAlpha = 1.0 / alpha; 934 float cos2h = dotNH * dotNH; 935 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 936 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 937} 938float V_Neubelt( float dotNV, float dotNL ) { 939 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 940} 941vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 942 vec3 halfDir = normalize( lightDir + viewDir ); 943 float dotNL = saturate( dot( normal, lightDir ) ); 944 float dotNV = saturate( dot( normal, viewDir ) ); 945 float dotNH = saturate( dot( normal, halfDir ) ); 946 float D = D_Charlie( sheenRoughness, dotNH ); 947 float V = V_Neubelt( dotNV, dotNL ); 948 return sheenColor * ( D * V ); 949} 950#endif 951float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 952 float dotNV = saturate( dot( normal, viewDir ) ); 953 float r2 = roughness * roughness; 954 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 955 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 956 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 957 return saturate( DG * RECIPROCAL_PI ); 958} 959vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 960 float dotNV = saturate( dot( normal, viewDir ) ); 961 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 962 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 963 vec4 r = roughness * c0 + c1; 964 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 965 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 966 return fab; 967} 968vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 969 vec2 fab = DFGApprox( normal, viewDir, roughness ); 970 return specularColor * fab.x + specularF90 * fab.y; 971} 972#ifdef USE_IRIDESCENCE 973void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 974#else 975void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 976#endif 977 vec2 fab = DFGApprox( normal, viewDir, roughness ); 978 #ifdef USE_IRIDESCENCE 979 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 980 #else 981 vec3 Fr = specularColor; 982 #endif 983 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 984 float Ess = fab.x + fab.y; 985 float Ems = 1.0 - Ess; 986 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 987 singleScatter += FssEss; 988 multiScatter += Fms * Ems; 989} 990#if NUM_RECT_AREA_LIGHTS > 0 991 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 992 vec3 normal = geometry.normal; 993 vec3 viewDir = geometry.viewDir; 994 vec3 position = geometry.position;
995 vec3 lightPos = rectAreaLight.position; 996 vec3 halfWidth = rectAreaLight.halfWidth; 997 vec3 halfHeight = rectAreaLight.halfHeight; 998 vec3 lightColor = rectAreaLight.color; 999 float roughness = material.roughness; 1000 vec3 rectCoords[ 4 ]; 1001 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1002 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1003 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1004 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1005 vec4 t1 = texture2D( ltc_1, uv ); 1006 vec4 t2 = texture2D( ltc_2, uv ); 1007 mat3 mInv = mat3( 1008 vec3( t1.x, 0, t1.y ), 1009 vec3( 0, 1, 0 ), 1010 vec3( t1.z, 0, t1.w ) 1011 ); 1012 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1013 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1014 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1015 } 1016#endif 1017void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1018 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1019 vec3 irradiance = dotNL * directLight.color; 1020 #ifdef USE_CLEARCOAT 1021 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1022 vec3 ccIrradiance = dotNLcc * directLight.color; 1023 clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); 1024 #endif 1025 #ifdef USE_SHEEN 1026 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1027 #endif 1028 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); 1029 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1030} 1031void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1032 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1033} 1034void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1035 #ifdef USE_CLEARCOAT 1036 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1037 #endif 1038 #ifdef USE_SHEEN 1039 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1040 #endif 1041 vec3 singleScattering = vec3( 0.0 ); 1042 vec3 multiScattering = vec3( 0.0 ); 1043 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1044 #ifdef USE_IRIDESCENCE 1045 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1046 #else 1047 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1048 #endif 1049 vec3 totalScattering = singleScattering + multiScattering; 1050 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1051 reflectedLight.indirectSpecular += radiance * singleScattering; 1052 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1053 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1054} 1055#define RE_Direct RE_Direct_Physical 1056#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1057#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1058#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1059float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1060 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1061}`,Fh=` 1062GeometricContext geometry; 1063geometry.position = - vViewPosition; 1064geometry.normal = normal; 1065geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1066#ifdef USE_CLEARCOAT 1067 geometry.clearcoatNormal = clearcoatNormal; 1068#endif
1069#ifdef USE_IRIDESCENCE 1070 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1071 if ( material.iridescenceThickness == 0.0 ) { 1072 material.iridescence = 0.0; 1073 } else { 1074 material.iridescence = saturate( material.iridescence ); 1075 } 1076 if ( material.iridescence > 0.0 ) { 1077 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1078 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1079 } 1080#endif 1081IncidentLight directLight; 1082#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1083 PointLight pointLight; 1084 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1085 PointLightShadow pointLightShadow; 1086 #endif 1087 #pragma unroll_loop_start 1088 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1089 pointLight = pointLights[ i ]; 1090 getPointLightInfo( pointLight, geometry, directLight ); 1091 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1092 pointLightShadow = pointLightShadows[ i ]; 1093 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1094 #endif 1095 RE_Direct( directLight, geometry, material, reflectedLight ); 1096 } 1097 #pragma unroll_loop_end 1098#endif 1099#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1100 SpotLight spotLight; 1101 vec4 spotColor; 1102 vec3 spotLightCoord; 1103 bool inSpotLightMap; 1104 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1105 SpotLightShadow spotLightShadow; 1106 #endif 1107 #pragma unroll_loop_start 1108 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1109 spotLight = spotLights[ i ]; 1110 getSpotLightInfo( spotLight, geometry, directLight ); 1111 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1112 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1113 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1114 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1115 #else 1116 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1117 #endif 1118 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1119 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1120 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1121 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1122 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1123 #endif 1124 #undef SPOT_LIGHT_MAP_INDEX 1125 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1126 spotLightShadow = spotLightShadows[ i ]; 1127 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1128 #endif 1129 RE_Direct( directLight, geometry, material, reflectedLight ); 1130 } 1131 #pragma unroll_loop_end 1132#endif 1133#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1134 DirectionalLight directionalLight; 1135 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1136 DirectionalLightShadow directionalLightShadow; 1137 #endif 1138 #pragma unroll_loop_start 1139 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1140 directionalLight = directionalLights[ i ]; 1141 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1142 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1143 directionalLightShadow = directionalLightShadows[ i ]; 1144 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1145 #endif 1146 RE_Direct( directLight, geometry, material, reflectedLight ); 1147 } 1148 #pragma unroll_loop_end 1149#endif 1150#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1151 RectAreaLight rectAreaLight; 1152 #pragma unroll_loop_start 1153 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1154 rectAreaLight = rectAreaLights[ i ]; 1155 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1156 } 1157 #pragma unroll_loop_end 1158#endif 1159#if defined( RE_IndirectDiffuse ) 1160 vec3 iblIrradiance = vec3( 0.0 ); 1161 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1162 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1163 #if ( NUM_HEMI_LIGHTS > 0 ) 1164 #pragma unroll_loop_start 1165 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1166 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1167 } 1168 #pragma unroll_loop_end 1169 #endif 1170#endif 1171#if defined( RE_IndirectSpecular ) 1172 vec3 radiance = vec3( 0.0 ); 1173 vec3 clearcoatRadiance = vec3( 0.0 ); 1174#endif`,Bh=`#if defined( RE_IndirectDiffuse ) 1175 #ifdef USE_LIGHTMAP 1176 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1177 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1178 irradiance += lightMapIrradiance; 1179 #endif 1180 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1181 iblIrradiance += getIBLIrradiance( geometry.normal ); 1182 #endif 1183#endif 1184#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1185 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1186 #ifdef USE_CLEARCOAT 1187 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1188 #endif 1189#endif`,zh=`#if defined( RE_IndirectDiffuse ) 1190 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1191#endif 1192#if defined( RE_IndirectSpecular ) 1193 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1194#endif`,kh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1195 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1196#endif`,Vh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1197 uniform float logDepthBufFC; 1198 varying float vFragDepth; 1199 varying float vIsPerspective; 1200#endif`,Hh=`#ifdef USE_LOGDEPTHBUF 1201 #ifdef USE_LOGDEPTHBUF_EXT 1202 varying float vFragDepth; 1203 varying float vIsPerspective; 1204 #else 1205 uniform float logDepthBufFC; 1206 #endif 1207#endif`,Gh=`#ifdef USE_LOGDEPTHBUF 1208 #ifdef USE_LOGDEPTHBUF_EXT 1209 vFragDepth = 1.0 + gl_Position.w; 1210 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1211 #else 1212 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1213 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1214 gl_Position.z *= gl_Position.w; 1215 } 1216 #endif 1217#endif`,Wh=`#ifdef USE_MAP 1218 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1219 #ifdef DECODE_VIDEO_TEXTURE 1220 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 ); 1221 #endif 1222 diffuseColor *= sampledDiffuseColor; 1223#endif`,Xh=`#ifdef USE_MAP 1224 uniform sampler2D map; 1225#endif`,jh=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1226 #if defined( USE_POINTS_UV ) 1227 vec2 uv = vUv; 1228 #else 1229 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1230 #endif 1231#endif 1232#ifdef USE_MAP 1233 diffuseColor *= texture2D( map, uv ); 1234#endif 1235#ifdef USE_ALPHAMAP 1236 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1237#endif`,qh=`#if defined( USE_POINTS_UV ) 1238 varying vec2 vUv; 1239#else 1240 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1241 uniform mat3 uvTransform; 1242 #endif 1243#endif 1244#ifdef USE_MAP 1245 uniform sampler2D map; 1246#endif 1247#ifdef USE_ALPHAMAP 1248 uniform sampler2D alphaMap; 1249#endif`,Yh=`float metalnessFactor = metalness; 1250#ifdef USE_METALNESSMAP 1251 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1252 metalnessFactor *= texelMetalness.b; 1253#endif`,Kh=`#ifdef USE_METALNESSMAP 1254 uniform sampler2D metalnessMap; 1255#endif`,Zh=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1256 vColor *= morphTargetBaseInfluence; 1257 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1258 #if defined( USE_COLOR_ALPHA ) 1259 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1260 #elif defined( USE_COLOR ) 1261 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1262 #endif 1263 } 1264#endif`,$h=`#ifdef USE_MORPHNORMALS 1265 objectNormal *= morphTargetBaseInfluence; 1266 #ifdef MORPHTARGETS_TEXTURE 1267 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1268 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1269 } 1270 #else 1271 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1272 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1273 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1274 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1275 #endif 1276#endif`,Jh=`#ifdef USE_MORPHTARGETS 1277 uniform float morphTargetBaseInfluence; 1278 #ifdef MORPHTARGETS_TEXTURE 1279 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1280 uniform sampler2DArray morphTargetsTexture; 1281 uniform ivec2 morphTargetsTextureSize; 1282 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1283 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1284 int y = texelIndex / morphTargetsTextureSize.x; 1285 int x = texelIndex - y * morphTargetsTextureSize.x; 1286 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1287 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1288 } 1289 #else 1290 #ifndef USE_MORPHNORMALS 1291 uniform float morphTargetInfluences[ 8 ]; 1292 #else 1293 uniform float morphTargetInfluences[ 4 ]; 1294 #endif 1295 #endif 1296#endif`,Qh=`#ifdef USE_MORPHTARGETS 1297 transformed *= morphTargetBaseInfluence; 1298 #ifdef MORPHTARGETS_TEXTURE 1299 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1300 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1301 } 1302 #else 1303 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1304 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1305 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1306 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1307 #ifndef USE_MORPHNORMALS 1308 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1309 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1310 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1311 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1312 #endif 1313 #endif 1314#endif`,ed=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1315#ifdef FLAT_SHADED 1316 vec3 fdx = dFdx( vViewPosition ); 1317 vec3 fdy = dFdy( vViewPosition ); 1318 vec3 normal = normalize( cross( fdx, fdy ) ); 1319#else 1320 vec3 normal = normalize( vNormal ); 1321 #ifdef DOUBLE_SIDED 1322 normal *= faceDirection; 1323 #endif 1324#endif 1325#ifdef USE_NORMALMAP_TANGENTSPACE 1326 #ifdef USE_TANGENT 1327 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1328 #else 1329 mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv ); 1330 #endif 1331 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1332 tbn[0] *= faceDirection; 1333 tbn[1] *= faceDirection; 1334 #endif 1335#endif 1336#ifdef USE_CLEARCOAT_NORMALMAP 1337 #ifdef USE_TANGENT 1338 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1339 #else 1340 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1341 #endif 1342 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1343 tbn2[0] *= faceDirection; 1344 tbn2[1] *= faceDirection; 1345 #endif 1346#endif 1347vec3 geometryNormal = normal;`,td=`#ifdef USE_NORMALMAP_OBJECTSPACE 1348 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1349 #ifdef FLIP_SIDED 1350 normal = - normal; 1351 #endif 1352 #ifdef DOUBLE_SIDED 1353 normal = normal * faceDirection; 1354 #endif 1355 normal = normalize( normalMatrix * normal ); 1356#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1357 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1358 mapN.xy *= normalScale; 1359 normal = normalize( tbn * mapN ); 1360#elif defined( USE_BUMPMAP )
1361 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1362#endif`,nd=`#ifndef FLAT_SHADED 1363 varying vec3 vNormal; 1364 #ifdef USE_TANGENT 1365 varying vec3 vTangent; 1366 varying vec3 vBitangent; 1367 #endif 1368#endif`,id=`#ifndef FLAT_SHADED 1369 varying vec3 vNormal; 1370 #ifdef USE_TANGENT 1371 varying vec3 vTangent; 1372 varying vec3 vBitangent; 1373 #endif 1374#endif`,sd=`#ifndef FLAT_SHADED 1375 vNormal = normalize( transformedNormal ); 1376 #ifdef USE_TANGENT 1377 vTangent = normalize( transformedTangent ); 1378 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1379 #endif 1380#endif`,rd=`#ifdef USE_NORMALMAP 1381 uniform sampler2D normalMap; 1382 uniform vec2 normalScale; 1383#endif 1384#ifdef USE_NORMALMAP_OBJECTSPACE 1385 uniform mat3 normalMatrix; 1386#endif 1387#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1388 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1389 vec3 q0 = dFdx( eye_pos.xyz ); 1390 vec3 q1 = dFdy( eye_pos.xyz ); 1391 vec2 st0 = dFdx( uv.st ); 1392 vec2 st1 = dFdy( uv.st ); 1393 vec3 N = surf_norm; 1394 vec3 q1perp = cross( q1, N ); 1395 vec3 q0perp = cross( N, q0 ); 1396 vec3 T = q1perp * st0.x + q0perp * st1.x; 1397 vec3 B = q1perp * st0.y + q0perp * st1.y; 1398 float det = max( dot( T, T ), dot( B, B ) ); 1399 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1400 return mat3( T * scale, B * scale, N ); 1401 } 1402#endif`,ad=`#ifdef USE_CLEARCOAT 1403 vec3 clearcoatNormal = geometryNormal; 1404#endif`,od=`#ifdef USE_CLEARCOAT_NORMALMAP 1405 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1406 clearcoatMapN.xy *= clearcoatNormalScale; 1407 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1408#endif`,ld=`#ifdef USE_CLEARCOATMAP 1409 uniform sampler2D clearcoatMap; 1410#endif 1411#ifdef USE_CLEARCOAT_NORMALMAP 1412 uniform sampler2D clearcoatNormalMap; 1413 uniform vec2 clearcoatNormalScale; 1414#endif 1415#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1416 uniform sampler2D clearcoatRoughnessMap; 1417#endif`,cd=`#ifdef USE_IRIDESCENCEMAP 1418 uniform sampler2D iridescenceMap; 1419#endif 1420#ifdef USE_IRIDESCENCE_THICKNESSMAP 1421 uniform sampler2D iridescenceThicknessMap; 1422#endif`,ud=`#ifdef OPAQUE 1423diffuseColor.a = 1.0; 1424#endif 1425#ifdef USE_TRANSMISSION 1426diffuseColor.a *= material.transmissionAlpha + 0.1; 1427#endif 1428gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,hd=`vec3 packNormalToRGB( const in vec3 normal ) { 1429 return normalize( normal ) * 0.5 + 0.5; 1430} 1431vec3 unpackRGBToNormal( const in vec3 rgb ) { 1432 return 2.0 * rgb.xyz - 1.0; 1433} 1434const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1435const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1436const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1437const float ShiftRight8 = 1. / 256.; 1438vec4 packDepthToRGBA( const in float v ) { 1439 vec4 r = vec4( fract( v * PackFactors ), v ); 1440 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1441} 1442float unpackRGBAToDepth( const in vec4 v ) { 1443 return dot( v, UnpackFactors ); 1444} 1445vec2 packDepthToRG( in highp float v ) { 1446 return packDepthToRGBA( v ).yx; 1447} 1448float unpackRGToDepth( const in highp vec2 v ) { 1449 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1450} 1451vec4 pack2HalfToRGBA( vec2 v ) { 1452 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1453 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1454} 1455vec2 unpackRGBATo2Half( vec4 v ) { 1456 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1457} 1458float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1459 return ( viewZ + near ) / ( near - far ); 1460} 1461float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1462 return depth * ( near - far ) - near; 1463} 1464float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1465 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1466} 1467float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1468 return ( near * far ) / ( ( far - near ) * depth - far ); 1469}`,dd=`#ifdef PREMULTIPLIED_ALPHA 1470 gl_FragColor.rgb *= gl_FragColor.a; 1471#endif`,fd=`vec4 mvPosition = vec4( transformed, 1.0 ); 1472#ifdef USE_INSTANCING 1473 mvPosition = instanceMatrix * mvPosition; 1474#endif 1475mvPosition = modelViewMatrix * mvPosition; 1476gl_Position = projectionMatrix * mvPosition;`,pd=`#ifdef DITHERING 1477 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1478#endif`,md=`#ifdef DITHERING 1479 vec3 dithering( vec3 color ) { 1480 float grid_position = rand( gl_FragCoord.xy ); 1481 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1482 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1483 return color + dither_shift_RGB; 1484 } 1485#endif`,gd=`float roughnessFactor = roughness; 1486#ifdef USE_ROUGHNESSMAP 1487 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1488 roughnessFactor *= texelRoughness.g; 1489#endif`,_d=`#ifdef USE_ROUGHNESSMAP 1490 uniform sampler2D roughnessMap;
1491#endif`,xd=`#if NUM_SPOT_LIGHT_COORDS > 0 1492 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1493#endif 1494#if NUM_SPOT_LIGHT_MAPS > 0 1495 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1496#endif 1497#ifdef USE_SHADOWMAP 1498 #if NUM_DIR_LIGHT_SHADOWS > 0 1499 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1500 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1501 struct DirectionalLightShadow { 1502 float shadowBias; 1503 float shadowNormalBias; 1504 float shadowRadius; 1505 vec2 shadowMapSize; 1506 }; 1507 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1508 #endif 1509 #if NUM_SPOT_LIGHT_SHADOWS > 0 1510 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1511 struct SpotLightShadow { 1512 float shadowBias; 1513 float shadowNormalBias; 1514 float shadowRadius; 1515 vec2 shadowMapSize; 1516 }; 1517 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1518 #endif 1519 #if NUM_POINT_LIGHT_SHADOWS > 0 1520 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1521 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1522 struct PointLightShadow { 1523 float shadowBias; 1524 float shadowNormalBias; 1525 float shadowRadius; 1526 vec2 shadowMapSize; 1527 float shadowCameraNear; 1528 float shadowCameraFar; 1529 }; 1530 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1531 #endif 1532 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1533 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1534 } 1535 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1536 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1537 } 1538 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1539 float occlusion = 1.0; 1540 vec2 distribution = texture2DDistribution( shadow, uv ); 1541 float hard_shadow = step( compare , distribution.x ); 1542 if (hard_shadow != 1.0 ) { 1543 float distance = compare - distribution.x ; 1544 float variance = max( 0.00000, distribution.y * distribution.y ); 1545 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 ); 1546 } 1547 return occlusion; 1548 } 1549 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1550 float shadow = 1.0; 1551 shadowCoord.xyz /= shadowCoord.w; 1552 shadowCoord.z += shadowBias; 1553 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1554 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1555 if ( frustumTest ) { 1556 #if defined( SHADOWMAP_TYPE_PCF ) 1557 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1558 float dx0 = - texelSize.x * shadowRadius; 1559 float dy0 = - texelSize.y * shadowRadius; 1560 float dx1 = + texelSize.x * shadowRadius; 1561 float dy1 = + texelSize.y * shadowRadius; 1562 float dx2 = dx0 / 2.0; 1563 float dy2 = dy0 / 2.0; 1564 float dx3 = dx1 / 2.0; 1565 float dy3 = dy1 / 2.0; 1566 shadow = ( 1567 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1568 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1569 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1570 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1571 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1572 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1573 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1574 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1575 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1576 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1577 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1578 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1579 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1580 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1581 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1582 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1583 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1584 ) * ( 1.0 / 17.0 ); 1585 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1586 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1587 float dx = texelSize.x; 1588 float dy = texelSize.y; 1589 vec2 uv = shadowCoord.xy;
1590 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1591 uv -= f * texelSize; 1592 shadow = ( 1593 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1594 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1595 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1596 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1597 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1598 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1599 f.x ) + 1600 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1601 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1602 f.x ) + 1603 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1604 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1605 f.y ) + 1606 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1607 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1608 f.y ) + 1609 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1610 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1611 f.x ), 1612 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1613 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1614 f.x ), 1615 f.y ) 1616 ) * ( 1.0 / 9.0 ); 1617 #elif defined( SHADOWMAP_TYPE_VSM ) 1618 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1619 #else 1620 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1621 #endif 1622 } 1623 return shadow; 1624 } 1625 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1626 vec3 absV = abs( v ); 1627 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1628 absV *= scaleToCube; 1629 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1630 vec2 planar = v.xy; 1631 float almostATexel = 1.5 * texelSizeY; 1632 float almostOne = 1.0 - almostATexel; 1633 if ( absV.z >= almostOne ) { 1634 if ( v.z > 0.0 ) 1635 planar.x = 4.0 - v.x; 1636 } else if ( absV.x >= almostOne ) { 1637 float signX = sign( v.x ); 1638 planar.x = v.z * signX + 2.0 * signX; 1639 } else if ( absV.y >= almostOne ) { 1640 float signY = sign( v.y ); 1641 planar.x = v.x + 2.0 * signY + 2.0; 1642 planar.y = v.z * signY - 2.0; 1643 } 1644 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1645 } 1646 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1647 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1648 vec3 lightToPosition = shadowCoord.xyz; 1649 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1650 vec3 bd3D = normalize( lightToPosition ); 1651 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1652 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1653 return ( 1654 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1655 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1656 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1657 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1658 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1659 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1660 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1661 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1662 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1663 ) * ( 1.0 / 9.0 ); 1664 #else 1665 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1666 #endif 1667 } 1668#endif`,vd=`#if NUM_SPOT_LIGHT_COORDS > 0 1669 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1670 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1671#endif 1672#ifdef USE_SHADOWMAP 1673 #if NUM_DIR_LIGHT_SHADOWS > 0 1674 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1675 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1676 struct DirectionalLightShadow { 1677 float shadowBias; 1678 float shadowNormalBias; 1679 float shadowRadius; 1680 vec2 shadowMapSize; 1681 }; 1682 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1683 #endif
1684 #if NUM_SPOT_LIGHT_SHADOWS > 0 1685 struct SpotLightShadow { 1686 float shadowBias; 1687 float shadowNormalBias; 1688 float shadowRadius; 1689 vec2 shadowMapSize; 1690 }; 1691 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1692 #endif 1693 #if NUM_POINT_LIGHT_SHADOWS > 0 1694 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1695 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1696 struct PointLightShadow { 1697 float shadowBias; 1698 float shadowNormalBias; 1699 float shadowRadius; 1700 vec2 shadowMapSize; 1701 float shadowCameraNear; 1702 float shadowCameraFar; 1703 }; 1704 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1705 #endif 1706#endif`,Md=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1707 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1708 vec4 shadowWorldPosition; 1709#endif 1710#if defined( USE_SHADOWMAP ) 1711 #if NUM_DIR_LIGHT_SHADOWS > 0 1712 #pragma unroll_loop_start 1713 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1714 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1715 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1716 } 1717 #pragma unroll_loop_end 1718 #endif 1719 #if NUM_POINT_LIGHT_SHADOWS > 0 1720 #pragma unroll_loop_start 1721 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1722 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1723 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1724 } 1725 #pragma unroll_loop_end 1726 #endif 1727#endif 1728#if NUM_SPOT_LIGHT_COORDS > 0 1729 #pragma unroll_loop_start 1730 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1731 shadowWorldPosition = worldPosition; 1732 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1733 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1734 #endif 1735 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1736 } 1737 #pragma unroll_loop_end 1738#endif`,yd=`float getShadowMask() { 1739 float shadow = 1.0; 1740 #ifdef USE_SHADOWMAP 1741 #if NUM_DIR_LIGHT_SHADOWS > 0 1742 DirectionalLightShadow directionalLight; 1743 #pragma unroll_loop_start 1744 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1745 directionalLight = directionalLightShadows[ i ]; 1746 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1747 } 1748 #pragma unroll_loop_end 1749 #endif 1750 #if NUM_SPOT_LIGHT_SHADOWS > 0 1751 SpotLightShadow spotLight; 1752 #pragma unroll_loop_start 1753 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1754 spotLight = spotLightShadows[ i ]; 1755 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1756 } 1757 #pragma unroll_loop_end 1758 #endif 1759 #if NUM_POINT_LIGHT_SHADOWS > 0 1760 PointLightShadow pointLight; 1761 #pragma unroll_loop_start 1762 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1763 pointLight = pointLightShadows[ i ]; 1764 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1765 } 1766 #pragma unroll_loop_end 1767 #endif 1768 #endif 1769 return shadow; 1770}`,Sd=`#ifdef USE_SKINNING 1771 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1772 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1773 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1774 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1775#endif`,bd=`#ifdef USE_SKINNING 1776 uniform mat4 bindMatrix; 1777 uniform mat4 bindMatrixInverse; 1778 uniform highp sampler2D boneTexture; 1779 uniform int boneTextureSize; 1780 mat4 getBoneMatrix( const in float i ) { 1781 float j = i * 4.0; 1782 float x = mod( j, float( boneTextureSize ) ); 1783 float y = floor( j / float( boneTextureSize ) ); 1784 float dx = 1.0 / float( boneTextureSize ); 1785 float dy = 1.0 / float( boneTextureSize ); 1786 y = dy * ( y + 0.5 ); 1787 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1788 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1789 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1790 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1791 mat4 bone = mat4( v1, v2, v3, v4 ); 1792 return bone; 1793 } 1794#endif`,wd=`#ifdef USE_SKINNING 1795 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1796 vec4 skinned = vec4( 0.0 ); 1797 skinned += boneMatX * skinVertex * skinWeight.x; 1798 skinned += boneMatY * skinVertex * skinWeight.y; 1799 skinned += boneMatZ * skinVertex * skinWeight.z; 1800 skinned += boneMatW * skinVertex * skinWeight.w; 1801 transformed = ( bindMatrixInverse * skinned ).xyz; 1802#endif`,Td=`#ifdef USE_SKINNING 1803 mat4 skinMatrix = mat4( 0.0 ); 1804 skinMatrix += skinWeight.x * boneMatX; 1805 skinMatrix += skinWeight.y * boneMatY; 1806 skinMatrix += skinWeight.z * boneMatZ; 1807 skinMatrix += skinWeight.w * boneMatW; 1808 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1809 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1810 #ifdef USE_TANGENT 1811 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1812 #endif 1813#endif`,Ad=`float specularStrength; 1814#ifdef USE_SPECULARMAP 1815 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 1816 specularStrength = texelSpecular.r; 1817#else 1818 specularStrength = 1.0; 1819#endif`,Ed=`#ifdef USE_SPECULARMAP 1820 uniform sampler2D specularMap; 1821#endif`,Cd=`#if defined( TONE_MAPPING ) 1822 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1823#endif`,Ld=`#ifndef saturate 1824#define saturate( a ) clamp( a, 0.0, 1.0 ) 1825#endif 1826uniform float toneMappingExposure; 1827vec3 LinearToneMapping( vec3 color ) { 1828 return toneMappingExposure * color; 1829} 1830vec3 ReinhardToneMapping( vec3 color ) { 1831 color *= toneMappingExposure; 1832 return saturate( color / ( vec3( 1.0 ) + color ) ); 1833} 1834vec3 OptimizedCineonToneMapping( vec3 color ) { 1835 color *= toneMappingExposure; 1836 color = max( vec3( 0.0 ), color - 0.004 ); 1837 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1838} 1839vec3 RRTAndODTFit( vec3 v ) { 1840 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1841 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1842 return a / b; 1843} 1844vec3 ACESFilmicToneMapping( vec3 color ) { 1845 const mat3 ACESInputMat = mat3( 1846 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1847 vec3( 0.04823, 0.01566, 0.83777 ) 1848 ); 1849 const mat3 ACESOutputMat = mat3( 1850 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1851 vec3( -0.07367, -0.00605, 1.07602 ) 1852 ); 1853 color *= toneMappingExposure / 0.6; 1854 color = ACESInputMat * color; 1855 color = RRTAndODTFit( color ); 1856 color = ACESOutputMat * color; 1857 return saturate( color ); 1858} 1859vec3 CustomToneMapping( vec3 color ) { return color; }`,Rd=`#ifdef USE_TRANSMISSION 1860 material.transmission = transmission; 1861 material.transmissionAlpha = 1.0; 1862 material.thickness = thickness; 1863 material.attenuationDistance = attenuationDistance; 1864 material.attenuationColor = attenuationColor; 1865 #ifdef USE_TRANSMISSIONMAP 1866 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 1867 #endif 1868 #ifdef USE_THICKNESSMAP 1869 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 1870 #endif 1871 vec3 pos = vWorldPosition; 1872 vec3 v = normalize( cameraPosition - pos ); 1873 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1874 vec4 transmission = getIBLVolumeRefraction( 1875 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1876 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1877 material.attenuationColor, material.attenuationDistance ); 1878 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1879 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1880#endif`,Pd=`#ifdef USE_TRANSMISSION 1881 uniform float transmission; 1882 uniform float thickness; 1883 uniform float attenuationDistance; 1884 uniform vec3 attenuationColor; 1885 #ifdef USE_TRANSMISSIONMAP 1886 uniform sampler2D transmissionMap; 1887 #endif 1888 #ifdef USE_THICKNESSMAP 1889 uniform sampler2D thicknessMap; 1890 #endif 1891 uniform vec2 transmissionSamplerSize; 1892 uniform sampler2D transmissionSamplerMap; 1893 uniform mat4 modelMatrix; 1894 uniform mat4 projectionMatrix; 1895 varying vec3 vWorldPosition; 1896 float w0( float a ) { 1897 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 1898 } 1899 float w1( float a ) { 1900 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 1901 } 1902 float w2( float a ){ 1903 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 1904 } 1905 float w3( float a ) { 1906 return ( 1.0 / 6.0 ) * ( a * a * a ); 1907 } 1908 float g0( float a ) { 1909 return w0( a ) + w1( a ); 1910 } 1911 float g1( float a ) { 1912 return w2( a ) + w3( a ); 1913 } 1914 float h0( float a ) { 1915 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 1916 } 1917 float h1( float a ) { 1918 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 1919 } 1920 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) { 1921 uv = uv * texelSize.zw + 0.5; 1922 vec2 iuv = floor( uv ); 1923 vec2 fuv = fract( uv ); 1924 float g0x = g0( fuv.x ); 1925 float g1x = g1( fuv.x ); 1926 float h0x = h0( fuv.x ); 1927 float h1x = h1( fuv.x ); 1928 float h0y = h0( fuv.y ); 1929 float h1y = h1( fuv.y ); 1930 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 1931 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 1932 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 1933 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 1934 1935 vec2 lodFudge = pow( 1.95, lod ) / fullSize; 1936 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 1937 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 1938 } 1939 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 1940 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 1941 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 1942 vec2 fLodSizeInv = 1.0 / fLodSize; 1943 vec2 cLodSizeInv = 1.0 / cLodSize; 1944 vec2 fullSize = vec2( textureSize( sampler, 0 ) ); 1945 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) ); 1946 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) ); 1947 return mix( fSample, cSample, fract( lod ) ); 1948 } 1949 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1950 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1951 vec3 modelScale; 1952 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1953 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1954 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1955 return normalize( refractionVector ) * thickness * modelScale; 1956 } 1957 float applyIorToRoughness( const in float roughness, const in float ior ) { 1958 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1959 } 1960 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1961 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1962 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 1963 } 1964 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1965 if ( isinf( attenuationDistance ) ) { 1966 return radiance; 1967 } else { 1968 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1969 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1970 } 1971 } 1972 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1973 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1974 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1975 const in vec3 attenuationColor, const in float attenuationDistance ) { 1976 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1977 vec3 refractedRayExit = position + transmissionRay; 1978 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1979 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1980 refractionCoords += 1.0; 1981 refractionCoords /= 2.0; 1982 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1983 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1984 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1985 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1986 } 1987#endif`,Id=`#ifdef USE_UV 1988 varying vec2 vUv; 1989#endif 1990#ifdef USE_MAP 1991 varying vec2 vMapUv; 1992#endif 1993#ifdef USE_ALPHAMAP
1994 varying vec2 vAlphaMapUv; 1995#endif 1996#ifdef USE_LIGHTMAP 1997 varying vec2 vLightMapUv; 1998#endif 1999#ifdef USE_AOMAP 2000 varying vec2 vAoMapUv; 2001#endif 2002#ifdef USE_BUMPMAP 2003 varying vec2 vBumpMapUv; 2004#endif 2005#ifdef USE_NORMALMAP 2006 varying vec2 vNormalMapUv; 2007#endif 2008#ifdef USE_EMISSIVEMAP 2009 varying vec2 vEmissiveMapUv; 2010#endif 2011#ifdef USE_METALNESSMAP 2012 varying vec2 vMetalnessMapUv; 2013#endif 2014#ifdef USE_ROUGHNESSMAP 2015 varying vec2 vRoughnessMapUv; 2016#endif 2017#ifdef USE_CLEARCOATMAP 2018 varying vec2 vClearcoatMapUv; 2019#endif 2020#ifdef USE_CLEARCOAT_NORMALMAP 2021 varying vec2 vClearcoatNormalMapUv; 2022#endif 2023#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2024 varying vec2 vClearcoatRoughnessMapUv; 2025#endif 2026#ifdef USE_IRIDESCENCEMAP 2027 varying vec2 vIridescenceMapUv; 2028#endif 2029#ifdef USE_IRIDESCENCE_THICKNESSMAP 2030 varying vec2 vIridescenceThicknessMapUv; 2031#endif 2032#ifdef USE_SHEEN_COLORMAP 2033 varying vec2 vSheenColorMapUv; 2034#endif 2035#ifdef USE_SHEEN_ROUGHNESSMAP 2036 varying vec2 vSheenRoughnessMapUv; 2037#endif 2038#ifdef USE_SPECULARMAP 2039 varying vec2 vSpecularMapUv; 2040#endif 2041#ifdef USE_SPECULAR_COLORMAP 2042 varying vec2 vSpecularColorMapUv; 2043#endif 2044#ifdef USE_SPECULAR_INTENSITYMAP 2045 varying vec2 vSpecularIntensityMapUv; 2046#endif 2047#ifdef USE_TRANSMISSIONMAP 2048 uniform mat3 transmissionMapTransform; 2049 varying vec2 vTransmissionMapUv; 2050#endif 2051#ifdef USE_THICKNESSMAP 2052 uniform mat3 thicknessMapTransform; 2053 varying vec2 vThicknessMapUv; 2054#endif`,Dd=`#ifdef USE_UV 2055 varying vec2 vUv; 2056#endif 2057#ifdef USE_UV2 2058 attribute vec2 uv2; 2059#endif 2060#ifdef USE_MAP 2061 uniform mat3 mapTransform; 2062 varying vec2 vMapUv; 2063#endif 2064#ifdef USE_ALPHAMAP 2065 uniform mat3 alphaMapTransform; 2066 varying vec2 vAlphaMapUv; 2067#endif 2068#ifdef USE_LIGHTMAP 2069 uniform mat3 lightMapTransform; 2070 varying vec2 vLightMapUv; 2071#endif 2072#ifdef USE_AOMAP 2073 uniform mat3 aoMapTransform; 2074 varying vec2 vAoMapUv; 2075#endif 2076#ifdef USE_BUMPMAP 2077 uniform mat3 bumpMapTransform; 2078 varying vec2 vBumpMapUv; 2079#endif 2080#ifdef USE_NORMALMAP 2081 uniform mat3 normalMapTransform; 2082 varying vec2 vNormalMapUv; 2083#endif 2084#ifdef USE_DISPLACEMENTMAP 2085 uniform mat3 displacementMapTransform; 2086 varying vec2 vDisplacementMapUv; 2087#endif 2088#ifdef USE_EMISSIVEMAP 2089 uniform mat3 emissiveMapTransform; 2090 varying vec2 vEmissiveMapUv; 2091#endif 2092#ifdef USE_METALNESSMAP 2093 uniform mat3 metalnessMapTransform; 2094 varying vec2 vMetalnessMapUv; 2095#endif 2096#ifdef USE_ROUGHNESSMAP 2097 uniform mat3 roughnessMapTransform; 2098 varying vec2 vRoughnessMapUv; 2099#endif 2100#ifdef USE_CLEARCOATMAP 2101 uniform mat3 clearcoatMapTransform; 2102 varying vec2 vClearcoatMapUv; 2103#endif 2104#ifdef USE_CLEARCOAT_NORMALMAP 2105 uniform mat3 clearcoatNormalMapTransform; 2106 varying vec2 vClearcoatNormalMapUv; 2107#endif 2108#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2109 uniform mat3 clearcoatRoughnessMapTransform; 2110 varying vec2 vClearcoatRoughnessMapUv; 2111#endif 2112#ifdef USE_SHEEN_COLORMAP 2113 uniform mat3 sheenColorMapTransform; 2114 varying vec2 vSheenColorMapUv; 2115#endif 2116#ifdef USE_SHEEN_ROUGHNESSMAP 2117 uniform mat3 sheenRoughnessMapTransform; 2118 varying vec2 vSheenRoughnessMapUv; 2119#endif 2120#ifdef USE_IRIDESCENCEMAP 2121 uniform mat3 iridescenceMapTransform; 2122 varying vec2 vIridescenceMapUv; 2123#endif 2124#ifdef USE_IRIDESCENCE_THICKNESSMAP 2125 uniform mat3 iridescenceThicknessMapTransform; 2126 varying vec2 vIridescenceThicknessMapUv; 2127#endif 2128#ifdef USE_SPECULARMAP 2129 uniform mat3 specularMapTransform; 2130 varying vec2 vSpecularMapUv; 2131#endif 2132#ifdef USE_SPECULAR_COLORMAP 2133 uniform mat3 specularColorMapTransform; 2134 varying vec2 vSpecularColorMapUv; 2135#endif 2136#ifdef USE_SPECULAR_INTENSITYMAP 2137 uniform mat3 specularIntensityMapTransform; 2138 varying vec2 vSpecularIntensityMapUv; 2139#endif 2140#ifdef USE_TRANSMISSIONMAP 2141 uniform mat3 transmissionMapTransform; 2142 varying vec2 vTransmissionMapUv; 2143#endif 2144#ifdef USE_THICKNESSMAP 2145 uniform mat3 thicknessMapTransform; 2146 varying vec2 vThicknessMapUv; 2147#endif`,Nd=`#ifdef USE_UV 2148 vUv = vec3( uv, 1 ).xy; 2149#endif 2150#ifdef USE_MAP 2151 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2152#endif 2153#ifdef USE_ALPHAMAP 2154 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2155#endif 2156#ifdef USE_LIGHTMAP 2157 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2158#endif 2159#ifdef USE_AOMAP 2160 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2161#endif 2162#ifdef USE_BUMPMAP 2163 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2164#endif 2165#ifdef USE_NORMALMAP 2166 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2167#endif 2168#ifdef USE_DISPLACEMENTMAP 2169 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2170#endif 2171#ifdef USE_EMISSIVEMAP 2172 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2173#endif 2174#ifdef USE_METALNESSMAP 2175 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2176#endif 2177#ifdef USE_ROUGHNESSMAP 2178 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2179#endif 2180#ifdef USE_CLEARCOATMAP 2181 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2182#endif 2183#ifdef USE_CLEARCOAT_NORMALMAP 2184 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2185#endif 2186#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2187 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2188#endif
2189#ifdef USE_IRIDESCENCEMAP 2190 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2191#endif 2192#ifdef USE_IRIDESCENCE_THICKNESSMAP 2193 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2194#endif 2195#ifdef USE_SHEEN_COLORMAP 2196 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2197#endif 2198#ifdef USE_SHEEN_ROUGHNESSMAP 2199 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2200#endif 2201#ifdef USE_SPECULARMAP 2202 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2203#endif 2204#ifdef USE_SPECULAR_COLORMAP 2205 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2206#endif 2207#ifdef USE_SPECULAR_INTENSITYMAP 2208 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2209#endif 2210#ifdef USE_TRANSMISSIONMAP 2211 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2212#endif 2213#ifdef USE_THICKNESSMAP 2214 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2215#endif`,Ud=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2216 vec4 worldPosition = vec4( transformed, 1.0 ); 2217 #ifdef USE_INSTANCING 2218 worldPosition = instanceMatrix * worldPosition; 2219 #endif 2220 worldPosition = modelMatrix * worldPosition; 2221#endif`;const Od=`varying vec2 vUv; 2222uniform mat3 uvTransform; 2223void main() { 2224 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2225 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2226}`,Fd=`uniform sampler2D t2D; 2227uniform float backgroundIntensity; 2228varying vec2 vUv; 2229void main() { 2230 vec4 texColor = texture2D( t2D, vUv ); 2231 #ifdef DECODE_VIDEO_TEXTURE 2232 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 ); 2233 #endif 2234 texColor.rgb *= backgroundIntensity; 2235 gl_FragColor = texColor; 2236 #include <tonemapping_fragment> 2237 #include <encodings_fragment> 2238}`,Bd=`varying vec3 vWorldDirection; 2239#include <common> 2240void main() { 2241 vWorldDirection = transformDirection( position, modelMatrix ); 2242 #include <begin_vertex> 2243 #include <project_vertex> 2244 gl_Position.z = gl_Position.w; 2245}`,zd=`#ifdef ENVMAP_TYPE_CUBE 2246 uniform samplerCube envMap; 2247#elif defined( ENVMAP_TYPE_CUBE_UV ) 2248 uniform sampler2D envMap; 2249#endif 2250uniform float flipEnvMap; 2251uniform float backgroundBlurriness; 2252uniform float backgroundIntensity; 2253varying vec3 vWorldDirection; 2254#include <cube_uv_reflection_fragment> 2255void main() { 2256 #ifdef ENVMAP_TYPE_CUBE 2257 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2258 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2259 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 2260 #else 2261 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2262 #endif 2263 texColor.rgb *= backgroundIntensity; 2264 gl_FragColor = texColor; 2265 #include <tonemapping_fragment> 2266 #include <encodings_fragment> 2267}`,kd=`varying vec3 vWorldDirection; 2268#include <common> 2269void main() { 2270 vWorldDirection = transformDirection( position, modelMatrix ); 2271 #include <begin_vertex> 2272 #include <project_vertex> 2273 gl_Position.z = gl_Position.w; 2274}`,Vd=`uniform samplerCube tCube; 2275uniform float tFlip; 2276uniform float opacity; 2277varying vec3 vWorldDirection; 2278void main() { 2279 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2280 gl_FragColor = texColor; 2281 gl_FragColor.a *= opacity; 2282 #include <tonemapping_fragment> 2283 #include <encodings_fragment> 2284}`,Hd=`#include <common> 2285#include <uv_pars_vertex> 2286#include <displacementmap_pars_vertex> 2287#include <morphtarget_pars_vertex> 2288#include <skinning_pars_vertex> 2289#include <logdepthbuf_pars_vertex> 2290#include <clipping_planes_pars_vertex> 2291varying vec2 vHighPrecisionZW; 2292void main() { 2293 #include <uv_vertex> 2294 #include <skinbase_vertex> 2295 #ifdef USE_DISPLACEMENTMAP 2296 #include <beginnormal_vertex> 2297 #include <morphnormal_vertex> 2298 #include <skinnormal_vertex> 2299 #endif 2300 #include <begin_vertex> 2301 #include <morphtarget_vertex> 2302 #include <skinning_vertex> 2303 #include <displacementmap_vertex> 2304 #include <project_vertex> 2305 #include <logdepthbuf_vertex> 2306 #include <clipping_planes_vertex> 2307 vHighPrecisionZW = gl_Position.zw; 2308}`,Gd=`#if DEPTH_PACKING == 3200 2309 uniform float opacity; 2310#endif 2311#include <common> 2312#include <packing> 2313#include <uv_pars_fragment> 2314#include <map_pars_fragment> 2315#include <alphamap_pars_fragment> 2316#include <alphatest_pars_fragment> 2317#include <logdepthbuf_pars_fragment> 2318#include <clipping_planes_pars_fragment> 2319varying vec2 vHighPrecisionZW; 2320void main() { 2321 #include <clipping_planes_fragment> 2322 vec4 diffuseColor = vec4( 1.0 ); 2323 #if DEPTH_PACKING == 3200 2324 diffuseColor.a = opacity; 2325 #endif 2326 #include <map_fragment> 2327 #include <alphamap_fragment> 2328 #include <alphatest_fragment> 2329 #include <logdepthbuf_fragment> 2330 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2331 #if DEPTH_PACKING == 3200 2332 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2333 #elif DEPTH_PACKING == 3201 2334 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2335 #endif 2336}`,Wd=`#define DISTANCE 2337varying vec3 vWorldPosition; 2338#include <common> 2339#include <uv_pars_vertex> 2340#include <displacementmap_pars_vertex> 2341#include <morphtarget_pars_vertex> 2342#include <skinning_pars_vertex> 2343#include <clipping_planes_pars_vertex> 2344void main() { 2345 #include <uv_vertex> 2346 #include <skinbase_vertex> 2347 #ifdef USE_DISPLACEMENTMAP 2348 #include <beginnormal_vertex> 2349 #include <morphnormal_vertex> 2350 #include <skinnormal_vertex> 2351 #endif 2352 #include <begin_vertex> 2353 #include <morphtarget_vertex> 2354 #include <skinning_vertex> 2355 #include <displacementmap_vertex> 2356 #include <project_vertex> 2357 #include <worldpos_vertex> 2358 #include <clipping_planes_vertex> 2359 vWorldPosition = worldPosition.xyz; 2360}`,Xd=`#define DISTANCE 2361uniform vec3 referencePosition; 2362uniform float nearDistance; 2363uniform float farDistance; 2364varying vec3 vWorldPosition; 2365#include <common> 2366#include <packing> 2367#include <uv_pars_fragment> 2368#include <map_pars_fragment> 2369#include <alphamap_pars_fragment> 2370#include <alphatest_pars_fragment> 2371#include <clipping_planes_pars_fragment> 2372void main () { 2373 #include <clipping_planes_fragment> 2374 vec4 diffuseColor = vec4( 1.0 ); 2375 #include <map_fragment> 2376 #include <alphamap_fragment> 2377 #include <alphatest_fragment> 2378 float dist = length( vWorldPosition - referencePosition ); 2379 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2380 dist = saturate( dist ); 2381 gl_FragColor = packDepthToRGBA( dist ); 2382}`,jd=`varying vec3 vWorldDirection; 2383#include <common> 2384void main() { 2385 vWorldDirection = transformDirection( position, modelMatrix ); 2386 #include <begin_vertex> 2387 #include <project_vertex> 2388}`,qd=`uniform sampler2D tEquirect; 2389varying vec3 vWorldDirection; 2390#include <common> 2391void main() { 2392 vec3 direction = normalize( vWorldDirection ); 2393 vec2 sampleUV = equirectUv( direction ); 2394 gl_FragColor = texture2D( tEquirect, sampleUV ); 2395 #include <tonemapping_fragment> 2396 #include <encodings_fragment> 2397}`,Yd=`uniform float scale; 2398attribute float lineDistance; 2399varying float vLineDistance; 2400#include <common> 2401#include <uv_pars_vertex> 2402#include <color_pars_vertex> 2403#include <fog_pars_vertex> 2404#include <morphtarget_pars_vertex> 2405#include <logdepthbuf_pars_vertex> 2406#include <clipping_planes_pars_vertex> 2407void main() { 2408 vLineDistance = scale * lineDistance; 2409 #include <uv_vertex> 2410 #include <color_vertex> 2411 #include <morphcolor_vertex> 2412 #include <begin_vertex> 2413 #include <morphtarget_vertex> 2414 #include <project_vertex> 2415 #include <logdepthbuf_vertex> 2416 #include <clipping_planes_vertex> 2417 #include <fog_vertex> 2418}`,Kd=`uniform vec3 diffuse; 2419uniform float opacity; 2420uniform float dashSize; 2421uniform float totalSize; 2422varying float vLineDistance; 2423#include <common> 2424#include <color_pars_fragment> 2425#include <uv_pars_fragment> 2426#include <map_pars_fragment> 2427#include <fog_pars_fragment> 2428#include <logdepthbuf_pars_fragment> 2429#include <clipping_planes_pars_fragment> 2430void main() { 2431 #include <clipping_planes_fragment> 2432 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2433 discard; 2434 } 2435 vec3 outgoingLight = vec3( 0.0 ); 2436 vec4 diffuseColor = vec4( diffuse, opacity ); 2437 #include <logdepthbuf_fragment> 2438 #include <map_fragment> 2439 #include <color_fragment> 2440 outgoingLight = diffuseColor.rgb; 2441 #include <output_fragment> 2442 #include <tonemapping_fragment> 2443 #include <encodings_fragment> 2444 #include <fog_fragment> 2445 #include <premultiplied_alpha_fragment> 2446}`,Zd=`#include <common> 2447#include <uv_pars_vertex> 2448#include <envmap_pars_vertex> 2449#include <color_pars_vertex> 2450#include <fog_pars_vertex> 2451#include <morphtarget_pars_vertex> 2452#include <skinning_pars_vertex> 2453#include <logdepthbuf_pars_vertex> 2454#include <clipping_planes_pars_vertex> 2455void main() { 2456 #include <uv_vertex> 2457 #include <color_vertex> 2458 #include <morphcolor_vertex> 2459 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2460 #include <beginnormal_vertex> 2461 #include <morphnormal_vertex> 2462 #include <skinbase_vertex> 2463 #include <skinnormal_vertex> 2464 #include <defaultnormal_vertex> 2465 #endif 2466 #include <begin_vertex> 2467 #include <morphtarget_vertex> 2468 #include <skinning_vertex> 2469 #include <project_vertex> 2470 #include <logdepthbuf_vertex> 2471 #include <clipping_planes_vertex> 2472 #include <worldpos_vertex> 2473 #include <envmap_vertex> 2474 #include <fog_vertex> 2475}`,$d=`uniform vec3 diffuse; 2476uniform float opacity; 2477#ifndef FLAT_SHADED 2478 varying vec3 vNormal; 2479#endif 2480#include <common> 2481#include <dithering_pars_fragment> 2482#include <color_pars_fragment> 2483#include <uv_pars_fragment> 2484#include <map_pars_fragment> 2485#include <alphamap_pars_fragment> 2486#include <alphatest_pars_fragment> 2487#include <aomap_pars_fragment> 2488#include <lightmap_pars_fragment> 2489#include <envmap_common_pars_fragment> 2490#include <envmap_pars_fragment> 2491#include <fog_pars_fragment> 2492#include <specularmap_pars_fragment> 2493#include <logdepthbuf_pars_fragment> 2494#include <clipping_planes_pars_fragment> 2495void main() { 2496 #include <clipping_planes_fragment> 2497 vec4 diffuseColor = vec4( diffuse, opacity ); 2498 #include <logdepthbuf_fragment> 2499 #include <map_fragment> 2500 #include <color_fragment> 2501 #include <alphamap_fragment> 2502 #include <alphatest_fragment> 2503 #include <specularmap_fragment> 2504 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2505 #ifdef USE_LIGHTMAP 2506 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2507 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2508 #else 2509 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2510 #endif 2511 #include <aomap_fragment> 2512 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2513 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2514 #include <envmap_fragment> 2515 #include <output_fragment> 2516 #include <tonemapping_fragment> 2517 #include <encodings_fragment> 2518 #include <fog_fragment> 2519 #include <premultiplied_alpha_fragment> 2520 #include <dithering_fragment> 2521}`,Jd=`#define LAMBERT 2522varying vec3 vViewPosition; 2523#include <common> 2524#include <uv_pars_vertex> 2525#include <displacementmap_pars_vertex> 2526#include <envmap_pars_vertex> 2527#include <color_pars_vertex> 2528#include <fog_pars_vertex> 2529#include <normal_pars_vertex> 2530#include <morphtarget_pars_vertex> 2531#include <skinning_pars_vertex> 2532#include <shadowmap_pars_vertex> 2533#include <logdepthbuf_pars_vertex> 2534#include <clipping_planes_pars_vertex> 2535void main() { 2536 #include <uv_vertex> 2537 #include <color_vertex> 2538 #include <morphcolor_vertex> 2539 #include <beginnormal_vertex> 2540 #include <morphnormal_vertex> 2541 #include <skinbase_vertex> 2542 #include <skinnormal_vertex> 2543 #include <defaultnormal_vertex> 2544 #include <normal_vertex> 2545 #include <begin_vertex> 2546 #include <morphtarget_vertex> 2547 #include <skinning_vertex> 2548 #include <displacementmap_vertex> 2549 #include <project_vertex> 2550 #include <logdepthbuf_vertex> 2551 #include <clipping_planes_vertex> 2552 vViewPosition = - mvPosition.xyz; 2553 #include <worldpos_vertex> 2554 #include <envmap_vertex> 2555 #include <shadowmap_vertex> 2556 #include <fog_vertex> 2557}`,Qd=`#define LAMBERT 2558uniform vec3 diffuse; 2559uniform vec3 emissive; 2560uniform float opacity; 2561#include <common> 2562#include <packing> 2563#include <dithering_pars_fragment> 2564#include <color_pars_fragment> 2565#include <uv_pars_fragment> 2566#include <map_pars_fragment> 2567#include <alphamap_pars_fragment> 2568#include <alphatest_pars_fragment> 2569#include <aomap_pars_fragment> 2570#include <lightmap_pars_fragment> 2571#include <emissivemap_pars_fragment> 2572#include <envmap_common_pars_fragment> 2573#include <envmap_pars_fragment> 2574#include <fog_pars_fragment> 2575#include <bsdfs> 2576#include <lights_pars_begin> 2577#include <normal_pars_fragment> 2578#include <lights_lambert_pars_fragment> 2579#include <shadowmap_pars_fragment> 2580#include <bumpmap_pars_fragment> 2581#include <normalmap_pars_fragment> 2582#include <specularmap_pars_fragment> 2583#include <logdepthbuf_pars_fragment> 2584#include <clipping_planes_pars_fragment> 2585void main() { 2586 #include <clipping_planes_fragment> 2587 vec4 diffuseColor = vec4( diffuse, opacity ); 2588 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2589 vec3 totalEmissiveRadiance = emissive; 2590 #include <logdepthbuf_fragment> 2591 #include <map_fragment> 2592 #include <color_fragment> 2593 #include <alphamap_fragment> 2594 #include <alphatest_fragment> 2595 #include <specularmap_fragment> 2596 #include <normal_fragment_begin> 2597 #include <normal_fragment_maps> 2598 #include <emissivemap_fragment> 2599 #include <lights_lambert_fragment> 2600 #include <lights_fragment_begin> 2601 #include <lights_fragment_maps> 2602 #include <lights_fragment_end> 2603 #include <aomap_fragment> 2604 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2605 #include <envmap_fragment> 2606 #include <output_fragment> 2607 #include <tonemapping_fragment> 2608 #include <encodings_fragment> 2609 #include <fog_fragment> 2610 #include <premultiplied_alpha_fragment> 2611 #include <dithering_fragment> 2612}`,ef=`#define MATCAP 2613varying vec3 vViewPosition; 2614#include <common> 2615#include <uv_pars_vertex> 2616#include <color_pars_vertex> 2617#include <displacementmap_pars_vertex> 2618#include <fog_pars_vertex> 2619#include <normal_pars_vertex> 2620#include <morphtarget_pars_vertex> 2621#include <skinning_pars_vertex> 2622#include <logdepthbuf_pars_vertex> 2623#include <clipping_planes_pars_vertex> 2624void main() { 2625 #include <uv_vertex> 2626 #include <color_vertex> 2627 #include <morphcolor_vertex> 2628 #include <beginnormal_vertex> 2629 #include <morphnormal_vertex> 2630 #include <skinbase_vertex> 2631 #include <skinnormal_vertex> 2632 #include <defaultnormal_vertex> 2633 #include <normal_vertex> 2634 #include <begin_vertex> 2635 #include <morphtarget_vertex> 2636 #include <skinning_vertex> 2637 #include <displacementmap_vertex> 2638 #include <project_vertex> 2639 #include <logdepthbuf_vertex> 2640 #include <clipping_planes_vertex> 2641 #include <fog_vertex> 2642 vViewPosition = - mvPosition.xyz; 2643}`,tf=`#define MATCAP 2644uniform vec3 diffuse; 2645uniform float opacity; 2646uniform sampler2D matcap; 2647varying vec3 vViewPosition; 2648#include <common> 2649#include <dithering_pars_fragment> 2650#include <color_pars_fragment> 2651#include <uv_pars_fragment> 2652#include <map_pars_fragment> 2653#include <alphamap_pars_fragment> 2654#include <alphatest_pars_fragment> 2655#include <fog_pars_fragment> 2656#include <normal_pars_fragment> 2657#include <bumpmap_pars_fragment> 2658#include <normalmap_pars_fragment> 2659#include <logdepthbuf_pars_fragment> 2660#include <clipping_planes_pars_fragment> 2661void main() { 2662 #include <clipping_planes_fragment> 2663 vec4 diffuseColor = vec4( diffuse, opacity ); 2664 #include <logdepthbuf_fragment> 2665 #include <map_fragment> 2666 #include <color_fragment> 2667 #include <alphamap_fragment> 2668 #include <alphatest_fragment> 2669 #include <normal_fragment_begin> 2670 #include <normal_fragment_maps> 2671 vec3 viewDir = normalize( vViewPosition ); 2672 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2673 vec3 y = cross( viewDir, x ); 2674 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2675 #ifdef USE_MATCAP
2676 vec4 matcapColor = texture2D( matcap, uv ); 2677 #else 2678 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2679 #endif 2680 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2681 #include <output_fragment> 2682 #include <tonemapping_fragment> 2683 #include <encodings_fragment> 2684 #include <fog_fragment> 2685 #include <premultiplied_alpha_fragment> 2686 #include <dithering_fragment> 2687}`,nf=`#define NORMAL 2688#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2689 varying vec3 vViewPosition; 2690#endif 2691#include <common> 2692#include <uv_pars_vertex> 2693#include <displacementmap_pars_vertex> 2694#include <normal_pars_vertex> 2695#include <morphtarget_pars_vertex> 2696#include <skinning_pars_vertex> 2697#include <logdepthbuf_pars_vertex> 2698#include <clipping_planes_pars_vertex> 2699void main() { 2700 #include <uv_vertex> 2701 #include <beginnormal_vertex> 2702 #include <morphnormal_vertex> 2703 #include <skinbase_vertex> 2704 #include <skinnormal_vertex> 2705 #include <defaultnormal_vertex> 2706 #include <normal_vertex> 2707 #include <begin_vertex> 2708 #include <morphtarget_vertex> 2709 #include <skinning_vertex> 2710 #include <displacementmap_vertex> 2711 #include <project_vertex> 2712 #include <logdepthbuf_vertex> 2713 #include <clipping_planes_vertex> 2714#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2715 vViewPosition = - mvPosition.xyz; 2716#endif 2717}`,sf=`#define NORMAL 2718uniform float opacity; 2719#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2720 varying vec3 vViewPosition; 2721#endif 2722#include <packing> 2723#include <uv_pars_fragment> 2724#include <normal_pars_fragment> 2725#include <bumpmap_pars_fragment> 2726#include <normalmap_pars_fragment> 2727#include <logdepthbuf_pars_fragment> 2728#include <clipping_planes_pars_fragment> 2729void main() { 2730 #include <clipping_planes_fragment> 2731 #include <logdepthbuf_fragment> 2732 #include <normal_fragment_begin> 2733 #include <normal_fragment_maps> 2734 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2735 #ifdef OPAQUE 2736 gl_FragColor.a = 1.0; 2737 #endif 2738}`,rf=`#define PHONG 2739varying vec3 vViewPosition; 2740#include <common> 2741#include <uv_pars_vertex> 2742#include <displacementmap_pars_vertex> 2743#include <envmap_pars_vertex> 2744#include <color_pars_vertex> 2745#include <fog_pars_vertex> 2746#include <normal_pars_vertex> 2747#include <morphtarget_pars_vertex> 2748#include <skinning_pars_vertex> 2749#include <shadowmap_pars_vertex> 2750#include <logdepthbuf_pars_vertex> 2751#include <clipping_planes_pars_vertex> 2752void main() { 2753 #include <uv_vertex> 2754 #include <color_vertex> 2755 #include <morphcolor_vertex> 2756 #include <beginnormal_vertex> 2757 #include <morphnormal_vertex> 2758 #include <skinbase_vertex> 2759 #include <skinnormal_vertex> 2760 #include <defaultnormal_vertex> 2761 #include <normal_vertex> 2762 #include <begin_vertex> 2763 #include <morphtarget_vertex> 2764 #include <skinning_vertex> 2765 #include <displacementmap_vertex> 2766 #include <project_vertex> 2767 #include <logdepthbuf_vertex> 2768 #include <clipping_planes_vertex> 2769 vViewPosition = - mvPosition.xyz; 2770 #include <worldpos_vertex> 2771 #include <envmap_vertex> 2772 #include <shadowmap_vertex> 2773 #include <fog_vertex> 2774}`,af=`#define PHONG 2775uniform vec3 diffuse; 2776uniform vec3 emissive; 2777uniform vec3 specular; 2778uniform float shininess; 2779uniform float opacity; 2780#include <common> 2781#include <packing> 2782#include <dithering_pars_fragment> 2783#include <color_pars_fragment> 2784#include <uv_pars_fragment> 2785#include <map_pars_fragment> 2786#include <alphamap_pars_fragment> 2787#include <alphatest_pars_fragment> 2788#include <aomap_pars_fragment> 2789#include <lightmap_pars_fragment> 2790#include <emissivemap_pars_fragment> 2791#include <envmap_common_pars_fragment> 2792#include <envmap_pars_fragment> 2793#include <fog_pars_fragment> 2794#include <bsdfs> 2795#include <lights_pars_begin> 2796#include <normal_pars_fragment> 2797#include <lights_phong_pars_fragment> 2798#include <shadowmap_pars_fragment> 2799#include <bumpmap_pars_fragment> 2800#include <normalmap_pars_fragment> 2801#include <specularmap_pars_fragment> 2802#include <logdepthbuf_pars_fragment> 2803#include <clipping_planes_pars_fragment> 2804void main() { 2805 #include <clipping_planes_fragment> 2806 vec4 diffuseColor = vec4( diffuse, opacity ); 2807 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2808 vec3 totalEmissiveRadiance = emissive; 2809 #include <logdepthbuf_fragment> 2810 #include <map_fragment> 2811 #include <color_fragment> 2812 #include <alphamap_fragment> 2813 #include <alphatest_fragment> 2814 #include <specularmap_fragment> 2815 #include <normal_fragment_begin> 2816 #include <normal_fragment_maps> 2817 #include <emissivemap_fragment> 2818 #include <lights_phong_fragment> 2819 #include <lights_fragment_begin> 2820 #include <lights_fragment_maps> 2821 #include <lights_fragment_end> 2822 #include <aomap_fragment> 2823 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2824 #include <envmap_fragment> 2825 #include <output_fragment> 2826 #include <tonemapping_fragment> 2827 #include <encodings_fragment> 2828 #include <fog_fragment> 2829 #include <premultiplied_alpha_fragment> 2830 #include <dithering_fragment> 2831}`,of=`#define STANDARD 2832varying vec3 vViewPosition; 2833#ifdef USE_TRANSMISSION 2834 varying vec3 vWorldPosition; 2835#endif 2836#include <common> 2837#include <uv_pars_vertex> 2838#include <displacementmap_pars_vertex> 2839#include <color_pars_vertex> 2840#include <fog_pars_vertex> 2841#include <normal_pars_vertex> 2842#include <morphtarget_pars_vertex> 2843#include <skinning_pars_vertex> 2844#include <shadowmap_pars_vertex> 2845#include <logdepthbuf_pars_vertex> 2846#include <clipping_planes_pars_vertex> 2847void main() { 2848 #include <uv_vertex> 2849 #include <color_vertex> 2850 #include <morphcolor_vertex> 2851 #include <beginnormal_vertex> 2852 #include <morphnormal_vertex> 2853 #include <skinbase_vertex> 2854 #include <skinnormal_vertex> 2855 #include <defaultnormal_vertex> 2856 #include <normal_vertex> 2857 #include <begin_vertex> 2858 #include <morphtarget_vertex> 2859 #include <skinning_vertex> 2860 #include <displacementmap_vertex> 2861 #include <project_vertex> 2862 #include <logdepthbuf_vertex> 2863 #include <clipping_planes_vertex> 2864 vViewPosition = - mvPosition.xyz; 2865 #include <worldpos_vertex> 2866 #include <shadowmap_vertex> 2867 #include <fog_vertex> 2868#ifdef USE_TRANSMISSION 2869 vWorldPosition = worldPosition.xyz; 2870#endif 2871}`,lf=`#define STANDARD 2872#ifdef PHYSICAL 2873 #define IOR 2874 #define USE_SPECULAR 2875#endif 2876uniform vec3 diffuse; 2877uniform vec3 emissive; 2878uniform float roughness; 2879uniform float metalness; 2880uniform float opacity; 2881#ifdef IOR 2882 uniform float ior; 2883#endif 2884#ifdef USE_SPECULAR 2885 uniform float specularIntensity; 2886 uniform vec3 specularColor; 2887 #ifdef USE_SPECULAR_COLORMAP 2888 uniform sampler2D specularColorMap; 2889 #endif 2890 #ifdef USE_SPECULAR_INTENSITYMAP 2891 uniform sampler2D specularIntensityMap; 2892 #endif 2893#endif 2894#ifdef USE_CLEARCOAT 2895 uniform float clearcoat; 2896 uniform float clearcoatRoughness; 2897#endif
2898#ifdef USE_IRIDESCENCE 2899 uniform float iridescence; 2900 uniform float iridescenceIOR; 2901 uniform float iridescenceThicknessMinimum; 2902 uniform float iridescenceThicknessMaximum; 2903#endif 2904#ifdef USE_SHEEN 2905 uniform vec3 sheenColor; 2906 uniform float sheenRoughness; 2907 #ifdef USE_SHEEN_COLORMAP 2908 uniform sampler2D sheenColorMap; 2909 #endif 2910 #ifdef USE_SHEEN_ROUGHNESSMAP 2911 uniform sampler2D sheenRoughnessMap; 2912 #endif 2913#endif 2914varying vec3 vViewPosition; 2915#include <common> 2916#include <packing> 2917#include <dithering_pars_fragment> 2918#include <color_pars_fragment> 2919#include <uv_pars_fragment> 2920#include <map_pars_fragment> 2921#include <alphamap_pars_fragment> 2922#include <alphatest_pars_fragment> 2923#include <aomap_pars_fragment> 2924#include <lightmap_pars_fragment> 2925#include <emissivemap_pars_fragment> 2926#include <iridescence_fragment> 2927#include <cube_uv_reflection_fragment> 2928#include <envmap_common_pars_fragment> 2929#include <envmap_physical_pars_fragment> 2930#include <fog_pars_fragment> 2931#include <lights_pars_begin> 2932#include <normal_pars_fragment> 2933#include <lights_physical_pars_fragment> 2934#include <transmission_pars_fragment> 2935#include <shadowmap_pars_fragment> 2936#include <bumpmap_pars_fragment> 2937#include <normalmap_pars_fragment> 2938#include <clearcoat_pars_fragment> 2939#include <iridescence_pars_fragment> 2940#include <roughnessmap_pars_fragment> 2941#include <metalnessmap_pars_fragment> 2942#include <logdepthbuf_pars_fragment> 2943#include <clipping_planes_pars_fragment> 2944void main() { 2945 #include <clipping_planes_fragment> 2946 vec4 diffuseColor = vec4( diffuse, opacity ); 2947 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2948 vec3 totalEmissiveRadiance = emissive; 2949 #include <logdepthbuf_fragment> 2950 #include <map_fragment> 2951 #include <color_fragment> 2952 #include <alphamap_fragment> 2953 #include <alphatest_fragment> 2954 #include <roughnessmap_fragment> 2955 #include <metalnessmap_fragment> 2956 #include <normal_fragment_begin> 2957 #include <normal_fragment_maps> 2958 #include <clearcoat_normal_fragment_begin> 2959 #include <clearcoat_normal_fragment_maps> 2960 #include <emissivemap_fragment> 2961 #include <lights_physical_fragment> 2962 #include <lights_fragment_begin> 2963 #include <lights_fragment_maps> 2964 #include <lights_fragment_end> 2965 #include <aomap_fragment> 2966 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2967 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2968 #include <transmission_fragment> 2969 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2970 #ifdef USE_SHEEN 2971 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2972 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2973 #endif 2974 #ifdef USE_CLEARCOAT 2975 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2976 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2977 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2978 #endif 2979 #include <output_fragment> 2980 #include <tonemapping_fragment> 2981 #include <encodings_fragment> 2982 #include <fog_fragment> 2983 #include <premultiplied_alpha_fragment> 2984 #include <dithering_fragment> 2985}`,cf=`#define TOON 2986varying vec3 vViewPosition; 2987#include <common> 2988#include <uv_pars_vertex> 2989#include <displacementmap_pars_vertex> 2990#include <color_pars_vertex> 2991#include <fog_pars_vertex> 2992#include <normal_pars_vertex> 2993#include <morphtarget_pars_vertex> 2994#include <skinning_pars_vertex> 2995#include <shadowmap_pars_vertex> 2996#include <logdepthbuf_pars_vertex> 2997#include <clipping_planes_pars_vertex> 2998void main() { 2999 #include <uv_vertex> 3000 #include <color_vertex> 3001 #include <morphcolor_vertex> 3002 #include <beginnormal_vertex> 3003 #include <morphnormal_vertex> 3004 #include <skinbase_vertex> 3005 #include <skinnormal_vertex> 3006 #include <defaultnormal_vertex> 3007 #include <normal_vertex> 3008 #include <begin_vertex> 3009 #include <morphtarget_vertex> 3010 #include <skinning_vertex> 3011 #include <displacementmap_vertex> 3012 #include <project_vertex> 3013 #include <logdepthbuf_vertex> 3014 #include <clipping_planes_vertex> 3015 vViewPosition = - mvPosition.xyz; 3016 #include <worldpos_vertex> 3017 #include <shadowmap_vertex> 3018 #include <fog_vertex> 3019}`,uf=`#define TOON 3020uniform vec3 diffuse; 3021uniform vec3 emissive; 3022uniform float opacity; 3023#include <common> 3024#include <packing> 3025#include <dithering_pars_fragment> 3026#include <color_pars_fragment> 3027#include <uv_pars_fragment> 3028#include <map_pars_fragment> 3029#include <alphamap_pars_fragment> 3030#include <alphatest_pars_fragment> 3031#include <aomap_pars_fragment> 3032#include <lightmap_pars_fragment> 3033#include <emissivemap_pars_fragment> 3034#include <gradientmap_pars_fragment> 3035#include <fog_pars_fragment> 3036#include <bsdfs> 3037#include <lights_pars_begin> 3038#include <normal_pars_fragment> 3039#include <lights_toon_pars_fragment> 3040#include <shadowmap_pars_fragment> 3041#include <bumpmap_pars_fragment> 3042#include <normalmap_pars_fragment> 3043#include <logdepthbuf_pars_fragment> 3044#include <clipping_planes_pars_fragment> 3045void main() { 3046 #include <clipping_planes_fragment> 3047 vec4 diffuseColor = vec4( diffuse, opacity ); 3048 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3049 vec3 totalEmissiveRadiance = emissive; 3050 #include <logdepthbuf_fragment> 3051 #include <map_fragment> 3052 #include <color_fragment> 3053 #include <alphamap_fragment> 3054 #include <alphatest_fragment> 3055 #include <normal_fragment_begin> 3056 #include <normal_fragment_maps> 3057 #include <emissivemap_fragment> 3058 #include <lights_toon_fragment> 3059 #include <lights_fragment_begin> 3060 #include <lights_fragment_maps> 3061 #include <lights_fragment_end> 3062 #include <aomap_fragment> 3063 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3064 #include <output_fragment> 3065 #include <tonemapping_fragment> 3066 #include <encodings_fragment> 3067 #include <fog_fragment> 3068 #include <premultiplied_alpha_fragment> 3069 #include <dithering_fragment> 3070}`,hf=`uniform float size; 3071uniform float scale; 3072#include <common> 3073#include <color_pars_vertex> 3074#include <fog_pars_vertex> 3075#include <morphtarget_pars_vertex> 3076#include <logdepthbuf_pars_vertex> 3077#include <clipping_planes_pars_vertex> 3078#ifdef USE_POINTS_UV 3079 varying vec2 vUv; 3080 uniform mat3 uvTransform; 3081#endif 3082void main() { 3083 #ifdef USE_POINTS_UV 3084 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3085 #endif 3086 #include <color_vertex> 3087 #include <morphcolor_vertex> 3088 #include <begin_vertex> 3089 #include <morphtarget_vertex> 3090 #include <project_vertex> 3091 gl_PointSize = size; 3092 #ifdef USE_SIZEATTENUATION 3093 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3094 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3095 #endif 3096 #include <logdepthbuf_vertex> 3097 #include <clipping_planes_vertex> 3098 #include <worldpos_vertex> 3099 #include <fog_vertex> 3100}`,df=`uniform vec3 diffuse; 3101uniform float opacity; 3102#include <common> 3103#include <color_pars_fragment> 3104#include <map_particle_pars_fragment> 3105#include <alphatest_pars_fragment> 3106#include <fog_pars_fragment> 3107#include <logdepthbuf_pars_fragment> 3108#include <clipping_planes_pars_fragment> 3109void main() { 3110 #include <clipping_planes_fragment> 3111 vec3 outgoingLight = vec3( 0.0 ); 3112 vec4 diffuseColor = vec4( diffuse, opacity ); 3113 #include <logdepthbuf_fragment> 3114 #include <map_particle_fragment> 3115 #include <color_fragment> 3116 #include <alphatest_fragment> 3117 outgoingLight = diffuseColor.rgb; 3118 #include <output_fragment> 3119 #include <tonemapping_fragment> 3120 #include <encodings_fragment> 3121 #include <fog_fragment> 3122 #include <premultiplied_alpha_fragment> 3123}`,ff=`#include <common> 3124#include <fog_pars_vertex> 3125#include <morphtarget_pars_vertex> 3126#include <skinning_pars_vertex> 3127#include <logdepthbuf_pars_vertex> 3128#include <shadowmap_pars_vertex> 3129void main() { 3130 #include <beginnormal_vertex> 3131 #include <morphnormal_vertex> 3132 #include <skinbase_vertex> 3133 #include <skinnormal_vertex> 3134 #include <defaultnormal_vertex> 3135 #include <begin_vertex> 3136 #include <morphtarget_vertex> 3137 #include <skinning_vertex> 3138 #include <project_vertex> 3139 #include <logdepthbuf_vertex> 3140 #include <worldpos_vertex> 3141 #include <shadowmap_vertex> 3142 #include <fog_vertex> 3143}`,pf=`uniform vec3 color; 3144uniform float opacity; 3145#include <common> 3146#include <packing> 3147#include <fog_pars_fragment> 3148#include <bsdfs> 3149#include <lights_pars_begin> 3150#include <logdepthbuf_pars_fragment> 3151#include <shadowmap_pars_fragment> 3152#include <shadowmask_pars_fragment> 3153void main() { 3154 #include <logdepthbuf_fragment> 3155 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3156 #include <tonemapping_fragment> 3157 #include <encodings_fragment> 3158 #include <fog_fragment> 3159}`,mf=`uniform float rotation; 3160uniform vec2 center; 3161#include <common> 3162#include <uv_pars_vertex> 3163#include <fog_pars_vertex> 3164#include <logdepthbuf_pars_vertex> 3165#include <clipping_planes_pars_vertex> 3166void main() { 3167 #include <uv_vertex> 3168 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3169 vec2 scale; 3170 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3171 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3172 #ifndef USE_SIZEATTENUATION 3173 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3174 if ( isPerspective ) scale *= - mvPosition.z; 3175 #endif 3176 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3177 vec2 rotatedPosition; 3178 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3179 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3180 mvPosition.xy += rotatedPosition; 3181 gl_Position = projectionMatrix * mvPosition; 3182 #include <logdepthbuf_vertex> 3183 #include <clipping_planes_vertex> 3184 #include <fog_vertex> 3185}`,gf=`uniform vec3 diffuse; 3186uniform float opacity; 3187#include <common> 3188#include <uv_pars_fragment> 3189#include <map_pars_fragment> 3190#include <alphamap_pars_fragment> 3191#include <alphatest_pars_fragment> 3192#include <fog_pars_fragment> 3193#include <logdepthbuf_pars_fragment> 3194#include <clipping_planes_pars_fragment> 3195void main() { 3196 #include <clipping_planes_fragment> 3197 vec3 outgoingLight = vec3( 0.0 ); 3198 vec4 diffuseColor = vec4( diffuse, opacity ); 3199 #include <logdepthbuf_fragment> 3200 #include <map_fragment> 3201 #include <alphamap_fragment> 3202 #include <alphatest_fragment> 3203 outgoingLight = diffuseColor.rgb; 3204 #include <output_fragment> 3205 #include <tonemapping_fragment> 3206 #include <encodings_fragment> 3207 #include <fog_fragment> 3208}`,Le={alphamap_fragment:Vu,alphamap_pars_fragment:Hu,alphatest_fragment:Gu,alphatest_pars_fragment:Wu,aomap_fragment:Xu,aomap_pars_fragment:ju,begin_vertex:qu,beginnormal_vertex:Yu,bsdfs:Ku,iridescence_fragment:Zu,bumpmap_pars_fragment:$u,clipping_planes_fragment:Ju,clipping_planes_pars_fragment:Qu,clipping_planes_pars_vertex:eh,clipping_planes_vertex:th,color_fragment:nh,color_pars_fragment:ih,color_pars_vertex:sh,color_vertex:rh,common:ah,cube_uv_reflection_fragment:oh,defaultnormal_vertex:lh,displacementmap_pars_vertex:ch,displacementmap_vertex:uh,emissivemap_fragment:hh,emissivemap_pars_fragment:dh,encodings_fragment:fh,encodings_pars_fragment:ph,envmap_fragment:mh,envmap_common_pars_fragment:gh,envmap_pars_fragment:_h,envmap_pars_vertex:xh,envmap_physical_pars_fragment:Rh,envmap_vertex:vh,fog_vertex:Mh,fog_pars_vertex:yh,fog_fragment:Sh,fog_pars_fragment:bh,gradientmap_pars_fragment:wh,lightmap_fragment:Th,lightmap_pars_fragment:Ah,lights_lambert_fragment:Eh,lights_lambert_pars_fragment:Ch,lights_pars_begin:Lh,lights_toon_fragment:Ph,lights_toon_pars_fragment:Ih,lights_phong_fragment:Dh,lights_phong_pars_fragment:Nh,lights_physical_fragment:Uh,lights_physical_pars_fragment:Oh,lights_fragment_begin:Fh,lights_fragment_maps:Bh,lights_fragment_end:zh,logdepthbuf_fragment:kh,logdepthbuf_pars_fragment:Vh,logdepthbuf_pars_vertex:Hh,logdepthbuf_vertex:Gh,map_fragment:Wh,map_pars_fragment:Xh,map_particle_fragment:jh,map_particle_pars_fragment:qh,metalnessmap_fragment:Yh,metalnessmap_pars_fragment:Kh,morphcolor_vertex:Zh,morphnormal_vertex:$h,morphtarget_pars_vertex:Jh,morphtarget_vertex:Qh,normal_fragment_begin:ed,normal_fragment_maps:td,normal_pars_fragment:nd,normal_pars_vertex:id,normal_vertex:sd,normalmap_pars_fragment:rd,clearcoat_normal_fragment_begin:ad,clearcoat_normal_fragment_maps:od,clearcoat_pars_fragment:ld,iridescence_pars_fragment:cd,output_fragment:ud,packing:hd,premultiplied_alpha_fragment:dd,project_vertex:fd,dithering_fragment:pd,dithering_pars_fragment:md,roughnessmap_fragment:gd,roughnessmap_pars_fragment:_d,shadowmap_pars_fragment:xd,shadowmap_pars_vertex:vd,shadowmap_vertex:Md,shadowmask_pars_fragment:yd,skinbase_vertex:Sd,skinning_pars_vertex:bd,skinning_vertex:wd,skinnormal_vertex:Td,specularmap_fragment:Ad,specularmap_pars_fragment:Ed,tonemapping_fragment:Cd,tonemapping_pars_fragment:Ld,transmission_fragment:Rd,transmission_pars_fragment:Pd,uv_pars_fragment:Id,uv_pars_vertex:Dd,uv_vertex:Nd,worldpos_vertex:Ud,background_vert:Od,background_frag:Fd,backgroundCube_vert:Bd,backgroundCube_frag:zd,cube_vert:kd,cube_frag:Vd,depth_vert:Hd,depth_frag:Gd,distanceRGBA_vert:Wd,distanceRGBA_frag:Xd,equirect_vert:jd,equirect_frag:qd,linedashed_vert:Yd,linedashed_frag:Kd,meshbasic_vert:Zd,meshbasic_frag:$d,meshlambert_vert:Jd,meshlambert_frag:Qd,meshmatcap_vert:ef,meshmatcap_frag:tf,meshnormal_vert:nf,meshnormal_frag:sf,meshphong_vert:rf,meshphong_frag:af,meshphysical_vert:of,meshphysical_frag:lf,meshtoon_vert:cf,meshtoon_frag:uf,points_vert:hf,points_frag:df,shadow_vert:ff,shadow_frag:pf,sprite_vert:mf,sprite_frag:gf},re={common:{diffuse:{value:new Te(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaMapTransform:{value:new Ue},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ue}},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 Ue}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ue}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ue},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ue},normalScale:{value:new Ae(1,1)}}
vendor: 7,003 bytes, line 3208
3208,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ue},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ue}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ue}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ue}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Te(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 Te(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ue}},sprite:{diffuse:{value:new Te(16777215)},opacity:{value:1},center:{value:new Ae(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ue},alphaMap:{value:null},alphaTest:{value:0}}},Xt={basic:{uniforms:vt([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.fog]),vertexShader:Le.meshbasic_vert,fragmentShader:Le.meshbasic_frag},lambert:{uniforms:vt([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 Te(0)}}]),vertexShader:Le.meshlambert_vert,fragmentShader:Le.meshlambert_frag},phong:{uniforms:vt([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 Te(0)},specular:{value:new Te(1118481)},shininess:{value:30}}]),vertexShader:Le.meshphong_vert,fragmentShader:Le.meshphong_frag},standard:{uniforms:vt([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 Te(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Le.meshphysical_vert,fragmentShader:Le.meshphysical_frag},toon:{uniforms:vt([re.common,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.gradientmap,re.fog,re.lights,{emissive:{value:new Te(0)}}]),vertexShader:Le.meshtoon_vert,fragmentShader:Le.meshtoon_frag},matcap:{uniforms:vt([re.common,re.bumpmap,re.normalmap,re.displacementmap,re.fog,{matcap:{value:null}}]),vertexShader:Le.meshmatcap_vert,fragmentShader:Le.meshmatcap_frag},points:{uniforms:vt([re.points,re.fog]),vertexShader:Le.points_vert,fragmentShader:Le.points_frag},dashed:{uniforms:vt([re.common,re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Le.linedashed_vert,fragmentShader:Le.linedashed_frag},depth:{uniforms:vt([re.common,re.displacementmap]),vertexShader:Le.depth_vert,fragmentShader:Le.depth_frag},normal:{uniforms:vt([re.common,re.bumpmap,re.normalmap,re.displacementmap,{opacity:{value:1}}]),vertexShader:Le.meshnormal_vert,fragmentShader:Le.meshnormal_frag},sprite:{uniforms:vt([re.sprite,re.fog]),vertexShader:Le.sprite_vert,fragmentShader:Le.sprite_frag},background:{uniforms:{uvTransform:{value:new Ue},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Le.background_vert,fragmentShader:Le.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Le.backgroundCube_vert,fragmentShader:Le.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Le.cube_vert,fragmentShader:Le.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Le.equirect_vert,fragmentShader:Le.equirect_frag},distanceRGBA:{uniforms:vt([re.common,re.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Le.distanceRGBA_vert,fragmentShader:Le.distanceRGBA_frag},shadow:{uniforms:vt([re.lights,re.fog,{color:{value:new Te(0)},opacity:{value:1}}]),vertexShader:Le.shadow_vert,fragmentShader:Le.shadow_frag}};Xt.physical={uniforms:vt([Xt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ue},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ue},clearcoatNormalScale:{value:new Ae(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ue},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ue},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ue},sheen:{value:0},sheenColor:{value:new Te(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ue},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ue},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ue},transmissionSamplerSize:{value:new Ae},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ue},attenuationDistance:{value:0},attenuationColor:{value:new Te(0)},specularColor:{value:new Te(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ue},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ue}}]),vertexShader:Le.meshphysical_vert,fragmentShader:Le.meshphysical_frag};const Ms={r:0,b:0,g:0};function _f(o,e,t,n,i,s,r){const a=new Te(0);let l=s===!0?0:1,c,u,h=null,d=0,p=null;function g(m,f){let w=!1,S=f.isScene===!0?f.background:null;S&&S.isTexture&&(S=(f.backgroundBlurriness>0?t:e).get(S));const x=o.xr,b=x.getSession&&x.getSession();b&&b.environmentBlendMode==="additive"&&(S=null),S===null?_(a,l):S&&S.isColor&&(_(S,1),w=!0),(o.autoClear||w)&&o.clear(o.autoClearColor,o.autoClearDepth,o.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Us)?(u===void 0&&(u=new mt(new Ci(1,1,1),new kn({name:"Backgroun
3208dCubeMaterial",uniforms:Ai(Xt.backgroundCube.uniforms),vertexShader:Xt.backgroundCube.vertexShader,fragmentShader:Xt.backgroundCube.fragmentShader,side:bt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,P,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=S,u.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,u.material.toneMapped=S.encoding!==ke,(h!==S||d!==S.version||p!==o.toneMapping)&&(u.material.needsUpdate=!0,h=S,d=S.version,p=o.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new mt(new Xr(2,2),new kn({name:"BackgroundMaterial",uniforms:Ai(Xt.background.uniforms),vertexShader:Xt.background.vertexShader,fragmentShader:Xt.background.fragmentShader,side:an,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=S.encoding!==ke,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||d!==S.version||p!==o.toneMapping)&&(c.material.needsUpdate=!0,h=S,d=S.version,p=o.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function _(m,f){m.getRGB(Ms,ml(o)),n.buffers.color.setClear(Ms.r,Ms.g,Ms.b,f,r)}return{getClearColor:function(){return a},setClearColor:function(m,f=1){a.set(m),l=f,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,_(a,l)},render:g}}function xf(o,e,t,n){const i=o.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),r=n.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function h(O,z,$,J,q){let ne=!1;if(r){const ee=_(J,$,z);c!==ee&&(c=ee,p(c.object)),ne=f(O,J,$,q),ne&&w(O,J,$,q)}else{const ee=z.wireframe===!0;(c.geometry!==J.id||c.program!==$.id||c.wireframe!==ee)&&(c.geometry=J.id,c.program=$.id,c.wireframe=ee,ne=!0)}q!==null&&t.update(q,34963),(ne||u)&&(u=!1,N(O,z,$,J),q!==null&&o.bindBuffer(34963,t.get(q).buffer))}function d(){return n.isWebGL2?o.createVertexArray():s.createVertexArrayOES()}function p(O){return n.isWebGL2?o.bindVertexArray(O):s.bindVertexArrayOES(O)}function g(O){return n.isWebGL2?o.deleteVertexArray(O):s.deleteVertexArrayOES(O)}function _(O,z,$){const J=$.wireframe===!0;let q=a[O.id];q===void 0&&(q={},a[O.id]=q);let ne=q[z.id];ne===void 0&&(ne={},q[z.id]=ne);let ee=ne[J];return ee===void 0&&(ee=m(d()),ne[J]=ee),ee}function m(O){const z=[],$=[],J=[];for(let q=0;q<i;q++)z[q]=0,$[q]=0,J[q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:$,attributeDivisors:J,object:O,attributes:{},index:null}}function f(O,z,$,J){const q=c.attributes,ne=z.attributes;let ee=0;const Me=$.getAttributes();for(const ie in Me)if(Me[ie].location>=0){const Y=q[ie];let ae=ne[ie];if(ae===void 0&&(ie==="instanceMatrix"&&O.instanceMatrix&&(ae=O.instanceMatrix),ie==="instanceColor"&&O.instanceColor&&(ae=O.instanceColor)),Y===void 0||Y.attribute!==ae||ae&&Y.data!==ae.data)return!0;ee++}return c.attributesNum!==ee||c.index!==J}function w(O,z,$,J){const q={},ne=z.attributes;let ee=0;const Me=$.getAttributes();for(const ie in Me)if(Me[ie].location>=0){let Y=ne[ie];Y===void 0&&(ie==="instanceMatrix"&&O.instanceMatrix&&(Y=O.instanceMatrix),ie==="instanceColor"&&O.instanceColor&&(Y=O.instanceColor));const ae={};ae.attribute=Y,Y&&Y.data&&(ae.data=Y.data),q[ie]=ae,ee++}c.attributes=q,c.attributesNum=ee,c.index=J}function S(){const O=c.newAttributes;for(let z=0,$=O.length;z<$;z++)O[z]=0}function x(O){b(O,0)}function b(O,z){const $=c.newAttributes,J=c.enabledAttributes,q=c.attributeDivisors;$[O]=1,J[O]===0&&(o.enableVertexAttribArray(O),J[O]=1),q[O]!==z&&((n.isWebG
vendor: 5,776 bytes, line 3208
3208L2?o:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](O,z),q[O]=z)}function C(){const O=c.newAttributes,z=c.enabledAttributes;for(let $=0,J=z.length;$<J;$++)z[$]!==O[$]&&(o.disableVertexAttribArray($),z[$]=0)}function P(O,z,$,J,q,ne){n.isWebGL2===!0&&($===5124||$===5125)?o.vertexAttribIPointer(O,z,$,q,ne):o.vertexAttribPointer(O,z,$,J,q,ne)}function N(O,z,$,J){if(n.isWebGL2===!1&&(O.isInstancedMesh||J.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;S();const q=J.attributes,ne=$.getAttributes(),ee=z.defaultAttributeValues;for(const Me in ne){const ie=ne[Me];if(ie.location>=0){let V=q[Me];if(V===void 0&&(Me==="instanceMatrix"&&O.instanceMatrix&&(V=O.instanceMatrix),Me==="instanceColor"&&O.instanceColor&&(V=O.instanceColor)),V!==void 0){const Y=V.normalized,ae=V.itemSize,ce=t.get(V);if(ce===void 0)continue;const B=ce.buffer,Se=ce.type,ve=ce.bytesPerElement;if(V.isInterleavedBufferAttribute){const se=V.data,xe=se.stride,ze=V.offset;if(se.isInstancedInterleavedBuffer){for(let me=0;me<ie.locationSize;me++)b(ie.location+me,se.meshPerAttribute);O.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let me=0;me<ie.locationSize;me++)x(ie.location+me);o.bindBuffer(34962,B);for(let me=0;me<ie.locationSize;me++)P(ie.location+me,ae/ie.locationSize,Se,Y,xe*ve,(ze+ae/ie.locationSize*me)*ve)}else{if(V.isInstancedBufferAttribute){for(let se=0;se<ie.locationSize;se++)b(ie.location+se,V.meshPerAttribute);O.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=V.meshPerAttribute*V.count)}else for(let se=0;se<ie.locationSize;se++)x(ie.location+se);o.bindBuffer(34962,B);for(let se=0;se<ie.locationSize;se++)P(ie.location+se,ae/ie.locationSize,Se,Y,ae*ve,ae/ie.locationSize*se*ve)}}else if(ee!==void 0){const Y=ee[Me];if(Y!==void 0)switch(Y.length){case 2:o.vertexAttrib2fv(ie.location,Y);break;case 3:o.vertexAttrib3fv(ie.location,Y);break;case 4:o.vertexAttrib4fv(ie.location,Y);break;default:o.vertexAttrib1fv(ie.location,Y)}}}}C()}function M(){X();for(const O in a){const z=a[O];for(const $ in z){const J=z[$];for(const q in J)g(J[q].object),delete J[q];delete z[$]}delete a[O]}}function A(O){if(a[O.id]===void 0)return;const z=a[O.id];for(const $ in z){const J=z[$];for(const q in J)g(J[q].object),delete J[q];delete z[$]}delete a[O.id]}function K(O){for(const z in a){const $=a[z];if($[O.id]===void 0)continue;const J=$[O.id];for(const q in J)g(J[q].object),delete J[q];delete $[O.id]}}function X(){I(),u=!0,c!==l&&(c=l,p(c.object))}function I(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:X,resetDefaultState:I,dispose:M,releaseStatesOfGeometry:A,releaseStatesOfProgram:K,initAttributes:S,enableAttribute:x,disableUnusedAttributes:C}}function vf(o,e,t,n){const i=n.isWebGL2;let s;function r(c){s=c}function a(c,u){o.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let d,p;if(i)d=o,p="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[p](s,c,u,h),t.update(u,s,h)}this.setMode=r,this.render=a,this.renderInstances=l}function Mf(o,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");n=o.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(P){if(P==="highp"){if(o.getShaderPrecisionFormat(35633,36338).precision>0&&o.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";P="mediump"}return P==="mediump"&&o.getShaderPrecisionFormat(35633,36337).precision>0&&o.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const r=typeof WebGL2RenderingContext<"u"&&o.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=r||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=o.getParameter(34930),d=o.getParameter(35660),p=o.getParameter(3379),g=o.getParameter(34076),_=o.getParameter(34921),m=o.getParameter(36347),f=o.getParameter(36348),w=o.getParameter(36349),S=d>0,x=r||e.has("OES_texture_float"),b=S&&x,C=r?o.getParameter(36183):0;return{isWebGL2:r,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:w,vertexTextures:S,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:C}}function yf(o){const e=this;let t=null,n=0,i=!1,s=!1;const r=new Cn,a=new Ue,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||n!==0||i;return i=d,n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,p){const g=h.clippingPlanes,_=h.clipIntersection,m=h.clipShadows,f=o.get(h);if(!i||g===null||g.length===0||s&&!m)s?u(null):c();else{const w=s?0:n,S=w*4;let x=f.clippingState||null;l.value=x,x=u(g,d,S,p);for(let b=0;b!==S;++b)x[b]=t[b];f.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=w}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,p,g){const _=h!==null?h.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const f=p+_*4,w=d.matrixWorldInverse;a.getNormalMatrix(w),(m===null||m.length<f)&&(m=new Float32Array(f));for(let S=0,x=p;S!==_;
vendor: 10,705 bytes, lines 3208-3283
3208++S,x+=4)r.copy(h[S]).applyMatrix4(w,a),r.normal.toArray(m,x),m[x+3]=r.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Sf(o){let e=new WeakMap;function t(r,a){return a===Ar?r.mapping=Mi:a===Er&&(r.mapping=yi),r}function n(r){if(r&&r.isTexture&&r.isRenderTargetTexture===!1){const a=r.mapping;if(a===Ar||a===Er)if(e.has(r)){const l=e.get(r).texture;return t(l,r.mapping)}else{const l=r.image;if(l&&l.height>0){const c=new Fu(l.height/2);return c.fromEquirectangularTexture(o,r),e.set(r,c),r.addEventListener("dispose",i),t(c.texture,r.mapping)}else return null}}return r}function i(r){const a=r.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class jr extends gl{constructor(e=-1,t=1,n=1,i=-1,s=.1,r=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=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,r=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,r=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,r,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const pi=4,Za=[.125,.215,.35,.446,.526,.582],Rn=20,pr=new jr,$a=new Te;let mr=null;const Ln=(1+Math.sqrt(5))/2,li=1/Ln,Ja=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,Ln,li),new L(0,Ln,-li),new L(li,0,Ln),new L(-li,0,Ln),new L(Ln,li,0),new L(-Ln,li,0)];class Qa{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){mr=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=no(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=to(),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(mr),e.scissorTest=!1,ys(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Mi||e.mapping===yi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),mr=this._renderer.getRenderTarget();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:St,minFilter:St,generateMipmaps:!1,type:qi,format:Ut,encoding:Bn,depthBuffer:!1},i=eo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=eo(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=bf(s)),this._blurMaterial=wf(s,e,t)}return i}_compileMaterial(e){const t=new mt(this._lodPlanes[0],e);this._renderer.compile(t,pr)}_sceneToCubeUV(e,t,n,i){const a=new Mt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor($a),u.toneMapping=rn,u.autoClear=!1;const p=new In({name:"PMREM.Background",side:bt,depthWrite:!1,depthTest:!1}),g=new mt(new Ci,p);let _=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,_=!0):(p.color.copy($a),_=!0);for(let f=0;f<6;f++){const w=f%3;w===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):w===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const S=this._cubeSize;ys(i,w*S,f>2?S:0,S,S),u.setRenderTarget(i),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Mi||e.mapping===yi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=no()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=to());const s=i?this._cubemapMaterial:this._equirectMaterial,r=new mt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;ys(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(r,pr)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),r=Ja[(i-1)%Ja.length];this._blur(e,i-1,i,s,r)}t.autoClear=n}_blur(e,t,n,i,s){const r=this._pingPongRenderTarget;this._halfBlur(e,r,t,n,i,"latitudinal",s),this._halfBlur(r,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,r,a){const l=this._renderer,c=this._blurMaterial;r!=="latitudinal"&&r!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new mt(this._lodPlanes[i],c),d=c.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Rn-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):Rn;m>Rn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Rn}`);const f=[];let w=0;for(let P=0;P<Rn;++P){const N=P/_,M=Math.exp(-N*N/2);f.push(M),P===0?w+=M:P<m&&(w+=2*M)}for(let P=0;P<f.length;P++)f[P]=f[P]/w;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=r==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:S}=this;d.dTheta.value=g,d.mipInt.value=S-n;const x=this._sizeLods[i],b=3*x*(i>S-pi?i-S+pi:0),C=4*(this._cubeSize-x);ys(t,b,C,3*x,2*x),l.setRenderTarget(t),l.render(h,pr)}}function bf(o){const e=[],t=[],n=[];let i=o;const s=o-pi+1+Za.length;for(let r=0;r<s;r++){const a=Math.pow(2,i);t.push(a);let l=1/a;r>o-pi?l=Za[r-o+pi-1]:r===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,_=3,m=2,f=1,w=new Float32Array(_*g*p),S=new Float32Array(m*g*p),x=new Float32Array(f*g*p);for(let C=0;C<p;C++){const P=C%3*2/3-1,N=C>2?0:-1,M=[P,N,0,P+2/3,N,0,P+2/3,N+1,0,P,N,0,P+2/3,N+1,0,P,N+1,0];w.set(M,_*g*C),S.set(d,m*g*C);const A=[C,C,C,C,C,C];x.set(A,f*g*C)}const b=new Rt;b.setAttribute("position",new yt(w,_)),b.setAttribute("uv",new yt(S,m)),b.setAttribute("faceIndex",new yt(x,f)),e.push(b),i>pi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function eo(o,e,t){const n=new zn(o,e,t);return n.texture.mapping=Us,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ys(o,e,t,n,i){o.viewport.set(e,t,n,i),o.scissor.set(e,t,n,i)}function wf(o,e,t){const n=new Float32Array(Rn),i=new L(0,1,0);return new kn({name:"SphericalGaussianBlur",defines:{n:Rn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${o}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:qr(),fragmentShader:` 3209 3210 precision mediump float; 3211 precision mediump int; 3212 3213 varying vec3 vOutputDirection; 3214 3215 uniform sampler2D envMap; 3216 uniform int samples; 3217 uniform float weights[ n ]; 3218 uniform bool latitudinal; 3219 uniform float dTheta; 3220 uniform float mipInt; 3221 uniform vec3 poleAxis; 3222 3223 #define ENVMAP_TYPE_CUBE_UV 3224 #include <cube_uv_reflection_fragment> 3225 3226 vec3 getSample( float theta, vec3 axis ) { 3227 3228 float cosTheta = cos( theta ); 3229 // Rodrigues' axis-angle rotation 3230 vec3 sampleDirection = vOutputDirection * cosTheta 3231 + cross( axis, vOutputDirection ) * sin( theta ) 3232 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3233 3234 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3235 3236 } 3237 3238 void main() { 3239 3240 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3241 3242 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3243 3244 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3245 3246 } 3247 3248 axis = normalize( axis ); 3249 3250 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3251 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3252 3253 for ( int i = 1; i < n; i++ ) { 3254 3255 if ( i >= samples ) { 3256 3257 break; 3258 3259 } 3260 3261 float theta = dTheta * float( i ); 3262 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3263 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3264 3265 } 3266 3267 } 3268 `,blending:vn,depthTest:!1,depthWrite:!1})}function to(){return new kn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:qr(),fragmentShader:` 3269 3270 precision mediump float; 3271 precision mediump int; 3272 3273 varying vec3 vOutputDirection; 3274 3275 uniform sampler2D envMap; 3276 3277 #include <common> 3278 3279 void main() { 3280 3281 vec3 outputDirection = normalize( vOutputDirection ); 3282 vec2 uv = equirectUv( outputDirection ); 3283
3284 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3285 3286 } 3287 `,blending:vn,depthTest:!1,depthWrite:!1})}function no(){return new kn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qr(),fragmentShader:` 3288 3289 precision mediump float; 3290 precision mediump int; 3291 3292 uniform float flipEnvMap; 3293 3294 varying vec3 vOutputDirection; 3295 3296 uniform samplerCube envMap; 3297 3298 void main() { 3299 3300 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3301 3302 } 3303 `,blending:vn,depthTest:!1,depthWrite:!1})}function qr(){return` 3304 3305 precision mediump float; 3306 precision mediump int; 3307 3308 attribute float faceIndex; 3309 3310 varying vec3 vOutputDirection; 3311 3312 // RH coordinate system; PMREM face-indexing convention 3313 vec3 getDirection( vec2 uv, float face ) { 3314 3315 uv = 2.0 * uv - 1.0; 3316 3317 vec3 direction = vec3( uv, 1.0 ); 3318 3319 if ( face == 0.0 ) { 3320 3321 direction = direction.zyx; // ( 1, v, u ) pos x 3322 3323 } else if ( face == 1.0 ) { 3324 3325 direction = direction.xzy; 3326 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3327 3328 } else if ( face == 2.0 ) { 3329 3330 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3331 3332 } else if ( face == 3.0 ) { 3333 3334 direction = direction.zyx; 3335 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3336 3337 } else if ( face == 4.0 ) { 3338 3339 direction = direction.xzy; 3340 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3341 3342 } else if ( face == 5.0 ) { 3343 3344 direction.z *= -1.0; // ( u, v, -1 ) neg z 3345 3346 } 3347 3348 return direction; 3349 3350 } 3351 3352 void main() { 3353 3354 vOutputDirection = getDirection( uv, faceIndex ); 3355 gl_Position = vec4( position, 1.0 ); 3356 3357 } 3358 `}function Tf(o){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ar||l===Er,u=l===Mi||l===yi;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new Qa(o)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new Qa(o));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),a.addEventListener("dispose",s),d.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function r(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:r}}function Af(o){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=o.getExtension("WEBGL_depth_texture")||o.getExtension("MOZ_WEBGL_depth_texture")||o.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=o.getExtension("WEBGL_compressed_texture_s3tc")||o.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||o.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=o.getExtension("WEBGL_compressed_texture_pvrtc")||o.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=o.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 Ef(o,e,t,n){const i={},s=new WeakMap;function r(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",r),delete i[d.id];const p=s.get(d);
vendor: 13,855 bytes, lines 3358-3360
3358p&&(e.remove(p),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return i[d.id]===!0||(d.addEventListener("dispose",r),i[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const g in d)e.update(d[g],34962);const p=h.morphAttributes;for(const g in p){const _=p[g];for(let m=0,f=_.length;m<f;m++)e.update(_[m],34962)}}function c(h){const d=[],p=h.index,g=h.attributes.position;let _=0;if(p!==null){const w=p.array;_=p.version;for(let S=0,x=w.length;S<x;S+=3){const b=w[S+0],C=w[S+1],P=w[S+2];d.push(b,C,C,P,P,b)}}else{const w=g.array;_=g.version;for(let S=0,x=w.length/3-1;S<x;S+=3){const b=S+0,C=S+1,P=S+2;d.push(b,C,C,P,P,b)}}const m=new(ol(d)?pl:fl)(d,1);m.version=_;const f=s.get(h);f&&e.remove(f),s.set(h,m)}function u(h){const d=s.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function Cf(o,e,t,n){const i=n.isWebGL2;let s;function r(d){s=d}let a,l;function c(d){a=d.type,l=d.bytesPerElement}function u(d,p){o.drawElements(s,p,a,d*l),t.update(p,s,1)}function h(d,p,g){if(g===0)return;let _,m;if(i)_=o,m="drawElementsInstanced";else if(_=e.get("ANGLE_instanced_arrays"),m="drawElementsInstancedANGLE",_===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}_[m](s,p,a,d*l,g),t.update(p,s,g)}this.setMode=r,this.setIndex=c,this.render=u,this.renderInstances=h}function Lf(o){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,r,a){switch(t.calls++,r){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Rf(o,e){return o[0]-e[0]}function Pf(o,e){return Math.abs(e[1])-Math.abs(o[1])}function If(o,e,t){const n={},i=new Float32Array(8),s=new WeakMap,r=new We,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const g=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,_=g!==void 0?g.length:0;let m=s.get(u);if(m===void 0||m.count!==_){let z=function(){I.dispose(),s.delete(u),u.removeEventListener("dispose",z)};var p=z;m!==void 0&&m.texture.dispose();const S=u.morphAttributes.position!==void 0,x=u.morphAttributes.normal!==void 0,b=u.morphAttributes.color!==void 0,C=u.morphAttributes.position||[],P=u.morphAttributes.normal||[],N=u.morphAttributes.color||[];let M=0;S===!0&&(M=1),x===!0&&(M=2),b===!0&&(M=3);let A=u.attributes.position.count*M,K=1;A>e.maxTextureSize&&(K=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const X=new Float32Array(A*K*4*_),I=new ul(X,A,K,_);I.type=xn,I.needsUpdate=!0;const O=M*4;for(let $=0;$<_;$++){const J=C[$],q=P[$],ne=N[$],ee=A*K*4*$;for(let Me=0;Me<J.count;Me++){const ie=Me*O;S===!0&&(r.fromBufferAttribute(J,Me),X[ee+ie+0]=r.x,X[ee+ie+1]=r.y,X[ee+ie+2]=r.z,X[ee+ie+3]=0),x===!0&&(r.fromBufferAttribute(q,Me),X[ee+ie+4]=r.x,X[ee+ie+5]=r.y,X[ee+ie+6]=r.z,X[ee+ie+7]=0),b===!0&&(r.fromBufferAttribute(ne,Me),X[ee+ie+8]=r.x,X[ee+ie+9]=r.y,X[ee+ie+10]=r.z,X[ee+ie+11]=ne.itemSize===4?r.w:1)}}m={count:_,texture:I,size:new Ae(A,K)},s.set(u,m),u.addEventListener("dispose",z)}let f=0;for(let S=0;S<d.length;S++)f+=d[S];const w=u.morphTargetsRelative?1:1-f;h.getUniforms().setValue(o,"morphTargetBaseInfluence",w),h.getUniforms().setValue(o,"morphTargetInfluences",d),h.getUniforms().setValue(o,"morphTargetsTexture",m.texture,t),h.getUniforms().setValue(o,"morphTargetsTextureSize",m.size)}else{const g=d===void 0?0:d.length;let _=n[u.id];if(_===void 0||_.length!==g){_=[];for(let x=0;x<g;x++)_[x]=[x,0];n[u.id]=_}for(let x=0;x<g;x++){const b=_[x];b[0]=x,b[1]=d[x]}_.sort(Pf);for(let x=0;x<8;x++)x<g&&_[x][1]?(a[x][0]=_[x][0],a[x][1]=_[x][1]):(a[x][0]=Number.MAX_SAFE_INTEGER,a[x][1]=0);a.sort(Rf);const m=u.morphAttributes.position,f=u.morphAttributes.normal;let w=0;for(let x=0;x<8;x++){const b=a[x],C=b[0],P=b[1];C!==Number.MAX_SAFE_INTEGER&&P?(m&&u.getAttribute("morphTarget"+x)!==m[C]&&u.setAttribute("morphTarget"+x,m[C]),f&&u.getAttribute("morphNormal"+x)!==f[C]&&u.setAttribute("morphNormal"+x,f[C]),i[x]=P,w+=P):(m&&u.hasAttribute("morphTarget"+x)===!0&&u.deleteAttribute("morphTarget"+x),f&&u.hasAttribute("morphNormal"+x)===!0&&u.deleteAttribute("morphNormal"+x),i[x]=0)}const S=u.morphTargetsRelative?1:1-w;h.getUniforms().setValue(o,"morphTargetBaseInfluence",S),h.getUniforms().setValue(o,"morphTargetInfluences",i)}}return{update:l}}function Df(o,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);return i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),h}function r(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:r}}const vl=new ct,Ml=new ul,yl=new yu,Sl=new _l,io=[],so=[],ro=new Float32Array(16),ao=new Float32Array(9),oo=new Float32Array(4);function Li(o,e,t){const n=o[0];if(n<=0||n>0)return o;const i=e*t;let s=io[i];if(s===void 0&&(s=new Float32Array(i),io[i]=s),e!==0){n.toArray(s,0);for(let r=1,a=0;r!==e;++r)a+=t,o[r].toArray(s,a)}return s}function it(o,e){if(o.length!==e.length)return!1;for(let t=0,n=o.length;t<n;t++)if(o[t]!==e[t])return!1;return!0}function st(o,e){for(let t=0,n=e.length;t<n;t++)o[t]=e[t]}function Fs(o,e){let t=so[e];t===void 0&&(t=new Int32Array(e),so[e]=t);for(let n=0;n!==e;++n)t[n]=o.allocateTextureUnit();return t}function Nf(o,e){const t=this.cache;t[0]!==e&&(o.uniform1f(this.addr,e),t[0]=e)}function Uf(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(it(t,e))return;o.uniform2fv(this.addr,e),st(t,e)}}function Of(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.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)&&(o.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(it(t,e))return;o.uniform3fv(this.addr,e),st(t,e)}}function Ff(o,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)&&(o.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(it(t,e))return;o.uniform4fv(this.addr,e),st(t,e)}}function Bf(o,e){const t=this.cache,n=e.elements;if(n===void 0){if(it(t,e))return;o.uniformMatrix2fv(this.addr,!1,e),st(t,e)}else{if(it(t,n))return;oo.set(n),o.uniformMatrix2fv(this.addr,!1,oo),st(t,n)}}function zf(o,e){const t=this.cache,n=e.elements;if(n===void 0){if(it(t,e))return;o.uniformMatrix3fv(this.addr,!1,e),st(t,e)}else{if(it(t,n))return;ao.set(n),o.uniformMatrix3fv(this.addr,!1,ao),st(t,n)}}function kf(o,e){const t=this.cache,n=e.elements;if(n===void 0){if(it(t,e))return;o.uniformMatrix4fv(this.addr,!1,e),st(t,e)}else{if(it(t,n))return;ro.set(n),o.uniformMatrix4fv(this.addr,!1,ro),st(t,n)}}function Vf(o,e){const t=this.cache;t[0]!==e&&(o.uniform1i(this.addr,e),t[0]=e)}function Hf(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(it(t,e))return;o.uniform2iv(this.addr,e),st(t,e)}}function Gf(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(it(t,e))return;o.uniform3iv(this.addr,e),st(t,e)}}function Wf(o,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)&&(o.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(it(t,e))return;o.uniform4iv(this.addr,e),st(t,e)}}function Xf(o,e){const t=this.cache;t[0]!==e&&(o.uniform1ui(this.addr,e),t[0]=e)}function jf(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(it(t,e))return;o.uniform2uiv(this.addr,e),st(t,e)}}function qf(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(it(t,e))return;o.uniform3uiv(this.addr,e),st(t,e)}}function Yf(o,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)&&(o.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(it(t,e))return;o.uniform4uiv(this.addr,e),st(t,e)}}function Kf(o,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(o.uniform1i(this.addr,i),n[0]=i),t.setTexture2D(e||vl,i)}function Zf(o,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(o.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||yl,i)}function $f(o,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(o.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Sl,i)}function Jf(o,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(o.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Ml,i)}function Qf(o){switch(o){case 5126:return Nf;case 35664:return Uf;case 35665:return Of;case 35666:return Ff;case 35674:return Bf;case 35675:return zf;case 35676:return kf;case 5124:case 35670:return Vf;case 35667:case 35671:return Hf;case 35668:case 35672:return Gf;case 35669:case 35673:return Wf;case 5125:return Xf;case 36294:return jf;case 36295:return qf;case 36296:return Yf;case 35678:case 36198:case 36298:case 36306:case 35682:return Kf;case 35679:case 36299:case 36307:return Zf;case 35680:case 36300:case 36308:case 36293:return $f;case 36289:case 36303:case 36311:case 36292:return Jf}}function ep(o,e){o.uniform1fv(this.addr,e)}function tp(o,e){const t=Li(e,this.size,2);o.uniform2fv(this.addr,t)}function np(o,e){const t=Li(e,this.size,3);o.uniform3fv(this.addr,t)}function ip(o,e){const t=Li(e,this.size,4);o.uniform4fv(this.addr,t)}function sp(o,e){const t=Li(e,this.size,4);o.uniformMatrix2fv(this.addr,!1,t)}function rp(o,e){const t=Li(e,this.size,9);o.uniformMatrix3fv(this.addr,!1,t)}function ap(o,e){const t=Li(e,this.size,16);o.uniformMatrix4fv(this.addr,!1,t)}function op(o,e){o.uniform1iv(this.addr,e)}function lp(o,e){o.uniform2iv(this.addr,e)}function cp(o,e){o.uniform3iv(this.addr,e)}function up(o,e){o.uniform4iv(this.addr,e)}function hp(o,e){o.uniform1uiv(this.addr,e)}function dp(o,e){o.uniform2uiv(this.addr,e)}function fp(o,e){o.uniform3uiv(this.addr,e)}function pp(o,e){o.uniform4uiv(this.addr,e)}function mp(o,e,t){const n=this.cache,i=e.length,s=Fs(t,i);it(n,s)||(o.uniform1iv(this.addr,s),st(n,s));for(let r=0;r!==i;++r)t.setTexture2D(e[r]||vl,s[r])}function gp(o,e,t){const n=this.cache,i=e.length,s=Fs(t,i);it(n,s)||(o.uniform1iv(this.addr,s),st(n,s));for(let r=0;r!==i;++r)t.setTexture3D(e[r]||yl,s[r])}function _p(o,e,t){const n=this.cache,i=e.length,s=Fs(t,i);it(n,s)||(o.uniform1iv(this.addr,s),st(n,s));for(let r=0;r!==i;++r)t.setTextureCube(e[r]||Sl,s[r])}function xp(o,e,t){const n=this.cache,i=e.length,s=Fs(t,i);it(n,s)||(o.uniform1iv(this.addr,s),st(n,s));for(let r=0;r!==i;++r)t.setTexture2DArray(e[r]||Ml,s[r])}function vp(o){switch(o){case 5126:return ep;case 35664:return tp;case 35665:return np;case 35666:return ip;case 35674:return sp;case 35675:return rp;case 35676:return ap;case 5124:case 35670:return op;case 35667:case 35671:return lp;case 35668:case 35672:return cp;case 35669:case 35673:return up;case 5125:return hp;case 36294:return dp;case 36295:return fp;case 36296:return pp;case 35678:case 36198:case 36298:case 36306:case 35682:return mp;case 35679:case 36299:case 36307:return gp;case 35680:case 36300:case 36308:case 36293:return _p;case 36289:case 36303:case 36311:case 36292:return xp}}class Mp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=Qf(t.type)}}class yp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=vp(t.type)}}class Sp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,r=i.length;s!==r;++s){const a=i[s];a.setValue(e,t[a.id],n)}}}const gr=/(\w+)(\])?(\[|\.)?/g;function lo(o,e){o.seq.push(e),o.map[e.id]=e}function bp(o,e,t){const n=o.name,i=n.length;for(gr.lastIndex=0;;){const s=gr.exec(n),r=gr.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&r+2===i){lo(t,c===void 0?new Mp(a,o,e):new yp(a,o,e));break}else{let h=t.map[a];h===void 0&&(h=new Sp(a),lo(t,h)),t=h}}}class Ls{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),r=e.getUniformLocation(t,s.name);bp(s,r,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.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 s=0,r=t.length;s!==r;++s){const a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function co(o,e,t){const n=o.createShader(e);return o.shaderSource(n,t),o.compileShader(n),n}let wp=0;function Tp(o,e){const t=o.split(` 3359`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let r=i;r<s;r++){const a=r+1;n.push(`${a===e?">":" "} ${a}: ${t[r]}`)}return n.join(` 3360`)}function Ap(o){switch(o){case Bn:return["Linear","( value )"];case ke:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",o),["Linear","( value )"]}}
3360function uo(o,e,t){const n=o.getShaderParameter(e,35713),i=o.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const r=parseInt(s[1]);return t.toUpperCase()+` 3361 3362`+i+` 3363 3364`+Tp(o.getShaderSource(e),r)}else return i}function Ep(o,e){const t=Ap(e);return"vec4 "+o+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Cp(o,e){let t;switch(e){case Ac:t="Linear";break;case Ec:t="Reinhard";break;case Cc:t="OptimizedCineon";break;case Lc:t="ACESFilmic";break;case Rc:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+o+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Lp(o){return[o.extensionDerivatives||o.envMapCubeUVHeight||o.bumpMap||o.normalMapTangentSpace||o.clearcoatNormalMap||o.flatShading||o.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(o.extensionFragDepth||o.logarithmicDepthBuffer)&&o.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",o.extensionDrawBuffers&&o.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(o.extensionShaderTextureLOD||o.envMap||o.transmission)&&o.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Wi).join(` 3365`)}function Rp(o){const e=[];for(const t in o){const n=o[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3366`)}function Pp(o,e){const t={},n=o.getProgramParameter(e,35721);for(let i=0;i<n;i++){const s=o.getActiveAttrib(e,i),r=s.name;let a=1;s.type===35674&&(a=2),s.type===35675&&(a=3),s.type===35676&&(a=4),t[r]={type:s.type,location:o.getAttribLocation(e,r),locationSize:a}}return t}function Wi(o){return o!==""}function ho(o,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return o.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 fo(o,e){return o.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ip=/^[ \t]*#include +<([\w\d./]+)>/gm;function Dr(o){return o.replace(Ip,Dp)}function Dp(o,e){const t=Le[e];
3366if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Dr(t)}const Np=/#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 po(o){return o.replace(Np,Up)}function Up(o,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function mo(o){let e="precision "+o.precision+` float; 3367precision `+o.precision+" int;";return o.precision==="highp"?e+=` 3368#define HIGH_PRECISION`:o.precision==="mediump"?e+=` 3369#define MEDIUM_PRECISION`:o.precision==="lowp"&&(e+=` 3370#define LOW_PRECISION`),e}function Op(o){let e="SHADOWMAP_TYPE_BASIC";return o.shadowMapType===Yo?e="SHADOWMAP_TYPE_PCF":o.shadowMapType===sc?e="SHADOWMAP_TYPE_PCF_SOFT":o.shadowMapType===Gi&&(e="SHADOWMAP_TYPE_VSM"),e}function Fp(o){let e="ENVMAP_TYPE_CUBE";if(o.envMap)switch(o.envMapMode){case Mi:case yi:e="ENVMAP_TYPE_CUBE";break;case Us:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Bp(o){let e="ENVMAP_MODE_REFLECTION";if(o.envMap)switch(o.envMapMode){case yi:e="ENVMAP_MODE_REFRACTION";break}return e}function zp(o){let e="ENVMAP_BLENDING_NONE";if(o.envMap)switch(o.combine){case $o:e="ENVMAP_BLENDING_MULTIPLY";break;case wc:e="ENVMAP_BLENDING_MIX";break;case Tc:e="ENVMAP_BLENDING_ADD";break}return e}function kp(o){const e=o.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 Vp(o,e,t,n){const i=o.getContext(),s=t.defines;let r=t.vertexShader,a=t.fragmentShader;const l=Op(t),c=Fp(t),u=Bp(t),h=zp(t),d=kp(t),p=t.isWebGL2?"":Lp(t),g=Rp(s),_=i.createProgram();let m,f,w=t.glslVersion?"#version "+t.glslVersion+` 3371`:"";t.isRawShaderMaterial?(m=[g].filter(Wi).join(` 3372`),m.length>0&&(m+=` 3373`),f=[p,g].filter(Wi).join(` 3374`),f.length>0&&(f+=` 3375`)):(m=[mo(t),"#define SHADER_NAME "+t.shaderName,g,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 "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",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 "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#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",` 3376`].filter(Wi).join(` 3377`),f=[p,mo(t),"#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 "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",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.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
3377IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==rn?"#define TONE_MAPPING":"",t.toneMapping!==rn?Le.tonemapping_pars_fragment:"",t.toneMapping!==rn?Cp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Le.encodings_pars_fragment,Ep("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3378`].filter(Wi).join(` 3379`)),r=Dr(r),r=ho(r,t),r=fo(r,t),a=Dr(a),a=ho(a,t),a=fo(a,t),r=po(r),a=po(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(w=`#version 300 es 3380`,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3381`)+` 3382`+m,f=["#define varying in",t.glslVersion===Na?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Na?"":"#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(` 3383`)+` 3384`+f);const S=w+m+r,x=w+f+a,b=co(i,35633,S),C=co(i,35632,x);if(i.attachShader(_,b),i.attachShader(_,C),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_),o.debug.checkShaderErrors){const M=i.getProgramInfoLog(_).trim(),A=i.getShaderInfoLog(b).trim(),K=i.getShaderInfoLog(C).trim();let X=!0,I=!0;if(i.getProgramParameter(_,35714)===!1)if(X=!1,typeof o.debug.onShaderError=="function")o.debug.onShaderError(i,_,b,C);else{const O=uo(i,b,"vertex"),z=uo(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,35715
3384)+` 3385 3386Program Info Log: `+M+` 3387`+O+` 3388`+z)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(A===""||K==="")&&(I=!1);I&&(this.diagnostics={runnable:X,programLog:M,vertexShader:{log:A,prefix:m},fragmentShader:{log:K,prefix:f}})}i.deleteShader(b),i.deleteShader(C);let P;this.getUniforms=function(){return P===void 0&&(P=new Ls(i,_)),P};let N;return this.getAttributes=function(){return N===void 0&&(N=Pp(i,_)),N},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.name=t.shaderName,this.id=wp++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=C,this}let Hp=0;class Gp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),r=this._getShaderCacheForMaterial(e);return r.has(i)===!1&&(r.add(i),i.usedTimes++),r.has(s)===!1&&(r.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Wp(e),t.set(e,n)),n}}class Wp{constructor(e){this.id=Hp++,this.code=e,this.usedTimes=0}}function Xp(o,e,t,n,i,s,r){const a=new hl,l=new Gp,c=[],u=i.isWebGL2,h=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===1?"uv2":"uv"}function m(M,A,K,X,I){const O=X.fog,z=I.geometry,$=M.isMeshStandardMaterial?X.environment:null,J=(M.isMeshStandardMaterial?t:e).get(M.envMap||$),q=J&&J.mapping===Us?J.image.height:null,ne=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 ee=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,Me=ee!==void 0?ee.length:0;let ie=0;z.morphAttributes.position!==void 0&&(ie=1),z.morphAttributes.normal!==void 0&&(ie=2),z.morphAttributes.color!==void 0&&(ie=3);let V,Y,ae,ce;if(ne){const he=Xt[ne];V=he.vertexShader,Y=he.fragmentShader}else V=M.vertexShader,Y=M.fragmentShader,l.update(M),ae=l.getVertexShaderID(M),ce=l.getFragmentShaderID(M);const B=o.getRenderTarget(),Se=I.isInstancedMesh===!0,ve=!!M.map,se=!!M.matcap,xe=!!J,ze=!!M.aoMap,me=!!M.lightMap,Ee=!!M.bumpMap,Ze=!!M.normalMap,qe=!!M.displacementMap,et=!!M.emissiveMap,$e=!!M.metalnessMap,Be=!!M.roughnessMap,Xe=M.clearcoat>0,ht=M.iridescence>0,T=M.sheen>0,v=M.transmission>0,k=Xe&&!!M.clearcoatMap,Z=Xe&&!!M.clearcoatNormalMap,te=Xe&&!!M.clearcoatRoughnessMap,oe=ht&&!!M.iridescenceMap,E=ht&&!!M.iridescenceThicknessMap,j=T&&!!M.sheenColorMap,F=T&&!!M.sheenRoughnessMap,le=!!M.specularMap,de=!!M.specularColorMap,pe=!!M.specularIntensityMap,ue=v&&!!M.transmissionMap,fe=v&&!!M.thicknessMap,be=!!M.gradientMap,Re=!!M.alphaMap,Je=M.alphaTest>0,R=!!M.extensions,G=!!z.attributes.uv2;return{isWebGL2:u,shaderID:ne,shaderName:M.type,vertexShader:V,fragmentShader:Y,defines:M.defines,customVertexShaderID:ae,customFragmentShaderID:ce,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,instancing:Se,instancingColor:Se&&I.instanceColor!==null,supportsVertexTextures:d,outputEncoding:B===null?o.outputEncoding:B.isXRRenderTarget===!0?B.texture.encoding:Bn,map:ve,matcap:se,envMap:xe,envMapMode:xe&&J.mapping,envMapCubeUVHeight:q,aoMap:ze,lightMap:me,bumpMap:Ee,normalMap:Ze,displacementMap:d&&qe,emissiveMap:et,normalMapObjectSpace:Ze&&M.normalMapType===Qc,normalMapTangentSpace:Ze&&M.normalMapType===nl,decodeVideoTexture:ve&&M.map.isVideoTexture===!0&&M.map.encoding===ke,metalnessMap:$e,roughnessMap:Be,clearcoat:Xe,clearcoatMap:k,
3388clearcoatNormalMap:Z,clearcoatRoughnessMap:te,iridescence:ht,iridescenceMap:oe,iridescenceThicknessMap:E,sheen:T,sheenColorMap:j,sheenRoughnessMap:F,specularMap:le,specularColorMap:de,specularIntensityMap:pe,transmission:v,transmissionMap:ue,thicknessMap:fe,gradientMap:be,opaque:M.transparent===!1&&M.blending===mi,alphaMap:Re,alphaTest:Je,combine:M.combine,mapUv:ve&&_(M.map.channel),aoMapUv:ze&&_(M.aoMap.channel),lightMapUv:me&&_(M.lightMap.channel),bumpMapUv:Ee&&_(M.bumpMap.channel),normalMapUv:Ze&&_(M.normalMap.channel),displacementMapUv:qe&&_(M.displacementMap.channel),emissiveMapUv:et&&_(M.emissiveMap.channel),metalnessMapUv:$e&&_(M.metalnessMap.channel),roughnessMapUv:Be&&_(M.roughnessMap.channel),clearcoatMapUv:k&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:Z&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:oe&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:E&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:j&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:F&&_(M.sheenRoughnessMap.channel),specularMapUv:le&&_(M.specularMap.channel),specularColorMapUv:de&&_(M.specularColorMap.channel),specularIntensityMapUv:pe&&_(M.specularIntensityMap.channel),transmissionMapUv:ue&&_(M.transmissionMap.channel),thicknessMapUv:fe&&_(M.thicknessMap.channel),alphaMapUv:Re&&_(M.alphaMap.channel),vertexTangents:Ze&&!!z.attributes.tangent,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,vertexUvs2:G,pointsUvs:I.isPoints===!0&&!!z.attributes.uv&&(ve||Re),fog:!!O,useFog:M.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:I.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:Me,morphTextureStride:ie,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:M.dithering,shadowMapEnabled:o.shadowMap.enabled&&K.length>0,shadowMapType:o.shadowMap.type,toneMapping:M.toneMapped?o.toneMapping:rn,useLegacyLights:o.useLegacyLights,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===jt,flipSided:M.side===bt,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:R&&M.extensions.derivatives===!0,extensionFragDepth:R&&M.extensions.fragDepth===!0,extensionDrawBuffers:R&&M.extensions.drawBuffers===!0,extensionShaderTextureLOD:R&&M.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function f(M){const A=[];if(M.shaderID?A.push(M.shaderID):(A.push(M.customVertexShaderID),A.push(M.customFragmentShaderID)),M.defines!==void 0)for(const K in M.defines)A.push(K),A.push(M.defines[K]);return M.isRawShaderMaterial===!1&&(w(A,M),S(A,M),A.push(o.outputEncoding)),A.push(M.customProgramCacheKey),A.join()}function w(M,A){M.push(A.precision),M.push(A.outputEncoding),M.push(A.envMapMode),M.push(A.envMapCubeUVHeight),M.push(A.mapUv),M.push(A.alphaMapUv),M.push(A.lightMapUv),M.push(A.aoMapUv),M.push(A.bumpMapUv),M.push(A.normalMapUv),M.push(A.displacementMapUv),M.push(A.emissiveMapUv),M.push(A.metalnessMapUv),M.push(A.roughnessMapUv),M.push(A.clearcoatMapUv),M.push(A.clearcoatNormalMapUv),M.push(A.clearcoatRoughnessMapUv),M.push(A.iridescenceMapUv),M.push(A.iridescenceThicknessMapUv),M.push(A.sheenColorMapUv),M.push(A.sheenRoughnessMapUv),M.push(A.specularMapUv),M.push(A.specularColorMapUv),M.push(A.specularIntensityMapUv),M.push(A.transmissionMapUv),M.push(A.thicknessMapUv),M.push(A.comb
vendor: 7,762 bytes, line 3388
3388ine),M.push(A.fogExp2),M.push(A.sizeAttenuation),M.push(A.morphTargetsCount),M.push(A.morphAttributeCount),M.push(A.numDirLights),M.push(A.numPointLights),M.push(A.numSpotLights),M.push(A.numSpotLightMaps),M.push(A.numHemiLights),M.push(A.numRectAreaLights),M.push(A.numDirLightShadows),M.push(A.numPointLightShadows),M.push(A.numSpotLightShadows),M.push(A.numSpotLightShadowsWithMaps),M.push(A.shadowMapType),M.push(A.toneMapping),M.push(A.numClippingPlanes),M.push(A.numClipIntersection),M.push(A.depthPacking)}function S(M,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUvs2&&a.enable(13),A.vertexTangents&&a.enable(14),M.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.decodeVideoTexture&&a.enable(17),A.opaque&&a.enable(18),A.pointsUvs&&a.enable(19),M.push(a.mask)}function x(M){const A=g[M.type];let K;if(A){const X=Xt[A];K=Du.clone(X.uniforms)}else K=M.uniforms;return K}function b(M,A){let K;for(let X=0,I=c.length;X<I;X++){const O=c[X];if(O.cacheKey===A){K=O,++K.usedTimes;break}}return K===void 0&&(K=new Vp(o,A,M,s),c.push(K)),K}function C(M){if(--M.usedTimes===0){const A=c.indexOf(M);c[A]=c[c.length-1],c.pop(),M.destroy()}}function P(M){l.remove(M)}function N(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:x,acquireProgram:b,releaseProgram:C,releaseShaderCache:P,programs:c,dispose:N}}function jp(){let o=new WeakMap;function e(s){let r=o.get(s);return r===void 0&&(r={},o.set(s,r)),r}function t(s){o.delete(s)}function n(s,r,a){o.get(s)[r]=a}function i(){o=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function qp(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.material.id!==e.material.id?o.material.id-e.material.id:o.z!==e.z?o.z-e.z:o.id-e.id}function go(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?e.z-o.z:o.id-e.id}function _o(){const o=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function r(h,d,p,g,_,m){let f=o[e];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:g,renderOrder:h.renderOrder,z:_,group:m},o[e]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=g,f.renderOrder=h.renderOrder,f.z=_,f.group=m),e++,f}function a(h,d,p,g,_,m){const f=r(h,d,p,g,_,m);p.transmission>0?n.push(f):p.transparent===!0?i.push(f):t.push(f)}function l(h,d,p,g,_,m){const f=r(h,d,p,g,_,m);p.transmission>0?n.unshift(f):p.transparent===!0?i.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||qp),n.length>1&&n.sort(d||go),i.length>1&&i.sort(d||go)}function u(){for(let h=e,d=o.length;h<d;h++){const p=o[h];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:s,push:a,unshift:l,finish:u,sort:c}}function Yp(){let o=new WeakMap;function e(n,i){const s=o.get(n);let r;return s===void 0?(r=new _o,o.set(n,[r])):i>=s.length?(r=new _o,s.push(r)):r=s[i],r}function t(){o=new WeakMap}return{get:e,dispose:t}}function Kp(){const o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new L,color:new Te};break;case"SpotLight":t={position:new L,direction:new L,color:new Te,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Te,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Te,groundColor:new Te};break;case"RectAreaLight":t={color:new Te,position:new L,halfWidth:new L,halfHeight:new L};break}return o[e.id]=t,t}}}function Zp(){const o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae,shadowCameraNear:1,shadowCameraFar:1e3};break}return o[e.id]=t,t}}}let $p=0;function Jp(o,e){return(e.castShadow?2:0)-(o.castShadow?2:0)+(e.map?1:0)-(o.map?1:0)}function Qp(o,e){const t=new Kp,n=Zp(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)i.probe.push(new L);const s=new L,r=new De,a=new De;function l(u,h){let d=0,p=0,g=0;for(let K=0;K<9;K++)i.probe[K].set(0,0,0);let _=0,m=0,f=0,w=0,S=0,x=0,b=0,C=0,P=0,N=0;u.sort(Jp);const M=h===!0?Math.PI:1;for(let K=0,X=u.length;K<X;K++){const I=u[K],O=I.color,z=I.intensity,$=I.distance,J=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)d+=O.r*z*M,p+=O.g*z*M,g+=O.b*z*M;else if(I.isLightProbe)for(let q=0;q<9;q++)i.probe[q].addScaledVector(I.sh.coefficients[q],z);else if(I.isDirectionalLight){const q=t.get(I);if(q.color.copy(I.color).multiplyScalar(I.intensity*M),I.castShadow){const ne=I.shadow,ee=n.get(I);ee.shadowBias=ne.bias,ee.shadowNormalBias=ne.normalBias,ee.shadowRadius=ne.radius,ee.shadowMapSize=ne.mapSize,i.directionalShadow[_]=ee,i.directionalShadowMap[_]=J,i.directionalShadowMatrix[_]=I.shadow.matrix,x++}i.directional[_]=q,_++}else if(I.isSpotLight){const q=t.get(I);q.position.setFromMatrixPosition(I.matrixWorld),q.color.copy(O).multiplyScalar(z*M),q.distance=$,q.coneCos=Math.cos(I.angle),q.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),q.decay=I.decay,i.spot[f]=q;const ne=I.shadow;if(I.map&&(i.spotLightMap[P]=I.map,P++,ne.updateMatrices(I),I.castShadow&&N++),i.spotLightMatrix[f]=ne.matrix,I.castShadow){const ee=n.get(I);ee.shadowBias=ne.bias,ee.shadowNormalBias=ne.normalBias,ee.shadowRadius=ne.radius,ee.shadowMapSize=ne.mapSize,i.spotShadow[f]=ee,i.spotShadowMap[f]=J,C++}f++}else if(I.isRectAreaLight){const q=t.get(I);q.color.copy(O).multiplyScalar(z),q.halfWidth.set(I.width*.5,0,0),q.halfHeight.set(0,I.height*.5,0),i.rectArea[w]=q,w++}else if(I.isPointLight){const q=t.get(I);if(q.color.copy(I.color).multiplyScalar(I.intensity*M),q.distance=I.distance,q.decay=I.decay,I.castShadow){const ne=I.shadow,ee=n.get(I);ee.shadowBias=ne.bias,ee.shadowNormalBias=ne.normalBias,ee.shadowRadius=ne.radius,ee.shadowMapSize=ne.mapSize,ee.shadowCameraNear=ne.camera.near,ee.shadowCameraFar=ne.camera.far,i.pointShadow[m]=ee,i.pointShadowMap[m]=J,i.pointShadowMatrix[m]=I.shadow.matrix,b++}i.point[m]=q,m++}else if(I.isHemisphereLight){const q=t.get(I);q.skyColor.copy(I.color).multiplyScalar(z*M),q.groundColor.copy(I.groundColor).multiplyScalar(z*M),i.hemi[S]=q,
3388S++}}w>0&&(e.isWebGL2||o.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=re.LTC_FLOAT_1,i.rectAreaLTC2=re.LTC_FLOAT_2):o.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 A=i.hash;(A.directionalLength!==_||A.pointLength!==m||A.spotLength!==f||A.rectAreaLength!==w||A.hemiLength!==S||A.numDirectionalShadows!==x||A.numPointShadows!==b||A.numSpotShadows!==C||A.numSpotMaps!==P)&&(i.directional.length=_,i.spot.length=f,i.rectArea.length=w,i.point.length=m,i.hemi.length=S,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=C+P-N,i.spotLightMap.length=P,i.numSpotLightShadowsWithMaps=N,A.directionalLength=_,A.pointLength=m,A.spotLength=f,A.rectAreaLength=w,A.hemiLength=S,A.numDirectionalShadows=x,A.numPointShadows=b,A.numSpotShadows=C,A.numSpotMaps=P,i.version=$p++)}function c(u,h){let d=0,p=0,g=0,_=0,m=0;const f=h.matrixWorldInverse;for(let w=0,S=u.length;w<S;w++){const x=u[w];if(x.isDirectionalLight){const b=i.directional[d];b.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(s),b.direction.transformDirection(f),d++}else if(x.isSpotLight){const b=i.spot[g];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(f),b.direction.setFromMatrixPosition(x.matrixWorld),s.setFromMatrixPosition(x.target.matrixWorld),b.direction.sub(s),b.direction.transformDirection(f),g++}else if(x.isRectAreaLight){const b=i.rectArea[_];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(f),a.identity(),r.copy(x.matrixWorld),r.premultiply(f),a.extractRotation(r),b.halfWidth.set(x.width*.5,0,0),b.halfHeight.set(0,x.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),_++}else if(x.isPointLight){const b=i.point[p];b.position.setFromMatrixPosition(x.matrixWorld),b.position.applyMatrix4(f),p++}else if(x.isHemisphereLight){const b=i.hemi[m];b.direction.setFromMatrixPosition(x.matrixWorld),b.direction.transformDirection(f),m++}}}return{setup:l,setupView:c,state:i}}function xo(o,e){const t=new Qp(o,e),n=[],i=[];function s(){n.length=0,i.length=0}function r(h){n.push(h)}function a(h){i.push(h)}function l(h){t.setup(n,h)}function c(h){t.setupView(n,h)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:r,pushShadow:a}}function em(o,e){let t=new WeakMap;function n(s,r=0){const a=t.get(s);let l;return a===void 0?(l=new xo(o,e),t.set(s,[l])):r>=a.length?(l=new xo(o,e),a.push(l)):l=a[r],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class tm extends qt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$c,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 nm extends qt{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 im=`void main() { 3389 gl_Position = vec4( position, 1.0 ); 3390}`,sm=`uniform sampler2D shadow_pass; 3391uniform vec2 resolution; 3392uniform float radius; 3393#include <packing> 3394void main() {
3395 const float samples = float( VSM_SAMPLES ); 3396 float mean = 0.0; 3397 float squared_mean = 0.0; 3398 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3399 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3400 for ( float i = 0.0; i < samples; i ++ ) { 3401 float uvOffset = uvStart + i * uvStride; 3402 #ifdef HORIZONTAL_PASS 3403 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3404 mean += distribution.x; 3405 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3406 #else 3407 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3408 mean += depth; 3409 squared_mean += depth * depth; 3410 #endif 3411 } 3412 mean = mean / samples; 3413 squared_mean = squared_mean / samples; 3414 float std_dev = sqrt( squared_mean - mean * mean ); 3415 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3416}`;function rm(o,e,t){let n=new Wr;const i=new Ae,s=new Ae,r=new We,a=new tm({depthPacking:Jc}),l=new nm,c={},u=t.maxTextureSize,h={[an]:bt,[bt]:an,[jt]:jt},d=new kn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ae},radius:{value:4}},vertexShader:im,fragmentShader:sm}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new Rt;g.setAttribute("position",new yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new mt(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Yo,this.render=function(x,b,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||x.length===0)return;const P=o.getRenderTarget(),N=o.getActiveCubeFace(),M=o.getActiveMipmapLevel(),A=o.state;A.setBlending(vn),A.buffers.color.setClear(1,1,1,1),A.buffers.depth.setTest(!0),A.setScissorTest(!1);for(let K=0,X=x.length;K<X;K++){const I=x[K],O=I.shadow;if(O===void 0){console.warn("THREE.WebGLShadowMap:",I,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;i.copy(O.mapSize);const z=O.getFrameExtents();if(i.multiply(z),s.copy(O.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/z.x),i.x=s.x*z.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/z.y),i.y=s.y*z.y,O.mapSize.y=s.y)),O.map===null){const J=this.type!==Gi?{minFilter:ot,magFilter:ot}:{};O.map=new zn(i.x,i.y,J),O.map.texture.name=I.name+".shadowMap",O.camera.updateProjectionMatrix()}o.setRenderTarget(O.map),o.clear();const $=O.getViewportCount();for(let J=0;J<$;J++){const q=O.getViewport(J);r.set(s.x*q.x,s.y*q.y,s.x*q.z,s.y*q.w),A.viewport(r),O.updateMatrices(I,J),n=O.getFrustum(),S(b,C,O.camera,I,this.type)}O.isPointLightShadow!==!0&&this.type===Gi&&f(O,C),O.needsUpdate=!1}m.needsUpdate=!1,o.setRenderTarget(P,N,M)};function f(x,b){const C=e.update(_);d.defines.VSM_SAMPLES!==x.blurSamples&&(d.defines.VSM_SAMPLES=x.blurS
3416amples,p.defines.VSM_SAMPLES=x.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),x.mapPass===null&&(x.mapPass=new zn(i.x,i.y)),d.uniforms.shadow_pass.value=x.map.texture,d.uniforms.resolution.value=x.mapSize,d.uniforms.radius.value=x.radius,o.setRenderTarget(x.mapPass),o.clear(),o.renderBufferDirect(b,null,C,d,_,null),p.uniforms.shadow_pass.value=x.mapPass.texture,p.uniforms.resolution.value=x.mapSize,p.uniforms.radius.value=x.radius,o.setRenderTarget(x.map),o.clear(),o.renderBufferDirect(b,null,C,p,_,null)}function w(x,b,C,P){let N=null;const M=C.isPointLight===!0?x.customDistanceMaterial:x.customDepthMaterial;if(M!==void 0)N=M;else if(N=C.isPointLight===!0?l:a,o.localClippingEnabled&&b.clipShadows===!0&&Array.isArray(b.clippingPlanes)&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0||b.map&&b.alphaTest>0){const A=N.uuid,K=b.uuid;let X=c[A];X===void 0&&(X={},c[A]=X);let I=X[K];I===void 0&&(I=N.clone(),X[K]=I),N=I}if(N.visible=b.visible,N.wireframe=b.wireframe,P===Gi?N.side=b.shadowSide!==null?b.shadowSide:b.side:N.side=b.shadowSide!==null?b.shadowSide:h[b.side],N.alphaMap=b.alphaMap,N.alphaTest=b.alphaTest,N.map=b.map,N.clipShadows=b.clipShadows,N.clippingPlanes=b.clippingPlanes,N.clipIntersection=b.clipIntersection,N.displacementMap=b.displacementMap,N.displacementScale=b.displacementScale,N.displacementBias=b.displacementBias,N.wireframeLinewidth=b.wireframeLinewidth,N.linewidth=b.linewidth,C.isPointLight===!0&&N.isMeshDistanceMaterial===!0){const A=o.properties.get(N);A.light=C}return N}function S(x,b,C,P,N){if(x.visible===!1)return;if(x.layers.test(b.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&N===Gi)&&(!x.frustumCulled||n.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const K=e.update(x),X=x.material;if(Array.isArray(X)){const I=K.groups;for(let O=0,z=I.length;O<z;O++){const $=I[O],J=X[$.materialIndex];if(J&&J.visible){const q=w(x,J,P,N);o.renderBufferDirect(C,null,K,q,x,$)}}}else if(X.visible){const I=w(x,X,P,N);o.renderBufferDirect(C,null,K,I,x,null)}}const A=x.children;for(let K=0,X=A.length;K<X;K++)S(A[K],b,C,P,N)}}function am(o,e,t){const n=t.isWebGL2;function i(){let R=!1;const G=new We;let Q=null;const he=new We(0,0,0,0);return{setMask:function(ge){Q!==ge&&!R&&(o.colorMask(ge,ge,ge,ge),Q=ge)},setLocked:function(ge){R=ge},setClear:function(ge,je,Ye,dt,cn){cn===!0&&(ge*=dt,je*=dt,Ye*=dt),G.set(ge,je,Ye,dt),he.equals(G)===!1&&(o.clearColor(ge,je,Ye,dt),he.copy(G))},reset:function(){R=!1,Q=null,he.set(-1,0,0,0)}}}function s(){let R=!1,G=null,Q=null,he=null;return{setTest:function(ge){ge?B(2929):Se(2929)},setMask:function(ge){G!==ge&&!R&&(o.depthMask(ge),G=ge)},setFunc:function(ge){if(Q!==ge){switch(ge){case _c:o.depthFunc(512);break;case xc:o.depthFunc(519);break;case vc:o.depthFunc(513);break;case Tr:o.depthFunc(515);break;case Mc:o.depthFunc(514);break;case yc:o.depthFunc(518);break;case Sc:o.depthFunc(516);break;case bc:o.depthFunc(517);break;default:o.depthFunc(515)}Q=ge}},setLocked:function(ge){R=ge},setClear:function(ge){he!==ge&&(o.clearDepth(ge),he=ge)},reset:function(){R=!1,G=null,Q=null,he=null}}}function r(){let R=!1,G=null,Q=null,he=null,ge=null,je=null,Ye=null,dt=null,cn=null;return{setTest:function(Qe){R||(Qe?B(2960):Se(2960))},setMask:function(Qe){G!==Qe&&!R&&(o.stencilMask(Qe),G=Qe)},setFunc:function(Qe,Pt,Ht){(Q!==Qe||he!==Pt||ge!==Ht)&&(o.stencilFunc(Qe,Pt,Ht),Q=Qe,he=Pt,ge=Ht)},setOp:function(Qe,Pt,Ht){(je!==Qe||Ye!==Pt||dt!==Ht)&&(o.stencilOp(Qe,Pt,Ht),je=Qe,Ye=Pt,dt=Ht)},setLocked:function(Qe){R=Qe},setClear:function(Qe){cn!==Qe&&(o.clearStencil(Qe),cn=Qe)},reset:function(){R=!1,G=null,Q=null,he=null,ge=null,je=null,Ye=null,dt=null,cn=null}}}const a=new i,l=new s,c=new r,u=new WeakMap,h=new WeakMap;let d={},p={},g=new WeakMap,_=[],m=null,f=!1,w=null,S=null,x=null,b=null,C=null,P=null,N=null,M=!1,A=null,K=null,X=null,I=null,O=null;const z=o.getParameter(35661);let $=!1,J=0;const q=o.getParameter(7938);q.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(q)[1]),$=J>=1):q.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),$=J>=2);let ne=null,ee={};const Me=o.getParameter(3088),ie=o.getParameter(2978),V=new We().fromArray(Me),Y=new We().fromArray(ie);
3416function ae(R,G,Q){const he=new Uint8Array(4),ge=o.createTexture();o.bindTexture(R,ge),o.texParameteri(R,10241,9728),o.texParameteri(R,10240,9728);for(let je=0;je<Q;je++)o.texImage2D(G+je,0,6408,1,1,0,6408,5121,he);return ge}const ce={};ce[3553]=ae(3553,3553,1),ce[34067]=ae(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),B(2929),l.setFunc(Tr),qe(!1),et(ra),B(2884),Ee(vn);function B(R){d[R]!==!0&&(o.enable(R),d[R]=!0)}function Se(R){d[R]!==!1&&(o.disable(R),d[R]=!1)}function ve(R,G){return p[R]!==G?(o.bindFramebuffer(R,G),p[R]=G,n&&(R===36009&&(p[36160]=G),R===36160&&(p[36009]=G)),!0):!1}function se(R,G){let Q=_,he=!1;if(R)if(Q=g.get(G),Q===void 0&&(Q=[],g.set(G,Q)),R.isWebGLMultipleRenderTargets){const ge=R.texture;if(Q.length!==ge.length||Q[0]!==36064){for(let je=0,Ye=ge.length;je<Ye;je++)Q[je]=36064+je;Q.length=ge.length,he=!0}}else Q[0]!==36064&&(Q[0]=36064,he=!0);else Q[0]!==1029&&(Q[0]=1029,he=!0);he&&(t.isWebGL2?o.drawBuffers(Q):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Q))}function xe(R){return m!==R?(o.useProgram(R),m=R,!0):!1}const ze={[hi]:32774,[ac]:32778,[oc]:32779};if(n)ze[ca]=32775,ze[ua]=32776;else{const R=e.get("EXT_blend_minmax");R!==null&&(ze[ca]=R.MIN_EXT,ze[ua]=R.MAX_EXT)}const me={[lc]:0,[cc]:1,[uc]:768,[Ko]:770,[gc]:776,[pc]:774,[dc]:772,[hc]:769,[Zo]:771,[mc]:775,[fc]:773};function Ee(R,G,Q,he,ge,je,Ye,dt){if(R===vn){f===!0&&(Se(3042),f=!1);return}if(f===!1&&(B(3042),f=!0),R!==rc){if(R!==w||dt!==M){if((S!==hi||C!==hi)&&(o.blendEquation(32774),S=hi,C=hi),dt)switch(R){case mi:o.blendFuncSeparate(1,771,1,771);break;case aa:o.blendFunc(1,1);break;case oa:o.blendFuncSeparate(0,769,0,1);break;case la:o.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",R);break}else switch(R){case mi:o.blendFuncSeparate(770,771,1,771);break;case aa:o.blendFunc(770,1);break;case oa:o.blendFuncSeparate(0,769,0,1);break;case la:o.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",R);break}x=null,b=null,P=null,N=null,w=R,M=dt}return}
3416ge=ge||G,je=je||Q,Ye=Ye||he,(G!==S||ge!==C)&&(o.blendEquationSeparate(ze[G],ze[ge]),S=G,C=ge),(Q!==x||he!==b||je!==P||Ye!==N)&&(o.blendFuncSeparate(me[Q],me[he],me[je],me[Ye]),x=Q,b=he,P=je,N=Ye),w=R,M=!1}function Ze(R,G){R.side===jt?Se(2884):B(2884);let Q=R.side===bt;G&&(Q=!Q),qe(Q),R.blending===mi&&R.transparent===!1?Ee(vn):Ee(R.blending,R.blendEquation,R.blendSrc,R.blendDst,R.blendEquationAlpha,R.blendSrcAlpha,R.blendDstAlpha,R.premultipliedAlpha),l.setFunc(R.depthFunc),l.setTest(R.depthTest),l.setMask(R.depthWrite),a.setMask(R.colorWrite);const he=R.stencilWrite;c.setTest(he),he&&(c.setMask(R.stencilWriteMask),c.setFunc(R.stencilFunc,R.stencilRef,R.stencilFuncMask),c.setOp(R.stencilFail,R.stencilZFail,R.stencilZPass)),Be(R.polygonOffset,R.polygonOffsetFactor,R.polygonOffsetUnits),R.alphaToCoverage===!0?B(32926):Se(32926)}function qe(R){A!==R&&(R?o.frontFace(2304):o.frontFace(2305),A=R)}function et(R){R!==nc?(B(2884),R!==K&&(R===ra?o.cullFace(1029):R===ic?o.cullFace(1028):o.cullFace(1032))):Se(2884),K=R}function $e(R){R!==X&&($&&o.lineWidth(R),X=R)}function Be(R,G,Q){R?(B(32823),(I!==G||O!==Q)&&(o.polygonOffset(G,Q),I=G,O=Q)):Se(32823)}function Xe(R){R?B(3089):Se(3089)}function ht(R){R===void 0&&(R=33984+z-1),ne!==R&&(o.activeTexture(R),ne=R)}function T(R,G,Q){Q===void 0&&(ne===null?Q=33984+z-1:Q=ne);let he=ee[Q];he===void 0&&(he={type:void 0,texture:void 0},ee[Q]=he),(he.type!==R||he.texture!==G)&&(ne!==Q&&(o.activeTexture(Q),ne=Q),o.bindTexture(R,G||ce[R]),he.type=R,he.texture=G)}function v(){const R=ee[ne];R!==void 0&&R.type!==void 0&&(o.bindTexture(R.type,null),R.type=void 0,R.texture=void 0)}function k(){try{o.compressedTexImage2D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function Z(){try{o.compressedTexImage3D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function te(){try{o.texSubImage2D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function oe(){try{o.texSubImage3D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function E(){try{o.compressedTexSubImage2D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function j(){try{o.compressedTexSubImage3D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function F(){try{o.texStorage2D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function le(){try{o.texStorage3D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function de(){try{o.texImage2D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function pe(){try{o.texImage3D.apply(o,arguments)}catch(R){console.error("THREE.WebGLState:",R)}}function ue(R){V.equals(R)===!1&&(o.scissor(R.x,R.y,R.z,R.w),V.copy(R))}function fe(R){Y.equals(R)===!1&&(o.viewport(R.x,R.y,R.z,R.w),Y.copy(R))}function be(R,G){let Q=h.get(G);Q===void 0&&(Q=new WeakMap,h.set(G,Q));let he=Q.get(R);he===void 0&&(he=o.getUniformBlockIndex(G,R.name),Q.set(R,he))}function Re(R,G){const he=h.get(G).get(R);u.get(G)!==he&&(o.uniformBlockBinding(G,he,R.__bindingPointIndex),u.set(G,he))}function Je(){o.disable(3042),o.disable(2884),o.disable(2929),o.disable(32823),o.disable(3089),o.disable(2960),o.disable(32926),o.blendEquation(32774),o.blendFunc(1,0),o.blendFuncSeparate(1,0,1,0),o.colorMask(!0,!0,!0,!0),o.clearColor(0,0,0,0),o.depthMask(!0),o.depthFunc(513),o.clearDepth(1),o.stencilMask(4294967295),o.stencilFunc(519,0,4294967295),o.stencilOp(7680,7680,7680),o.clearStencil(0),o.cullFace(1029),o.frontFace(2305),o.polygonOffset(0,0),o.activeTexture(33984),o.bindFramebuffer(36160,null),n===!0&&(o.bindFramebuffer(36009,null),o.bindFramebuffer(36008,null)),o.useProgram(null),o.lineWidth(1),o.scissor(0,0,o.canvas.width,o.canvas.height),o.viewport(0,0,o.canvas.width,o.canvas.height),d={},ne=null,ee={},p={},g=new WeakMap,_=[],m=null,f=!1,w=null,S=null,x=null,b=null,C=null,P=null,N=null,M=!1,A=null,K=null,X=null,I=null,O=null,V.set(0,0,o.canvas.width,o.canvas.height),Y.set(0,0,o.canvas.width,o.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:B,disable:Se,bindFramebuffer:ve,drawBuffers:se,useProgram:xe,setBlending:Ee,setMaterial:Ze,setFlipSided:qe,setCullFace:et,setLineWidth:$e,setPolygonOffset:Be,setScissorTest:Xe,activeTexture:ht,bindTexture:T,unbindTexture:v,compressedTexImage2D:k,compressedTexImage3D:Z,texImage2D:de,texImage3D:pe,updateUBOMapping:be,uniformBlockBinding:Re,texStorage2D:F,texStorage3D:le,texSubImage2D:te,texSubImage3D:oe,compressedTexSubImage2D:E,compressedTexSubImage3D:j,scissor:ue,viewport:fe,reset:Je}}
3416function om(o,e,t,n,i,s,r){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=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 w(T,v){return f?new OffscreenCanvas(T,v):Zi("canvas")}function S(T,v,k,Z){let te=1;if((T.width>Z||T.height>Z)&&(te=Z/Math.max(T.width,T.height)),te<1||v===!0)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap){const oe=v?rl:Math.floor,E=oe(te*T.width),j=oe(te*T.height);_===void 0&&(_=w(E,j));const F=k?w(E,j):_;return F.width=E,F.height=j,F.getContext("2d").drawImage(T,0,0,E,j),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+E+"x"+j+")."),F}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function x(T){return Ir(T.width)&&Ir(T.height)}function b(T){return a?!1:T.wrapS!==Nt||T.wrapT!==Nt||T.minFilter!==ot&&T.minFilter!==St}function C(T,v){return T.generateMipmaps&&v&&T.minFilter!==ot&&T.minFilter!==St}function P(T){o.generateMipmap(T)}function N(T,v,k,Z,te=!1){if(a===!1)return v;if(T!==null){if(o[T]!==void 0)return o[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let oe=v;return v===6403&&(k===5126&&(oe=33326),k===5131&&(oe=33325),k===5121&&(oe=33321)),v===33319&&(k===5126&&(oe=33328),k===5131&&(oe=33327),k===5121&&(oe=33323)),v===6408&&(k===5126&&(oe=34836),k===5131&&(oe=34842),k===5121&&(oe=Z===ke&&te===!1?35907:32856),k===32819&&(oe=32854),k===32820&&(oe=32855)),(oe===33325||oe===33326||oe===33327||oe===33328||oe===34842||oe===34836)&&e.get("EXT_color_buffer_float"),oe}function M(T,v,k){return C(T,k)===!0||T.isFramebufferTexture&&T.minFilter!==ot&&T.minFilter!==St?Math.log2(Math.max(v.width,v.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?v.mipmaps.length:1}function A(T){return T===ot||T===Cr||T===Cs?9728:9729}function K(T){const v=T.target;v.removeEventListener("dispose",K),I(v),v.isVideoTexture&&g.delete(v)}function X(T){const v=T.target;v.removeEventListener("dispose",X),z(v)}function I(T){const v=n.get(T);if(v.__webglInit===void 0)return;const k=T.source,Z=m.get(k);if(Z){const te=Z[v.__cacheKey];te.usedTimes--,te.usedTimes===0&&O(T),Object.keys(Z).length===0&&m.delete(k)}n.remove(T)}function O(T){const v=n.get(T);o.deleteTexture(v.__webglTexture);const k=T.source,Z=m.get(k);delete Z[v.__cacheKey],r.memory.textures--}function z(T){const v=T.texture,k=n.get(T),Z=n.get(v);if(Z.__webglTexture!==void 0&&(o.deleteTexture(Z.__webglTexture),r.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let te=0;te<6;te++)o.deleteFramebuffer(k.__webglFramebuffer[te]),k.__webglDepthbuffer&&o.deleteRenderbuffer(k.__webglDepthbuffer[te]);else{if(o.deleteFramebuffer(k.__webglFramebuffer),k.__webglDepthbuffer&&o.deleteRenderbuffer(k.__webglDepthbuffer),k.__webglMultisampledFramebuffer&&o.deleteFramebuffer(k.__webglMultisampledFramebuffer),k.__webglColorRenderbuffer)for(let te=0;te<k.__webglColorRenderbuffer.length;te++)k.__webglColorRenderbuffer[te]&&o.deleteRenderbuffer(k.__webglColorRenderbuffer[te]);k.__webglDepthRenderbuffer&&o.deleteRenderbuffer(k.__webglDepthRenderbuffer)}if(T.isWebGLMultipleRenderTargets)for(let te=0,oe=v.length;te<oe;te++){const E=n.get(v[te]);E.__webglTexture&&(o.deleteTexture(E.__webglTexture),r.memory.textures--),n.remove(v[te])}n.remove(v),n.remove(T)}let $=0;function J(){$=0}function q(){const T=$;return T>=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),$+=1,T}function ne(T){const v=[];return v.push(T.wrapS),v.push(T.wrapT),v.push(T.wrapR||0),v.push(T.magFilter),v.push(T.minFilter),v.push(T.anisotropy),v.push(T.internalFormat),v.push(T.format),v.push(T.type),v.push(T.generateMipmaps),v.push(T.premultiplyAlpha),v.push(T.flipY),v.push(T.unpackAlignment),v.push(T.encoding),v.join()}function ee(T,v){const k=n.get(T);
3416if(T.isVideoTexture&&Xe(T),T.isRenderTargetTexture===!1&&T.version>0&&k.__version!==T.version){const Z=T.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Se(k,T,v);return}}t.bindTexture(3553,k.__webglTexture,33984+v)}function Me(T,v){const k=n.get(T);if(T.version>0&&k.__version!==T.version){Se(k,T,v);return}t.bindTexture(35866,k.__webglTexture,33984+v)}function ie(T,v){const k=n.get(T);if(T.version>0&&k.__version!==T.version){Se(k,T,v);return}t.bindTexture(32879,k.__webglTexture,33984+v)}function V(T,v){const k=n.get(T);if(T.version>0&&k.__version!==T.version){ve(k,T,v);return}t.bindTexture(34067,k.__webglTexture,33984+v)}const Y={[Si]:10497,[Nt]:33071,[Ps]:33648},ae={[ot]:9728,[Cr]:9984,[Cs]:9986,[St]:9729,[Qo]:9985,[On]:9987};function ce(T,v,k){if(k?(o.texParameteri(T,10242,Y[v.wrapS]),o.texParameteri(T,10243,Y[v.wrapT]),(T===32879||T===35866)&&o.texParameteri(T,32882,Y[v.wrapR]),o.texParameteri(T,10240,ae[v.magFilter]),o.texParameteri(T,10241,ae[v.minFilter])):(o.texParameteri(T,10242,33071),o.texParameteri(T,10243,33071),(T===32879||T===35866)&&o.texParameteri(T,32882,33071),(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."),o.texParameteri(T,10240,A(v.magFilter)),o.texParameteri(T,10241,A(v.minFilter)),v.minFilter!==ot&&v.minFilter!==St&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Z=e.get("EXT_texture_filter_anisotropic");if(v.magFilter===ot||v.minFilter!==Cs&&v.minFilter!==On||v.type===xn&&e.has("OES_texture_float_linear")===!1||a===!1&&v.type===qi&&e.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||n.get(v).__currentAnisotropy)&&(o.texParameterf(T,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,i.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy)}}function B(T,v){let k=!1;T.__webglInit===void 0&&(T.__webglInit=!0,v.addEventListener("dispose",K));const Z=v.source;let te=m.get(Z);te===void 0&&(te={},m.set(Z,te));const oe=ne(v);if(oe!==T.__cacheKey){te[oe]===void 0&&(te[oe]={texture:o.createTexture(),usedTimes:0},r.memory.textures++,k=!0),te[oe].usedTimes++;const E=te[T.__cacheKey];E!==void 0&&(te[T.__cacheKey].usedTimes--,E.usedTimes===0&&O(v)),T.__cacheKey=oe,T.__webglTexture=te[oe].texture}return k}function Se(T,v,k){let Z=3553;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Z=35866),v.isData3DTexture&&(Z=32879);const te=B(T,v),oe=v.source;t.bindTexture(Z,T.__webglTexture,33984+k);const E=n.get(oe);if(oe.version!==E.__version||te===!0){t.activeTexture(33984+k),o.pixelStorei(37440,v.flipY),o.pixelStorei(37441,v.premultiplyAlpha),o.pixelStorei(3317,v.unpackAlignment),o.pixelStorei(37443,0);const j=b(v)&&x(v.image)===!1;let F=S(v.image,j,!1,u);F=ht(v,F);const le=x(F)||a,de=s.convert(v.format,v.encoding);let pe=s.convert(v.type),ue=N(v.internalFormat,de,pe,v.encoding,v.isVideoTexture);ce(Z,v,le);let fe;const be=v.mipmaps,Re=a&&v.isVideoTexture!==!0,Je=E.__version===void 0||te===!0,R=M(v,F,le);if(v.isDepthTexture)ue=6402,a?v.type===xn?ue=36012:v.type===Pn?ue=33190:v.type===gi?ue=35056:ue=33189:v.type===xn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===Nn&&ue===6402&&v.type!==el&&v.type!==Pn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=Pn,pe=s.convert(v.type)),v.format===bi&&ue===6402&&(ue=34041,v.type!==gi&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=gi,pe=s.convert(v.type))),Je&&(Re?t.texStorage2D(3553,1,ue,F.width,F.height):t.texImage2D(3553,0,ue,F.width,F.height,0,de,pe,null));else if(v.isDataTexture)if(be.length>0&&le){Re&&Je&&t.texStorage2D(3553,R,ue,be[0].width,be[0].height);for(let G=0,Q=be.length;G<Q;G++)fe=be[G],Re?t.texSubImage2D(3553,G,0,0,fe.width,fe.height,de,pe,fe.data):t.texImage2D(3553,G,ue,fe.width,fe.height,0,de,pe,fe.data);v.generateMipmaps=!1}else Re?(Je&&t.texStorage2D(3553,R,ue,F.width,F.height),t.texSubImage2D(3553,0,0,0,F.width,F.height,de,pe,F.data)):t.texImage2D(3553,0,ue,F.width,F.height,0,de,pe,F.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Re&&Je&&t.texStorage3D(35866,R,ue,be[0].width,be[0].height,F.depth);for(let G=0,Q=be.length;G<Q;G++)fe=be[G],v.format!==Ut?de!==null?Re?t.compressedTexSubImage3D(35866,G,0,0,0,fe.width,fe.height,F.depth,de,fe.data,0,0):t.compressedTexImage3D(35866,G,ue,fe.width,fe.height,F.depth,0,fe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Re?t.texSubImage3D(35866,G,0,0,0,fe.width,fe.height,F.depth,de,pe,fe.data):t.texImage3D(35866,G,ue,fe.width,fe.height,F.depth,0,de,pe,fe.data)}else{Re&&Je&&t.texStorage2D(3553,R,ue,be[0].width,be[0].height);for(let G=0,Q=be.length;G<Q;G++)fe=be[G],v.format!==Ut?de!==null?Re?t.compressedTexSubImage2D(3553,G,0,0,fe.width,fe.height,de,fe.data):t.compressedTexImage2D(3553,G,ue,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Re?t.texSubImage2D(3553,G,0,0,fe.width,fe.height,de,pe,fe.data):t.texImage2D(3553,G,ue,fe.width,fe.height,0,de,pe,fe.data)}else if(v.isDataArrayTexture)Re?(Je&&t.texStorage3D(35866,R,ue,F.width,F.height,F.depth),t.texSubImage3D(35866,0,0,0,0,F.width,F.height,F.depth,de,pe,F.data)):t.texImage3D(35866,0,ue,F.width,F.height,F.depth,0,de,pe,F.data);else if(v.isData3DTexture)Re?(Je&&t.texStorage3D(32879,R,ue,F.width,F.height,F.depth),t.texSubImage3D(32879,0,0,0,0,F.width,F.height,F.depth,de,pe,F.data)):t.texImage3D(32879,0,ue,F.width,F.height,F.depth,0,de,pe,F.data);else if(v.isFramebufferTexture){if(Je)if(Re)t.texStorage2D(3553,R,ue,F.width,F.height);else{let G=F.width,Q=F.height;for(let he=0;he<R;he++)t.texImage2D(3553,he,ue,G,Q,0,de,pe,null),G>>=1,Q>>=1}}else if(be.length>0&&le){Re&&Je&&t.texStorage2D(3553,R,ue,be[0].width,be[0].height);for(let G=0,Q=be.length;G<Q;G++)fe=be[G],Re?t.texSubImage2D(3553,G,0,0,de,pe,fe):t.texImage2D(3553,G,ue,de,pe,fe);v.generateMipmaps=!1}else Re?(Je&&t.texStorage2D(3553,R,ue,F.width,F.height),t.texSubImage2D(3553,0,0,0,de,pe,F)):t.texImage2D(3553,0,ue,de,pe,F);C(v,le)&&P(Z),E.__version=oe.version,v.onUpdate&&v.onUpdate(v)}T.__version=v.version}
vendor: 8,848 bytes, line 3416
3416function ve(T,v,k){if(v.image.length!==6)return;const Z=B(T,v),te=v.source;t.bindTexture(34067,T.__webglTexture,33984+k);const oe=n.get(te);if(te.version!==oe.__version||Z===!0){t.activeTexture(33984+k),o.pixelStorei(37440,v.flipY),o.pixelStorei(37441,v.premultiplyAlpha),o.pixelStorei(3317,v.unpackAlignment),o.pixelStorei(37443,0);const E=v.isCompressedTexture||v.image[0].isCompressedTexture,j=v.image[0]&&v.image[0].isDataTexture,F=[];for(let G=0;G<6;G++)!E&&!j?F[G]=S(v.image[G],!1,!0,c):F[G]=j?v.image[G].image:v.image[G],F[G]=ht(v,F[G]);const le=F[0],de=x(le)||a,pe=s.convert(v.format,v.encoding),ue=s.convert(v.type),fe=N(v.internalFormat,pe,ue,v.encoding),be=a&&v.isVideoTexture!==!0,Re=oe.__version===void 0||Z===!0;let Je=M(v,le,de);ce(34067,v,de);let R;if(E){be&&Re&&t.texStorage2D(34067,Je,fe,le.width,le.height);for(let G=0;G<6;G++){R=F[G].mipmaps;for(let Q=0;Q<R.length;Q++){const he=R[Q];v.format!==Ut?pe!==null?be?t.compressedTexSubImage2D(34069+G,Q,0,0,he.width,he.height,pe,he.data):t.compressedTexImage2D(34069+G,Q,fe,he.width,he.height,0,he.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):be?t.texSubImage2D(34069+G,Q,0,0,he.width,he.height,pe,ue,he.data):t.texImage2D(34069+G,Q,fe,he.width,he.height,0,pe,ue,he.data)}}}else{R=v.mipmaps,be&&Re&&(R.length>0&&Je++,t.texStorage2D(34067,Je,fe,F[0].width,F[0].height));for(let G=0;G<6;G++)if(j){be?t.texSubImage2D(34069+G,0,0,0,F[G].width,F[G].height,pe,ue,F[G].data):t.texImage2D(34069+G,0,fe,F[G].width,F[G].height,0,pe,ue,F[G].data);for(let Q=0;Q<R.length;Q++){const ge=R[Q].image[G].image;be?t.texSubImage2D(34069+G,Q+1,0,0,ge.width,ge.height,pe,ue,ge.data):t.texImage2D(34069+G,Q+1,fe,ge.width,ge.height,0,pe,ue,ge.data)}}else{be?t.texSubImage2D(34069+G,0,0,0,pe,ue,F[G]):t.texImage2D(34069+G,0,fe,pe,ue,F[G]);for(let Q=0;Q<R.length;Q++){const he=R[Q];be?t.texSubImage2D(34069+G,Q+1,0,0,pe,ue,he.image[G]):t.texImage2D(34069+G,Q+1,fe,pe,ue,he.image[G])}}}C(v,de)&&P(34067),oe.__version=te.version,v.onUpdate&&v.onUpdate(v)}T.__version=v.version}function se(T,v,k,Z,te){const oe=s.convert(k.format,k.encoding),E=s.convert(k.type),j=N(k.internalFormat,oe,E,k.encoding);n.get(v).__hasExternalTextures||(te===32879||te===35866?t.texImage3D(te,0,j,v.width,v.height,v.depth,0,oe,E,null):t.texImage2D(te,0,j,v.width,v.height,0,oe,E,null)),t.bindFramebuffer(36160,T),Be(v)?d.framebufferTexture2DMultisampleEXT(36160,Z,te,n.get(k).__webglTexture,0,$e(v)):(te===3553||te>=34069&&te<=34074)&&o.framebufferTexture2D(36160,Z,te,n.get(k).__webglTexture,0),t.bindFramebuffer(36160,null)}function xe(T,v,k){if(o.bindRenderbuffer(36161,T),v.depthBuffer&&!v.stencilBuffer){let Z=33189;if(k||Be(v)){const te=v.depthTexture;te&&te.isDepthTexture&&(te.type===xn?Z=36012:te.type===Pn&&(Z=33190));const oe=$e(v);Be(v)?d.renderbufferStorageMultisampleEXT(36161,oe,Z,v.width,v.height):o.renderbufferStorageMultisample(36161,oe,Z,v.width,v.height)}else o.renderbufferStorage(36161,Z,v.width,v.height);o.framebufferRenderbuffer(36160,36096,36161,T)}else if(v.depthBuffer&&v.stencilBuffer){const Z=$e(v);k&&Be(v)===!1?o.renderbufferStorageMultisample(36161,Z,35056,v.width,v.height):Be(v)?d.renderbufferStorageMultisampleEXT(36161,Z,35056,v.width,v.height):o.renderbufferStorage(36161,34041,v.width,v.height),o.framebufferRenderbuffer(36160,33306,36161,T)}else{const Z=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let te=0;te<Z.length;te++){const oe=Z[te],E=s.convert(oe.format,oe.encoding),j=s.convert(oe.type),F=N(oe.internalFormat,E,j,oe.encoding),le=$e(v);k&&Be(v)===!1?o.renderbufferStorageMultisample(36161,le,F,v.width,v.height):Be(v)?d.renderbufferStorageMultisampleEXT(36161,le,F,v.width,v.height):o.renderbufferStorage(36161,F,v.width,v.height)}}o.bindRenderbuffer(36161,null)}function ze(T,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,T),!(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),ee(v.depthTexture,0);const Z=n.get(v.depthTexture).__webglTexture,te=$e(v);if(v.depthTexture.format===Nn)Be(v)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,Z,0,te):o.framebufferTexture2D(36160,36096,3553,Z,0);else if(v.depthTexture.format===bi)Be(v)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,Z,0,te):o.framebufferTexture2D(36160,33306,3553,Z,0);else throw new Error("Unknown depthTexture format")}function me(T){const v=n.get(T),k=T.isWebGLCubeRenderTarget===!0;if(T.depthTexture&&!v.__autoAllocateDepthBuffer){if(k)throw new Error("target.depthTexture not supported in Cube render targets");ze(v.__webglFramebuffer,T)}else if(k){v.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(36160,v.__webglFramebuffer[Z]),v.__webglDepthbuffer[Z]=o.createRenderbuffer(),xe(v.__webglDepthbuffer[Z],T,!1)}else t.bindFramebuffer(36160,v.__webglFramebuffer),v.__webglDepthbuffer=o.createRenderbuffer(),xe(v.__webglDepthbuffer,T,!1);t.bindFramebuffer(36160,null)}function Ee(T,v,k){const Z=n.get(T);v!==void 0&&se(Z.__webglFramebuffer,T,T.texture,36064,3553),k!==void 0&&me(T)}function Ze(T){const v=T.texture,k=n.get(T),Z=n.get(v);T.addEventListener("dispose",X),T.isWebGLMultipleRenderTargets!==!0&&(Z.__webglTexture===void 0&&(Z.__webglTexture=o.createTexture()),Z.__version=v.version,r.memory.textures++);const te=T.isWebGLCubeRenderTarget===!0,oe=T.isWebGLMultipleRenderTargets===!0,E=x(T)||a;if(te){k.__webglFramebuffer=[];for(let j=0;j<6;j++)k.__webglFramebuffer[j]=o.createFramebuffer()}else{if(k.__webglFramebuffer=o.createFramebuffer(),oe)if(i.drawBuffers){const j=T.texture;for(let F=0,le=j.length;F<le;F++){const de=n.get(j[F]);de.__webglTexture===void 0&&(de.__webglTexture=o.createTexture(),r.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&T.samples>0&&Be(T)===!1){const j=oe?v:[v];k.__webglMultisampledFramebuffer=o.createFramebuffer(),k.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,k.__webglMultisampledFramebuffer);for(let F=0;F<j.length;F++){const le=j[F];k.__webglColorRenderbuffer[F]=o.createRenderbuffer(),o.bindRenderbuffer(36161,k.__webglColorRenderbuffer[F]);const de=s.convert(le.format,le.encoding),pe=s.convert(le.type),ue=N(le.internalFormat,de,pe,le.encoding,T.isXRRenderTarget===!0),fe=$e(T);o.renderbufferStorageMultisample(36161,fe,ue,T.width,T.height),o.framebufferRenderbuffer(36160,36064+F,36161,k.__webglColorRenderbuffer[F])}o.bindRenderbuffer(36161,null),T.depthBuffer&&(k.__webglDepthRenderbuffer=o.createRenderbuffer(),xe(k.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(36160,null)}}if(te){t.bindTexture(34067,Z.__webglTexture),ce(34067,v,E);for(let j=0;j<6;j++)se(k.__webglFramebuffer[j],T,v,36064,34069+j);C(v,E)&&P(34067),t.unbindTexture()}else if(oe){const j=T.texture;for(let F=0,le=j.length;F<le;F++){const de=j[F],pe=n.get(de);t.bindTexture(3553,pe.__webglTexture),ce(3553,de,E),se(k.__webglFramebuffer,T,de,36064+F,3553),C(de,E)&&P(3553)}t.unbindTexture()}else{let j=3553;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(a?j=T.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(j,Z.__webglTexture),ce(j,v,E),se(k.__webglFramebuffer,T,v,36064,j),C(v,E)&&P(j),t.unbindTexture()}T.depthBuffer&&me(T)}function qe(T){const v=x(T)||a,k=T.isWebGLMultipleRenderTargets===!0?T.texture:[T.texture];for(let Z=0,te=k.length;Z<te;Z++){const oe=k[Z];if(C(oe,v)){const E=T.isWebGLCubeRenderTarget?34067:3553,j=n.get(oe).__webglTexture;t.bindTexture(E,j),P(E),t.unbindTexture()}}}function et(T){if(a&&T.samples>0&&Be(T)===!1){const v=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],k=T.width,Z=T.height;let te=16384;const oe=[],E=T.stencilBuffer?33306:36096,j=n.get(T),F=T.isWebGLMultipleRenderTargets===!0;if(F)for(let le=0;le<v.length;le++)t.bindFramebuffer(36160,j.__webglMultisampledFramebuffer),o.framebufferRenderbuffer(36160,36064+le,36161,null),t.bindFramebuffer(36160,j.__webglFramebuffer),o.framebufferTexture2D(36009,36064+le,3553,null,0);t.bindFramebuffer(36008,j.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,j.__webglFramebuffer);for(let le=0;le<v.length;le++){oe.push(36064+le),T.depthBuffer&&oe.push(E);const de=j.__ignoreDepthValues!==void 0?j.__ignoreDepthValues:!1;if(de===!1&&(T.depthBuffer&&(te|=256),T.stencilBuffer&&(te|=1024)),F&&o.framebufferRenderbuffer(36008,36064,36161,j.__webglColorRen
3416derbuffer[le]),de===!0&&(o.invalidateFramebuffer(36008,[E]),o.invalidateFramebuffer(36009,[E])),F){const pe=n.get(v[le]).__webglTexture;o.framebufferTexture2D(36009,36064,3553,pe,0)}o.blitFramebuffer(0,0,k,Z,0,0,k,Z,te,9728),p&&o.invalidateFramebuffer(36008,oe)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),F)for(let le=0;le<v.length;le++){t.bindFramebuffer(36160,j.__webglMultisampledFramebuffer),o.framebufferRenderbuffer(36160,36064+le,36161,j.__webglColorRenderbuffer[le]);const de=n.get(v[le]).__webglTexture;t.bindFramebuffer(36160,j.__webglFramebuffer),o.framebufferTexture2D(36009,36064+le,3553,de,0)}t.bindFramebuffer(36009,j.__webglMultisampledFramebuffer)}}function $e(T){return Math.min(h,T.samples)}function Be(T){const v=n.get(T);return a&&T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Xe(T){const v=r.render.frame;g.get(T)!==v&&(g.set(T,v),T.update())}function ht(T,v){const k=T.encoding,Z=T.format,te=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||T.format===Pr||k!==Bn&&(k===ke?a===!1?e.has("EXT_sRGB")===!0&&Z===Ut?(T.format=Pr,T.minFilter=St,T.generateMipmaps=!1):v=ll.sRGBToLinear(v):(Z!==Ut||te!==Fn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",k)),v}this.allocateTextureUnit=q,this.resetTextureUnits=J,this.setTexture2D=ee,this.setTexture2DArray=Me,this.setTexture3D=ie,this.setTextureCube=V,this.rebindTextures=Ee,this.setupRenderTarget=Ze,this.updateRenderTargetMipmap=qe,this.updateMultisampleRenderTarget=et,this.setupDepthRenderbuffer=me,this.setupFrameBufferTexture=se,this.useMultisampledRTT=Be}function lm(o,e,t){const n=t.isWebGL2;function i(s,r=null){let a;if(s===Fn)return 5121;if(s===Nc)return 32819;if(s===Uc)return 32820;if(s===Pc)return 5120;if(s===Ic)return 5122;if(s===el)return 5123;if(s===Dc)return 5124;if(s===Pn)return 5125;if(s===xn)return 5126;if(s===qi)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Oc)return 6406;if(s===Ut)return 6408;if(s===Fc)return 6409;if(s===Bc)return 6410;if(s===Nn)return 6402;if(s===bi)return 34041;if(s===Pr)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===zc)return 6403;if(s===kc)return 36244;if(s===Vc)return 33319;if(s===Hc)return 33320;if(s===Gc)return 36249;if(s===Ws||s===Xs||s===js||s===qs)if(r===ke)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ws)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Xs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===js)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===qs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ws)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Xs)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===js)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===qs)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===ha||s===da||s===fa||s===pa)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===ha)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===da)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===fa)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pa)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Wc)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ma||s===ga)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ma)return r===ke?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===ga)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===_a||s===xa||s===va||s===Ma||s===ya||s===Sa||s===ba||s===wa||s===Ta||s===Aa||s===Ea||s===Ca||s===La||s===Ra)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===_a)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===xa)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===va)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ma)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ya)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Sa)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===ba)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===wa)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Ta)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Aa)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ea)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Ca)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===La)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;
vendor: 6,487 bytes, line 3416
3416if(s===Ra)return r===ke?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Ys)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Ys)return r===ke?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===Xc||s===Pa||s===Ia||s===Da)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Ys)return a.COMPRESSED_RED_RGTC1_EXT;if(s===Pa)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ia)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Da)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===gi?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):o[s]!==void 0?o[s]:null}return{convert:i}}class cm extends Mt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Dn extends Ke{constructor(){super(),this.isGroup=!0,this.type="Group"}}const um={type:"move"};class _r{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Dn,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 Dn,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 Dn,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,s=null,r=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){r=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),f=this._getHandJoint(c,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=m.radius),f.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(um)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=r!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Dn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class hm extends ct{constructor(e,t,n,i,s,r,a,l,c,u){if(u=u!==void 0?u:Nn,u!==Nn&&u!==bi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Nn&&(n=Pn),n===void 0&&u===bi&&(n=gi),super(null,i,s,r,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:ot,this.minFilter=l!==void 0?l:ot,this.flipY=!1,this.generateMipmaps=!1}}class dm extends yn{constructor(e,t){super();const n=this;let i=null,s=1,r=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,g=null;const _=t.getContextAttributes();let m=null,f=null;const w=[],S=[],x=new Set,b=new Map,C=new Mt;C.layers.enable(1),C.viewport=new We;const P=new Mt;P.layers.enable(2),P.viewport=new We;const N=[C,P],M=new cm;M.layers.enable(1),M.layers.enable(2);let A=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let Y=w[V];return Y===void 0&&(Y=new _r,w[V]=Y),Y.getTargetRaySpace()},this.getControllerGrip=function(V){let Y=w[V];return Y===void 0&&(Y=new _r,w[V]=Y),Y.getGripSpace()},this.getHand=function(V){let Y=w[V];return Y===void 0&&(Y=new _r,w[V]=Y),Y.getHandSpace()};function X(V){const Y=S.indexOf(V.inputSource);if(Y===-1)return;const ae=w[Y];ae!==void 0&&ae.dispatchEvent({type:V.type,data:V.inputSource})}function I(){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",I),i.removeEventListener("inputsourceschange",O);for(let V=0;V<w.length;V++){const Y=S[V];Y!==null&&(S[V]=null,w[V].disconnect(Y))}A=null,K=null,e.setRenderTarget(m),p=null,d=null,h=null,i=null,f=null,ie.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){a=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||r},this.setReferenceSpace=function(V){c=V},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return g}
3416,this.getSession=function(){return i},this.setSession=async function(V){if(i=V,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",I),i.addEventListener("inputsourceschange",O),_.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const Y={antialias:i.renderState.layers===void 0?_.antialias:!0,alpha:_.alpha,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(i,t,Y),i.updateRenderState({baseLayer:p}),f=new zn(p.framebufferWidth,p.framebufferHeight,{format:Ut,type:Fn,encoding:e.outputEncoding,stencilBuffer:_.stencil})}else{let Y=null,ae=null,ce=null;_.depth&&(ce=_.stencil?35056:33190,Y=_.stencil?bi:Nn,ae=_.stencil?gi:Pn);const B={colorFormat:32856,depthFormat:ce,scaleFactor:s};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(B),i.updateRenderState({layers:[d]}),f=new zn(d.textureWidth,d.textureHeight,{format:Ut,type:Fn,depthTexture:new hm(d.textureWidth,d.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,Y),stencilBuffer:_.stencil,encoding:e.outputEncoding,samples:_.antialias?4:0});const Se=e.properties.get(f);Se.__ignoreDepthValues=d.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(l),c=null,r=await i.requestReferenceSpace(a),ie.setContext(i),ie.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function O(V){for(let Y=0;Y<V.removed.length;Y++){const ae=V.removed[Y],ce=S.indexOf(ae);ce>=0&&(S[ce]=null,w[ce].disconnect(ae))}for(let Y=0;Y<V.added.length;Y++){const ae=V.added[Y];let ce=S.indexOf(ae);if(ce===-1){for(let Se=0;Se<w.length;Se++)if(Se>=S.length){S.push(ae),ce=Se;break}else if(S[Se]===null){S[Se]=ae,ce=Se;break}if(ce===-1)break}const B=w[ce];B&&B.connect(ae)}}const z=new L,$=new L;function J(V,Y,ae){z.setFromMatrixPosition(Y.matrixWorld),$.setFromMatrixPosition(ae.matrixWorld);const ce=z.distanceTo($),B=Y.projectionMatrix.elements,Se=ae.projectionMatrix.elements,ve=B[14]/(B[10]-1),se=B[14]/(B[10]+1),xe=(B[9]+1)/B[5],ze=(B[9]-1)/B[5],me=(B[8]-1)/B[0],Ee=(Se[8]+1)/Se[0],Ze=ve*me,qe=ve*Ee,et=ce/(-me+Ee),$e=et*-me;Y.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX($e),V.translateZ(et),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const Be=ve+et,Xe=se+et,ht=Ze-$e,T=qe+(ce-$e),v=xe*se/Xe*Be,k=ze*se/Xe*Be;V.projectionMatrix.makePerspective(ht,T,v,k,Be,Xe),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function q(V,Y){Y===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(Y.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;M.near=P.near=C.near=V.near,M.far=P.far=C.far=V.far,(A!==M.near||K!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),A=M.near,K=M.far);const Y=V.parent,ae=M.cameras;q(M,Y);for(let ce=0;ce<ae.length;ce++)q(ae[ce],Y);ae.length===2?J(M,C,P):M.projectionMatrix.copy(C.projectionMatrix),ne(V,M,Y)};function ne(V,Y,ae){ae===null?V.matrix.copy(Y.matrixWorld):(V.matrix.copy(ae.matrixWorld),V.matrix.invert(),V.matrix.multiply(Y.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0);const ce=V.children;for(let B=0,Se=ce.length;B<Se;B++)ce[B].updateMatrixWorld(!0);V.projectionMatrix.copy(Y.projectionMatrix),V.projectionMatrixInverse.copy(Y.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=Ti*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(V){l=V,d!==null&&(d.fixedFoveation=V),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=V)},this.getPlanes=function(){return x};let ee=null;function Me(V,Y){if(u=Y.getViewerPose(c||r),g=Y,u!==null){const ae=u.views;p!==null&&(e.setRenderTargetFramebuffer(f,p.framebuffer),e.setRenderTarget(f));let ce=!1;ae.length!==M.cameras.length&&(M.cameras.length=0,ce=!0);for(let B=0;B<ae.length;B++){const Se=ae[B];let ve=null;if(p!==null)ve=p.getViewport(Se);else{const xe=h.getViewSubImage(d,Se);ve=xe.viewport,B===0&&(e.setRenderTargetTextures(f,xe.colorTexture,d.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(f))}let se=N[B];se===void 0&&(se=new Mt,se.layers.enable(B),se.viewport=new We,N[B]=se),se.matrix.fromArray(Se.transform.matrix),se.matrix.decompose(se.position,se.quaternion,se.scale),se.projectionMatrix.fromArray(Se.projectionMatrix),se.projectionMatrixInverse.copy(se.projectionMatrix).invert(),se.viewport.set(ve.x,ve.y,ve.width,ve.height),B===0&&(M.matrix.copy(se.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ce===!0&&M.cameras.push(se)}}for(let ae=0;ae<w.length;ae++){const ce=S[ae],B=w[ae];ce!==null&&B!==void 0&&B.update(ce,Y,c||r)}if(ee&&ee(V,Y),Y.detectedPlanes){n.dispatchEvent({type:"planesdetected",data:Y.detectedPlanes});let ae=null;for(const ce of x)Y.detectedPlanes.has(ce)||(ae===null&&(ae=[]),ae.push(ce));if(ae!==null)for(const ce of ae)x.delete(ce),b.delete(ce),n.dispatchEvent({type:"planeremoved",data:ce});for(const ce of Y.detectedPlanes)if(!x.has(ce))x.add(ce),b.set(ce,Y.lastChangedTime),n.dispatchEvent({type:"planeadded",data:ce});else{const B=b.get(ce);ce.lastChangedTime>B&&(b.set(ce,ce.lastChangedTime),n.dispatchEvent({type:"planechanged",data:ce}))}}g=null}const ie=new xl;ie.setAnimationLoop(Me),this.setAnimationLoop=function(V){ee=V},this.dispose=function(){}}}function fm(o,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,ml(o)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,w,S,x){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),h(m,f)):f.isMeshPhongMaterial?(s(m,f),u(m,f)):f.isMeshStandardMaterial?(s(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,x)):f.isMeshMat
vendor: 4,116 bytes, line 3416
3416capMaterial?(s(m,f),g(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),_(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(r(m,f),f.isLineDashedMaterial&&a(m,f)):f.isPointsMaterial?l(m,f,w,S):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(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===bt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===bt&&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 w=e.get(f).envMap;if(w&&(m.envMap.value=w,m.flipEnvMap.value=w.isCubeTexture&&w.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 S=o.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*S,t(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function r(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 a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,w,S){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*w,m.scale.value=S*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(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),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function u(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(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,w){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===bt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.
3416iridescenceThicknessMinimum.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=w.texture,m.transmissionSamplerSize.value.set(w.width,w.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)),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 w=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(w.matrixWorld),m.nearDistance.value=w.shadow.camera.near,m.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function pm(o,e,t,n){let i={},s={},r=[];const a=t.isWebGL2?o.getParameter(35375):0;function l(w,S){const x=S.program;n.uniformBlockBinding(w,x)}function c(w,S){let x=i[w.id];x===void 0&&(g(w),x=u(w),i[w.id]=x,w.addEventListener("dispose",m));const b=S.program;n.updateUBOMapping(w,b);const C=e.render.frame;s[w.id]!==C&&(d(w),s[w.id]=C)}function u(w){const S=h();w.__bindingPointIndex=S;const x=o.createBuffer(),b=w.__size,C=w.usage;return o.bindBuffer(35345,x),o.bufferData(35345,b,C),o.bindBuffer(35345,null),o.bindBufferBase(35345,S,x),x}function h(){for(let w=0;w<a;w++)if(r.indexOf(w)===-1)return r.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(w){const S=i[w.id],x=w.uniforms,b=w.__cache;o.bindBuffer(35345,S);for(let C=0,P=x.length;C<P;C++){const N=x[C];if(p(N,C,b)===!0){const M=N.__offset,A=Array.isArray(N.value)?N.value:[N.value];let K=0;for(let X=0;X<A.length;X++){const I=A[X],O=_(I);typeof I=="number"?(N.__data[0]=I,o.bufferSubData(35345,M+K,N.__data)):I.isMatrix3?(N.__data[0]=I.elements[0],N.__data[1]=I.elements[1],N.__data[2]=I.elements[2],N.__data[3]=I.elements[0],N.__data[4]=I.elements[3],N.__data[5]=I.elements[4],N.__data[6]=I.elements[5],N.__data[7]=I.elements[0],N.__data[8]=I.elements[6],N.__data[9]=I.elements[7],N.__data[10]=I.elements[8],N.__data[11]=I.elements[0]):(I.toArray(N.__data,K),K+=O.storage/Float32Array.BYTES_PER_ELEMENT)}o.bufferSubData(35345,M,N.__data)}}o.bindBuffer(35345,null)}function p(w,S,x){const b=w.value;if(x[S]===void 0){if(typeof b=="number")x[S]=b;else{const C=Array.isArray(b)?b:[b],P=[];for(let N=0;N<C.length;N++)P.push(C[N].clone());x[S]=P}return!0}else if(typeof b=="number"){if(x[S]!==b)return x[S]=b,!0}else{const C=Array.isArray(x[S])?x[S]:[x[S]],P=Array.isArray(b)?b:[b];for(let N=0;N<C.length;N++){const M=C[N];if(M.equals(P[N])===!1)return M.copy(P[N]),!0}}return!1}function g(w){const S=w.uniforms;let x=0;const b=16;let C=0;for(let P=0,N=S.length;P<N;P++){const M=S[P],A={boundary:0,storage:0},K=Array.isArray(M.value)?M.value:[M.value];for(let X=0,I=K.length;X<I;X++){const O=K[X],z=_(O);A.boundary+=z.boundary,A.storage+=z.storage}if(M.__data=new Float32Array(A.storage/Float32Array.BYTES_PER_ELEMENT),M.__offset=x,P>0){C=x%b;const X=b-C;C!==0&&X-A.boundary<0&&(x+=b-C,M.__offset=x)}x+=A.storage}return C=x%b,C>0&&(x+=b-C),w.__size=x,w.__cache={},this}function _(w){const S={boundary:0,storage:0};return typeof w=="number"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?c
3416onsole.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function m(w){const S=w.target;S.removeEventListener("dispose",m);const x=r.indexOf(S.__bindingPointIndex);r.splice(x,1),o.deleteBuffer(i[S.id]),delete i[S.id],delete s[S.id]}function f(){for(const w in i)o.deleteBuffer(i[w]);r=[],i={},s={}}return{bind:l,update:c,dispose:f}}function mm(){const o=Zi("canvas");return o.style.display="block",o}class bl{constructor(e={}){const{canvas:t=mm(),context:n=null,depth:i=!0,stencil:s=!0,alpha:r=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;n!==null?d=n.getContextAttributes().alpha:d=r;let p=null,g=null;const _=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Bn,this.useLegacyLights=!0,this.toneMapping=rn,this.toneMappingExposure=1;const f=this;let w=!1,S=0,x=0,b=null,C=-1,P=null;const N=new We,M=new We;let A=null,K=t.width,X=t.height,I=1,O=null,z=null;const $=new We(0,0,K,X),J=new We(0,0,K,X);let q=!1;const ne=new Wr;let ee=!1,Me=!1,ie=null;const V=new De,Y=new L,ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ce(){return b===null?I:1}let B=n;function Se(y,U){for(let H=0;H<y.length;H++){const D=y[H],W=t.getContext(D,U);if(W!==null)return W}return null}try{const y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${kr}`),t.addEventListener("webglcontextlost",fe,!1),t.addEventListener("webglcontextrestored",be,!1),t.addEventListener("webglcontextcreationerror",Re,!1),B===null){const U=["webgl2","webgl","experimental-webgl"];if(f.isWebGL1Renderer===!0&&U.shift(),B=Se(U,y),B===null)throw Se(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}B.getShaderPrecisionFormat===void 0&&(B.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let ve,se,xe,ze,me,Ee,Ze,qe,et,$e,Be,Xe,ht,T,v,k,Z,te,oe,E,j,F,le,de;function pe(){ve=new Af(B),se=new Mf(B,ve,e),ve.init(se),F=new lm(B,ve,se),xe=new am(B,ve,se),ze=new Lf,me=new jp,Ee=new om(B,ve,xe,me,se,F,ze),Ze=new Sf(f),qe=new Tf(f),et=new ku(B,se),le=new xf(B,ve,et,se),$e=new Ef(B,et,ze,le),Be=new Df(B,$e,et,ze),oe=new If(B,se,Ee),k=new yf(me),Xe=new Xp(f,Ze,qe,ve,se,le,k),ht=new fm(f,me),T=new Yp,v=new em(ve,se),te=new _f(f,Ze,qe,xe,Be,d,l),Z=new rm(f,Be,se),de=new pm(B,ze,se,xe),E=new vf(B,ve,ze,se),j=new Cf(B,ve,ze,se),ze.programs=Xe.programs,f.capabilities=se,f.extensions=ve,f.properties=me,f.renderLists=T,f.shadowMap=Z,f.state=xe,f.info=ze}pe();const ue=new dm(f,B);this.xr=ue,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const y=ve.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=ve.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(y){y!==void 0&&(I=y,this.setSize(K,X,!1))},this.getSize=function(y){return y.set(K,X)},this.setSize=function(y,U,H=!0){if(ue.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=y,X=U,t.width=Math.floor(y*I),t.height=Math.floor(U*I),H===!0&&(t.style.width=y+"px",t.style.height=U+"px"),this.setViewport(0,0,y,U)},this.getDrawingBufferSize=function(y){return y.set(K*I,X*I).floor()},this.setDrawingBufferSize=function(y,U,H){K=y,X=U,I=H,t.width=Math.floor(y*H),t.height=Math.floor(U*H),this.setViewport(0,0,y,U)},this.getCurrentViewport=function(y){return y.copy(N)},this.getViewport=function(y){return y.copy($)},this.setViewport=function(y,U,H,D){y.isVector4?$.set(y.x,y.y,y.z,y.w):$.set(y,U,H,D),xe.viewport(N.copy($).multiplyScalar(I).floor())}
vendor: 1,146 bytes, line 3416
3416,this.getScissor=function(y){return y.copy(J)},this.setScissor=function(y,U,H,D){y.isVector4?J.set(y.x,y.y,y.z,y.w):J.set(y,U,H,D),xe.scissor(M.copy(J).multiplyScalar(I).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(y){xe.setScissorTest(q=y)},this.setOpaqueSort=function(y){O=y},this.setTransparentSort=function(y){z=y},this.getClearColor=function(y){return y.copy(te.getClearColor())},this.setClearColor=function(){te.setClearColor.apply(te,arguments)},this.getClearAlpha=function(){return te.getClearAlpha()},this.setClearAlpha=function(){te.setClearAlpha.apply(te,arguments)},this.clear=function(y=!0,U=!0,H=!0){let D=0;y&&(D|=16384),U&&(D|=256),H&&(D|=1024),B.clear(D)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",fe,!1),t.removeEventListener("webglcontextrestored",be,!1),t.removeEventListener("webglcontextcreationerror",Re,!1),T.dispose(),v.dispose(),me.dispose(),Ze.dispose(),qe.dispose(),Be.dispose(),le.dispose(),de.dispose(),Xe.dis
3416pose(),ue.dispose(),ue.removeEventListener("sessionstart",ge),ue.removeEventListener("sessionend",je),ie&&(ie.dispose(),ie=null),Ye.stop()};function fe(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function be(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const y=ze.autoReset,U=Z.enabled,H=Z.autoUpdate,D=Z.needsUpdate,W=Z.type;pe(),ze.autoReset=y,Z.enabled=U,Z.autoUpdate=H,Z.needsUpdate=D,Z.type=W}function Re(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function Je(y){const U=y.target;U.removeEventListener("dispose",Je),R(U)}function R(y){G(y),me.remove(y)}function G(y){const U=me.get(y).programs;U!==void 0&&(U.forEach(function(H){Xe.releaseProgram(H)}),y.isShaderMaterial&&Xe.releaseShaderCache(y))}this.renderBufferDirect=function(y,U,H,D,W,_e){U===null&&(U=ae);const ye=W.isMesh&&W.matrixWorld.determinant()<0,we=Wl(y,U,H,D,W);xe.setMaterial(D,ye);let Ce=H.index,Pe=1;D.wireframe===!0&&(Ce=$e.getWireframeAttribute(H),Pe=2);const Ie=H.drawRange,Ne=H.attributes.position;let He=Ie.start*Pe,gt=(Ie.start+Ie.count)*Pe;_e!==null&&(He=Math.max(He,_e.start*Pe),gt=Math.min(gt,(_e.start+_e.count)*Pe)),Ce!==null?(He=Math.max(He,0),gt=Math.min(gt,Ce.count)):Ne!=null&&(He=Math.max(He,0),gt=Math.min(gt,Ne.count));const Ot=gt-He;if(Ot<0||Ot===1/0)return;le.setup(W,D,we,H,Ce);let Sn,tt=E;if(Ce!==null&&(Sn=et.get(Ce),tt=j,tt.setIndex(Sn)),W.isMesh)D.wireframe===!0?(xe.setLineWidth(D.wireframeLinewidth*ce()),tt.setMode(1)):tt.setMode(4);else if(W.isLine){let Oe=D.linewidth;Oe===void 0&&(Oe=1),xe.setLineWidth(Oe*ce()),W.isLineSegments?tt.setMode(1):W.isLineLoop?tt.setMode(2):tt.setMode(3)}else W.isPoints?tt.setMode(0):W.isSprite&&tt.setMode(4);if(W.isInstancedMesh)tt.renderInstances(He,Ot,W.count);else if(H.isInstancedBufferGeometry){const Oe=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,ks=Math.min(H.instanceCount,Oe);tt.renderInstances(He,Ot,ks)}else tt.render(He,Ot)},this.compile=function(y,U){function H(D,W,_e){D.transparent===!0&&D.side===jt&&D.forceSinglePass===!1?(D.side=bt,D.needsUpdate=!0,ts(D,W,_e),D.side=an,D.needsUpdate=!0,ts(D,W,_e),D.side=jt):ts(D,W,_e)}g=v.get(y),g.init(),m.push(g),y.traverseVisible(function(D){D.isLight&&D.layers.test(U.layers)&&(g.pushLight(D),D.castShadow&&g.pushShadow(D))}),g.setupLights(f.useLegacyLights),y.traverse(function(D){const W=D.material;if(W)if(Array.isArray(W))for(let _e=0;_e<W.length;_e++){const ye=W[_e];H(ye,y,D)}else H(W,y,D)}),m.pop(),g=null};let Q=null;function he(y){Q&&Q(y)}function ge(){Ye.stop()}function je(){Ye.start()}const Ye=new xl;Ye.setAnimationLoop(he),typeof self<"u"&&Ye.setContext(self),this.setAnimationLoop=function(y){Q=y,ue.setAnimationLoop(y),y===null?Ye.stop():Ye.start()},ue.addEventListener("sessionstart",ge),ue.addEventListener("sessionend",je),this.render=function(y,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(U),U=ue.getCamera()),y.isScene===!0&&y.onBeforeRender(f,y,U,b),g=v.get(y,m.length),g.init(),m.push(g),V.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),ne.setFromProjectionMatrix(V),Me=this.localClippingEnabled,ee=k.init(this.clippingPlanes,Me),p=T.get(y,_.length),p.init(),_.push(p),dt(y,U,0,f.sortObjects),p.finish(),f.sortObjects===!0&&p.sort(O,z),ee===!0&&k.beginShadows();const H=g.state.shadowsArray;if(Z.render(H,y,U),ee===!0&&k.endShadows(),this.info.autoReset===!0&&this.info.reset(),te.render(p,y),g.setupLights(f.useLegacyLights),U.isArrayCamera){const D=U.cameras;for(let W=0,_e=D.length;W<_e;W++){const ye=D[W];cn(p,y,ye,ye.viewport)}}else cn(p,y,U);b!==null&&(Ee.updateMultisampleRenderTarget(b),Ee.updateRenderTargetMipmap(b)),y.isScene===!0&&y.onAfterRender(f,y,U),le.resetDefaultState(),C=-1,P=null,m.pop(),m.length>0?g=m[m.length-1]:g=null,_.pop(),_.length>0?p=_[_.length-1]:p=null};function dt(y,U,H,D){if(y.visible===!1)return;if(y.layers.test(U.layers)){if(y.isGroup)H=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(U);else if(y.isLight)g.pushLight(y),y.castShadow&&g.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||ne.intersectsSprite(y)){D&&Y.setFromMatrixPosition(y.matrixWorld).applyMatrix4(V);const ye=Be.update(y),we=y.material;we.visible&&p.push(y,ye,we,H,Y.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(y.isSkinnedMesh&&y.skeleton.frame!==ze.render.frame&&(y.skeleton.update(),y.skeleton.frame=ze.render.frame),!y.frustumCulled||ne.intersectsObject(y))){D&&Y.setFromMatrixPosition(y.matrixWorld).applyMatrix4(V);const ye=Be.update(y),we=y.material;if(Array.isArray(we)){const Ce=ye.groups;for(let Pe=0,Ie=Ce.length;Pe<Ie;Pe++){const Ne=Ce[Pe],He=we[Ne.materialIndex];He&&He.visible&&p.push(y,ye,He,H,Y.z,Ne)}}else we.visible&&p.push(y,ye,we,H,Y.z,null)}}const _e=y.children;for(let ye=0,we=_e.length;ye<we;ye++)dt(_e[ye],U,H,D)}function cn(y,U,H,D){const W=y.opaque,_e=y.transmissive,ye=y.transparent;g.setupLightsView(H),ee===!0&&k.setGlobalState(f.clippingPlanes,H),_e.length>0&&Qe(W,_e,U,H),D&&xe.viewport(N.copy(D)),W.length>0&&Pt(W,U,H),_e.length>0&&Pt(_e,U,H),ye.length>0&&Pt(ye,U,H),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function Qe(y,U,H,D){if(ie===null){const we=se.isWebGL2;ie=new zn(1024,1024,{generateMipmaps:!0,type:ve.has("EXT_color_buffer_half_float")?qi:Fn,minFilter:On,samples:we&&a===!0?4:0})}const W=f.getRenderTarget();f.setRenderTarget(ie),f.clear();const _e=f.toneMapping;f.toneMapping=rn,Pt(y,H,D),Ee.updateMultisampleRenderTarget(ie),Ee.updateRenderTargetMipmap(ie);let ye=!1;for(let we=0,Ce=U.length;we<Ce;we++){const Pe=U[we],Ie=Pe.object,Ne=Pe.geometry,He=Pe.material,gt=Pe.group;if(He.side===jt&&Ie.layers.test(D.layers)){const Ot=He.side;He.side=bt,He.needsUpdate=!0,Ht(Ie,H,D,Ne,He,gt),He.side=Ot,He.needsUpdate=!0,ye=!0}}ye===!0&&(Ee.updateMultisampleRenderTarget(ie),Ee.updateRenderTargetMipmap(ie)),f.setRenderTarget(W),f.toneMapping=_e}function Pt(y,U,H){const D=U.isScene===!0?U.overrideMaterial:null;for(let W=0,_e=y.length;W<_e;W++){const ye=y[W],we=ye.object,Ce=ye.geometry,Pe=D===null?ye.material:D,Ie=ye.group;we.layers.test(H.layers)&&Ht(we,U,H,Ce,Pe,Ie)}}function Ht(y,U,H,D,W,_e){y.onBeforeRender(f,U,H,D,W,_e),y.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),W.onBeforeRender(f,U,H,D,y,_e),W.transparent===!0&&W.side===jt&&W.forceSinglePass===!1?(W.side=bt,W.needsUpdate=!0,f.renderBufferDirect(H,U,D,W,y,_e),W.side=an,W.needsUpdate=!0,f.renderBufferDirect(H,U,D,W,y,_e),W.side=jt):f.renderBufferDirect(H,U,D,W,y,_e),y.onAfterRender(f,U,H,D,W,_e)}function ts(y,U,H){U.isScene!==!0&&(U=ae);const D=me.get(y),W=g.state.lights,_e=g.state.shadowsArray,ye=W.state.ver
vendor: 10,670 bytes, line 3416
3416sion,we=Xe.getParameters(y,W.state,_e,U,H),Ce=Xe.getProgramCacheKey(we);let Pe=D.programs;D.environment=y.isMeshStandardMaterial?U.environment:null,D.fog=U.fog,D.envMap=(y.isMeshStandardMaterial?qe:Ze).get(y.envMap||D.environment),Pe===void 0&&(y.addEventListener("dispose",Je),Pe=new Map,D.programs=Pe);let Ie=Pe.get(Ce);if(Ie!==void 0){if(D.currentProgram===Ie&&D.lightsStateVersion===ye)return na(y,we),Ie}else we.uniforms=Xe.getUniforms(y),y.onBuild(H,we,f),y.onBeforeCompile(we,f),Ie=Xe.acquireProgram(we,Ce),Pe.set(Ce,Ie),D.uniforms=we.uniforms;const Ne=D.uniforms;(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ne.clippingPlanes=k.uniform),na(y,we),D.needsLights=jl(y),D.lightsStateVersion=ye,D.needsLights&&(Ne.ambientLightColor.value=W.state.ambient,Ne.lightProbe.value=W.state.probe,Ne.directionalLights.value=W.state.directional,Ne.directionalLightShadows.value=W.state.directionalShadow,Ne.spotLights.value=W.state.spot,Ne.spotLightShadows.value=W.state.spotShadow,Ne.rectAreaLights.value=W.state.rectArea,Ne.ltc_1.value=W.state.rectAreaLTC1,Ne.ltc_2.value=W.state.rectAreaLTC2,Ne.pointLights.value=W.state.point,Ne.pointLightShadows.value=W.state.pointShadow,Ne.hemisphereLights.value=W.state.hemi,Ne.directionalShadowMap.value=W.state.directionalShadowMap,Ne.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Ne.spotShadowMap.value=W.state.spotShadowMap,Ne.spotLightMatrix.value=W.state.spotLightMatrix,Ne.spotLightMap.value=W.state.spotLightMap,Ne.pointShadowMap.value=W.state.pointShadowMap,Ne.pointShadowMatrix.value=W.state.pointShadowMatrix);const He=Ie.getUniforms(),gt=Ls.seqWithValue(He.seq,Ne);return D.currentProgram=Ie,D.uniformsList=gt,Ie}function na(y,U){const H=me.get(y);H.outputEncoding=U.outputEncoding,H.instancing=U.instancing,H.skinning=U.skinning,H.morphTargets=U.morphTargets,H.morphNormals=U.morphNormals,H.morphColors=U.morphColors,H.morphTargetsCount=U.morphTargetsCount,H.numClippingPlanes=U.numClippingPlanes,H.numIntersection=U.numClipIntersection,H.vertexAlphas=U.vertexAlphas,H.vertexTangents=U.vertexTangents,H.toneMapping=U.toneMapping}function Wl(y,U,H,D,W){U.isScene!==!0&&(U=ae),Ee.resetTextureUnits();const _e=U.fog,ye=D.isMeshStandardMaterial?U.environment:null,we=b===null?f.outputEncoding:b.isXRRenderTarget===!0?b.texture.encoding:Bn,Ce=(D.isMeshStandardMaterial?qe:Ze).get(D.envMap||ye),Pe=D.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Ie=!!D.normalMap&&!!H.attributes.tangent,Ne=!!H.morphAttributes.position,He=!!H.morphAttributes.normal,gt=!!H.morphAttributes.color,Ot=D.toneMapped?f.toneMapping:rn,Sn=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,tt=Sn!==void 0?Sn.length:0,Oe=me.get(D),ks=g.state.lights;if(ee===!0&&(Me===!0||y!==P)){const Tt=y===P&&D.id===C;k.setState(D,y,Tt)}let rt=!1;D.version===Oe.__version?(Oe.needsLights&&Oe.lightsStateVersion!==ks.state.version||Oe.outputEncoding!==we||W.isInstancedMesh&&Oe.instancing===!1||!W.isInstancedMesh&&Oe.instancing===!0||W.isSkinnedMesh&&Oe.skinning===!1||!W.isSkinnedMesh&&Oe.skinning===!0||Oe.envMap!==Ce||D.fog===!0&&Oe.fog!==_e||Oe.numClippingPlanes!==void 0&&(Oe.numClippingPlanes!==k.numPlanes||Oe.numIntersection!==k.numIntersection)||Oe.vertexAlphas!==Pe||Oe.vertexTangents!==Ie||Oe.morphTargets!==Ne||Oe.morphNormals!==He||Oe.morphColors!==gt||Oe.toneMapping!==Ot||se.isWebGL2===!0&&Oe.morphTargetsCount!==tt)&&(rt=!0):(rt=!0,Oe.__version=D.version);let bn=Oe.currentProgram;rt===!0&&(bn=ts(D,U,W));let ia=!1,Di=!1,Vs=!1;const _t=bn.getUniforms(),wn=Oe.uniforms;if(xe.useProgram(bn.program)&&(ia=!0,Di=!0,Vs=!0),D.id!==C&&(C=D.id,Di=!0),ia||P!==y){if(_t.setValue(B,"projectionMatrix",y.projectionMatrix),se.logarithmicDepthBuffer&&_t.setValue(B,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),P!==y&&(P=y,Di=!0,Vs=!0),D.isShaderMaterial||D.isMeshPhongMaterial||D.isMeshToonMaterial||D.isMeshStandardMaterial||D.envMap){const Tt=_t.map.cameraPosition;Tt!==void 0&&Tt.setValue(B,Y.setFromMatrixPosition(y.matrixWorld))}(D.isMeshPhongMaterial||D.isMeshToonMaterial||D.isMeshLambertMaterial||D.isMeshBasicMaterial||D.isMeshStandardMaterial||D.isShaderMaterial)&&_t.setValue(B,"isOrthographic",y.isOrthographicCamera===!0),(D.isMeshPhongMaterial||D.isMeshToonMaterial||D.isMeshLambertMaterial||D.isMeshBasicMaterial||D.isMeshStandardMaterial||D.isShaderMaterial||D.isShadowMaterial||W.isSkinnedMesh)&&_t.setValue(B,"viewMatrix",y.matrixWorldInverse)}if(W.isSkinnedMesh){_t.setOptional(B,W,"bindMatrix"),_t.setOptional(B,W,"bindMatrixInverse");const Tt=W.skeleton;Tt&&(se.floatVertexTextures?(Tt.boneTexture===null&&Tt.computeBoneTexture(),_t.setValue(B,"boneTexture",Tt.boneTexture,Ee),_t.setValue(B,"boneTextureSize",Tt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Hs=H.morphAttributes;if((Hs.position!==void 0||Hs.normal!==void 0||Hs.color!==void 0&&se.isWebGL2===!0)&&oe.update(W,H,bn),(Di||Oe.receiveShadow!==W.receiveShadow)&&(Oe.receiveShadow=W.receiveShadow,_t.setValue(B,"receiveShadow",W.receiveShadow)),D.isMeshGouraudMaterial&&D.envMap!==null&&(wn.envMap.value=Ce,wn.flipEnvMap.value=Ce.isCubeTexture&&Ce.isRenderTargetTexture===!1?-1:1),Di&&(_t.setValue(B,"toneMappingExposure",f.toneMappingExposure),Oe.needsLights&&Xl(wn,Vs),_e&&D.fog===!0&&ht.refreshFogUniforms(wn,_e),ht.refreshMaterialUniforms(wn,D,I,X,ie),Ls.upload(B,Oe.uniformsList,wn,Ee)),D.isShaderMaterial&&D.uniformsNeedUpdate===!0&&(Ls.upload(B,Oe.uniformsList,wn,Ee),D.uniformsNeedUpdate=!1),D.isSpriteMaterial&&_t.setValue(B,"center",W.center),_t.setValue(B,"modelViewMatrix",W.modelViewMatrix),_t.setValue(B,"normalMatrix",W.normalMatrix),_t.setValue(B,"modelMatrix",W.matrixWorld),D.isShaderMaterial||D.isRawShaderMaterial){const Tt=D.uniformsGroups;for(let Gs=0,ql=Tt.length;Gs<ql;Gs++)if(se.isWebGL2){const sa=Tt[Gs];de.update(sa,bn),de.bind(sa,bn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return bn}function Xl(y,U){y.ambientLightColor.needsUpdate=U,y.lightProbe.needsUpdate=U,y.directionalLights.needsUpdate=U,y.directionalLightShadows.needsUpdate=U,y.pointLights.needsUpdate=U,y.pointLightShadows.needsUpdate=U,y.spotLights.needsUpdate=U,y.spotLightShadows.needsUpdate=U,y.rectAreaLights.needsUpdate=U,y.hemisphereLights.needsUpdate=U}function jl(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(y,U,H){me.get(y.texture).__webglTexture=U,me.get(y.depthTexture).__webglTexture=H;const D=me.get(y);D.__hasExternalTextures=!0,D.__hasExternalTextures&&(D.__autoAllocateDepthBuffer=H===void 0,D.__autoAllocateDepthBuffer||ve.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),D.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(y,U){const H=me.get(y);H.__webglFramebuffer=U,H.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(y,U=0,H=0){b=y,S=U,x=H;let D=!0,W=null,_e=!1,ye=!1;if(y){const Ce=me.get(y);Ce.__useDefaultFramebuffer!==void 0?(xe.bindFramebuffer(36160,null),D=!1):Ce.__webglFramebuffer===void 0?Ee.setupRenderTarget(y):Ce.__hasExternalTextures&&Ee.rebindTextures(y,me.get(y.texture).__webglTexture,me.get(y.depthTexture).__webglTexture);const Pe=y.texture;(Pe.isData3DTexture||Pe.isDataArrayTexture||Pe.isCompressedArrayTexture)&&(ye=!0);const Ie=me.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(W=Ie[U],_e=!0):se.isWebGL2&&y.samples>0&&Ee.useMultisampledRTT(y)===!1?W=me.get(y).__webglMultisampledFramebuffer:W=Ie,N.copy(y.viewport),M.copy(y.scissor),A=y.scissorTest}else N.copy($).multiplyScalar(I).floor(),M.copy(J).multiplyScalar(I).floor(),A=q;if(xe.bindFramebuffer(36160,W)&&se.drawBuffers&&D&&xe.drawBuffers(y,W),xe.viewport(N),xe.scissor(M),xe.setScissorTest(A),_e){const Ce=me.get(y.texture);B.framebufferTexture2D(36160,36064,34069+U,Ce.__webglTexture,H)}else if(ye){const Ce=me.get(y.texture),Pe=U||0;B.framebufferTextureLayer(36160,36064,Ce.__webglTexture,H||0,Pe)}C=-1},this.readRenderTargetPixels=function(y,U,H,D,W,_e,ye){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=me.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&ye!==void 0&&(we=we[ye]),we){xe.bindFramebuffer(36160,we);try{const Ce=y.texture,Pe=Ce.format,Ie=Ce.type;if(Pe!==Ut&&F.convert(Pe)!==B.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ne=Ie===qi&&(ve.has("EXT_color_buffer_half_float")||se.isWebGL2&&ve.has("EXT_color_buffer_float"));if(Ie!==Fn&&F.convert(Ie)!==B.getParameter(35738)&&!(Ie===xn&&(se.isWebGL2||ve.has("OES_texture_float")||ve.has("WEBGL_color_buffer_float")))&&!Ne){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=y.width-D&&H>=0&&H<=y.height-W&&B.readPixels(U,H,D,W,F.convert(Pe),F.convert(Ie),_e)}finally{const Ce=b!==null?me.get(b).__webglFramebuffer:null;xe.bindFramebuffer(36160,Ce)}}},this.copyFramebufferToTexture=function(y,U,H=0){const D=Math.pow(2,-H),W=Math.floor(U.image.width*D),_e=Math.floor(U.image.height*D);Ee.setTexture2D(U,0),B.copyTexSubImage2D(3553,H,0,0,y.x,y.y,W,_e),xe.unbindTexture()},this.copyTextureToTexture=function(y,U,H,D=0){const W=U.image.width,_e=U.image.height,ye=F.convert(H.format),we=F.convert(H.type);Ee.setTexture2D(H,0),B.pixelStorei(37440,H.flipY),B.pixelStorei(37441,H.premultiplyAlpha),B.pixelStorei(3317,H.unpackAlignment),U.isDataTexture?B.texSubImage2D(3553,D,y.x,y.y,W,_e,ye,we,U.image.data):U.isCompressedTexture?B.compressedTexSubImage2D(3553,D,y.x,y.y,U.mipmaps[0].width,U.mipmaps[0].height,ye,U.mipmaps[0].data):B.texSubImage2D(3553,D,y.x,y.y,ye,we,U.image),D===0&&H.generateMipmaps&&B.generateMipmap(3553),xe.unbindTexture()},this.copyTextureToTexture3D=function(y,U,H,D,W=0){if(f.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const _e=y.max.x-y.min.x+1,ye=y.max.y-y.min.y+1,we=y.max.z-y.min.z+1,Ce=F.convert(D.format),Pe=F.convert(D.type);let Ie;if(D.isData3DTexture)Ee.setTexture3D(D,0),Ie=32879;
vendor: 74,704 bytes, line 3416
3416else if(D.isDataArrayTexture)Ee.setTexture2DArray(D,0),Ie=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}B.pixelStorei(37440,D.flipY),B.pixelStorei(37441,D.premultiplyAlpha),B.pixelStorei(3317,D.unpackAlignment);const Ne=B.getParameter(3314),He=B.getParameter(32878),gt=B.getParameter(3316),Ot=B.getParameter(3315),Sn=B.getParameter(32877),tt=H.isCompressedTexture?H.mipmaps[0]:H.image;B.pixelStorei(3314,tt.width),B.pixelStorei(32878,tt.height),B.pixelStorei(3316,y.min.x),B.pixelStorei(3315,y.min.y),B.pixelStorei(32877,y.min.z),H.isDataTexture||H.isData3DTexture?B.texSubImage3D(Ie,W,U.x,U.y,U.z,_e,ye,we,Ce,Pe,tt.data):H.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),B.compressedTexSubImage3D(Ie,W,U.x,U.y,U.z,_e,ye,we,Ce,tt.data)):B.texSubImage3D(Ie,W,U.x,U.y,U.z,_e,ye,we,Ce,Pe,tt),B.pixelStorei(3314,Ne),B.pixelStorei(32878,He),B.pixelStorei(3316,gt),B.pixelStorei(3315,Ot),B.pixelStorei(32877,Sn),W===0&&D.generateMipmaps&&B.generateMipmap(Ie),xe.unbindTexture()},this.initTexture=function(y){y.isCubeTexture?Ee.setTextureCube(y,0):y.isData3DTexture?Ee.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?Ee.setTexture2DArray(y,0):Ee.setTexture2D(y,0),xe.unbindTexture()},this.resetState=function(){S=0,x=0,b=null,xe.reset(),le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class gm extends bl{}gm.prototype.isWebGL1Renderer=!0;class _m extends Ke{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class xm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Rr,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Vt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=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 xt=new L;class Yr{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++)xt.fromBufferAttribute(this,t),xt.applyMatrix4(e),this.setXYZ(t,xt.x,xt.y,xt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)xt.fromBufferAttribute(this,t),xt.applyNormalMatrix(e),this.setXYZ(t,xt.x,xt.y,xt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)xt.fromBufferAttribute(this,t),xt.transformDirection(e),this.setXYZ(t,xt.x,xt.y,xt.z);return this}setX(e,t){return this.normalized&&(t=Ge(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ge(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ge(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ge(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=sn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=sn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=sn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=sn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ge(t,this.array),n=Ge(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=Ge(t,this.array),n=Ge(n,this.array),i=Ge(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,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ge(t,this.array),n=Ge(n,this.array),i=Ge(i,this.array),s=Ge(s,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]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new yt(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 Yr(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 s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const vo=new L,Mo=new We,yo=new We,vm=new L,So=new De,ci=new L;class Mm extends mt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new De,this.bindMatrixInverse=new De,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new on),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)ci.fromBufferAttribute(t,n),this.applyBoneTransform(n,ci),this.boundingBox.expandByPoint(ci)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ln),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)ci.fromBufferAttribute(t,n),this.applyBoneTransform(n,ci),this.boundingSphere.expandByPoint(ci)}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,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new We,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Mo.fromBufferAttribute(i.attributes.skinIndex,e),yo.fromBufferAttribute(i.attributes.skinWeight,e),vo.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const r=yo.getComponent(s);if(r!==0){const a=Mo.getComponent(s);So.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(vm.copy(vo).applyMatrix4(So),r)}}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 wl extends Ke{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ym extends ct{constructor(e=null,t=1,n=1,i,s,r,a,l,c=ot,u=ot,h,d){super(null,r,a,l,c,u,i,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const bo=new De,Sm=new De;class Kr{constructor(e=[],t=[]){this.uuid=Vt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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 De)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new De;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 s=0,r=e.length;s<r;s++){const a=e[s]?e[s].matrixWorld:Sm;bo.multiplyMatrices(a,t[s]),bo.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Kr(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=sl(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ym(t,e,e,Ut,xn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,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 s=e.bones[n];let r=t[s];r===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),r=new wl),this.bones.push(r),this.boneInverses.push(new De().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class wo extends yt{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 ui=new De,To=new De,Ss=[],Ao=new on,bm=new De,Bi=new mt,zi=new ln;class wm extends mt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new wo(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,bm)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new on),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ui),Ao.copy(e.boundingBox).applyMatrix4(ui),this.boundingBox.union(Ao)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ln),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ui),zi.copy(e.boundingSphere).applyMatrix4(ui),this.boundingSphere.union(zi)}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,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(Bi.geometry=this.geometry,Bi.material=this.material,Bi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),zi.copy(this.boundingSphere),zi.applyMatrix4(n),e.ray.intersectsSphere(zi)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,ui),To.multiplyMatrices(n,ui),Bi.matrixWorld=To,Bi.raycast(e,Ss);for(let r=0,a=Ss.length;r<a;r++){const l=Ss[r];l.instanceId=s,l.object=this,t.push(l)}Ss.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new wo(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 Zr extends qt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Te(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 Eo=new L,Co=new L,Lo=new De,xr=new Gr,bs=new ln;class $r extends Ke{constructor(e=new Rt,t=new Zr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Eo.fromBufferAttribute(t,i-1),Co.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Eo.distanceTo(Co);e.setAttribute("lineDistance",new ut(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,s=e.params.Line.threshold,r=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),bs.copy(n.boundingSphere),bs.applyMatrix4(i),bs.radius+=s,e.ray.intersectsSphere(bs)===!1)return;Lo.copy(i).invert(),xr.copy(e.ray).applyMatrix4(Lo);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new L,u=new L,h=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,r.start),w=Math.min(g.count,r.start+r.count);for(let S=f,x=w-1;S<x;S+=p){const b=g.getX(S),C=g.getX(S+1);if(c.fromBufferAttribute(m,b),u.fromBufferAttribute(m,C),xr.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(d);N<e.near||N>e.far||t.push({distance:N,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,r.start),w=Math.min(m.count,r.start+r.count);for(let S=f,x=w-1;S<x;S+=p){if(c.fromBufferAttribute(m,S),u.fromBufferAttribute(m,S+1),xr.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(d);C<e.near||C>e.far||t.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:S,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 s=0,r=i.length;s<r;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const Ro=new L,Po=new L;class Tl extends $r{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,s=t.count;i<s;i+=2)Ro.fromBufferAttribute(t,i),Po.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Ro.distanceTo(Po);e.setAttribute("lineDistance",new ut(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Tm extends $r{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Al extends qt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Te(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 Io=new De,Nr=new Gr,ws=new ln,Ts=new L;class Am extends Ke{constructor(e=new Rt,t=new Al){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,r=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ws.copy(n.boundingSphere),ws.applyMatrix4(i),ws.radius+=s,e.ray.intersectsSphere(ws)===!1)return;Io.copy(i).invert(),Nr.copy(e.ray).applyMatrix4(Io);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,h=n.attributes.position;if(c!==null){const d=Math.max(0,r.start),p=Math.min(c.count,r.start+r.count);for(let g=d,_=p;g<_;g++){const m=c.getX(g);Ts.fromBufferAttribute(h,m),Do(Ts,m,l,i,e,t,this)}}else{const d=Math.max(0,r.start),p=Math.min(h.count,r.start+r.count);for(let g=d,_=p;g<_;g++)Ts.fromBufferAttribute(h,g),Do(Ts,g,l,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 s=0,r=i.length;s<r;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Do(o,e,t,n,i,s,r){const a=Nr.distanceSqToPoint(o);if(a<t){const l=new L;Nr.closestPointToPoint(o,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:r})}}class Bs extends Rt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,r=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:r,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(r+a,Math.PI);let c=0;const u=[],h=new L,d=new L,p=[],g=[],_=[],m=[];for(let f=0;f<=n;f++){const w=[],S=f/n;let x=0;f===0&&r===0?x=.5/t:f===n&&l===Math.PI&&(x=-.5/t);for(let b=0;b<=t;b++){const C=b/t;h.x=-e*Math.cos(i+C*s)*Math.sin(r+S*a),h.y=e*Math.cos(r+S*a),h.z=e*Math.sin(i+C*s)*Math.sin(r+S*a),g.push(h.x,h.y,h.z),d.copy(h).normalize(),_.push(d.x,d.y,d.z),m.push(C+x,1-S),w.push(c++)}u.push(w)}for(let f=0;f<n;f++)for(let w=0;w<t;w++){const S=u[f][w+1],x=u[f][w],b=u[f+1][w],C=u[f+1][w+1];(f!==0||r>0)&&p.push(S,x,C),(f!==n-1||l<Math.PI)&&p.push(x,b,C)}this.setIndex(p),this.setAttribute("position",new ut(g,3)),this.setAttribute("normal",new ut(_,3)),this.setAttribute("uv",new ut(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bs(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Jr extends Rt{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const r=[],a=[],l=[],c=[],u=new L,h=new L,d=new L;for(let p=0;p<=n;p++)for(let g=0;g<=i;g++){const _=g/i*s,m=p/n*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(_),h.y=(e+t*Math.cos(m))*Math.sin(_),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(_),u.y=e*Math.sin(_),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(g/i),c.push(p/n)}for(let p=1;p<=n;p++)for(let g=1;g<=i;g++){const _=(i+1)*p+g-1,m=(i+1)*(p-1)+g-1,f=(i+1)*(p-1)+g,w=(i+1)*p+g;r.push(_,m,w),r.push(m,f,w)}this.setIndex(r),this.setAttribute("position",new ut(a,3)),this.setAttribute("normal",new ut(l,3)),this.setAttribute("uv",new ut(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jr(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Ri extends qt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Te(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 Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=nl,this.normalScale=new Ae(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 Gn extends Ri{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ae(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return lt(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 Te(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 Te(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Te(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=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 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.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 pn(o,e,t){return El(o)?new o.constructor(o.subarray(e,t!==void 0?t:o.length)):o.slice(e,t)}function As(o,e,t){return!o||!t&&o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)}function El(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}function Em(o){function e(i,s){return o[i]-o[s]}const t=o.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function No(o,e,t){const n=o.length,i=new o.constructor(n);for(let s=0,r=0;r!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[r++]=o[a+l]}return i}function Cl(o,e,t,n){let i=1,s=o[0];for(;s!==void 0&&s[n]===void 0;)s=o[i++];if(s===void 0)return;let r=s[n];if(r!==void 0)if(Array.isArray(r))do r=s[n],r!==void 0&&(e.push(s.time),t.push.apply(t,r)),s=o[i++];while(s!==void 0);else if(r.toArray!==void 0)do r=s[n],r!==void 0&&(e.push(s.time),r.toArray(t,t.length)),s=o[i++];while(s!==void 0);else do r=s[n],r!==void 0&&(e.push(s.time),t.push(r)),s=o[i++];while(s!==void 0)}class Qi{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let r;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}r=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}r=n,n=0;break n}break e}for(;n<r;){const a=n+r>>>1;e<t[a]?r=a:n=a+1}if(i=t[n],s=t[n-1],s===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,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let r=0;r!==i;++r)t[r]=n[s+r];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Cm extends Qi{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:di,endingEnd:di}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,r=e+1,a=i[s],l=i[r];if(a===void 0)switch(this.getSettings_().endingStart){case fi:s=e,a=2*t-n;break;case Is:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case fi:r=e,l=2*n-t;break;case Is:r=1,l=n+i[1]-i[0];break;default:r=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=r*u}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,f=-d*m+2*d*_-d*g,w=(1+d)*m+(-1.5-2*d)*_+(-.5+d)*g+1,S=(-1-p)*m+(1.5+p)*_+.5*g,x=p*m-p*_;for(let b=0;b!==a;++b)s[b]=f*r[u+b]+w*r[c+b]+S*r[l+b]+x*r[h+b];return s}}class Ll extends Qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)s[d]=r[c+d]*h+r[l+d]*u;return s}}class Lm extends Qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Yt{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=As(t,this.TimeBufferType),this.values=As(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:As(e.times,Array),values:As(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Lm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ll(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Cm(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Yi:t=this.InterpolantFactoryMethodDiscrete;break;case wi:t=this.InterpolantFactoryMethodLinear;break;case Ks: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 wi;case this.InterpolantFactoryMethodSmooth:return Ks}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,r=i-1;for(;s!==i&&n[s]<e;)++s;for(;r!==-1&&n[r]>t;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);const a=this.getValueSize();this.times=pn(n,s,r),this.values=pn(this.values,s*a,r*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(r!==null&&r>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,r),e=!1;break}r=l}if(i!==void 0&&El(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=pn(this.times),t=pn(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ks,s=e.length-1;let r=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,d=h-n,p=h+n;for(let g=0;g!==n;++g){const _=t[h+g];if(_!==t[d+g]||_!==t[p+g]){l=!0;break}}}if(l){if(a!==r){e[r]=e[a];const h=a*n,d=r*n;for(let p=0;p!==n;++p)t[d+p]=t[h+p]}++r}}if(s>0){e[r]=e[s];for(let a=s*n,l=r*n,c=0;c!==n;++c)t[l+c]=t[a+c];++r}return r!==e.length?(this.times=pn(e,0,r),this.values=pn(t,0,r*n)):(this.times=e,this.values=t),this}clone(){const e=pn(this.times,0),t=pn(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Yt.prototype.TimeBufferType=Float32Array;Yt.prototype.ValueBufferType=Float32Array;Yt.prototype.DefaultInterpolation=wi;class Pi extends Yt{}Pi.prototype.ValueTypeName="bool";Pi.prototype.ValueBufferType=Array;Pi.prototype.DefaultInterpolation=Yi;Pi.prototype.InterpolantFactoryMethodLinear=void 0;Pi.prototype.InterpolantFactoryMethodSmooth=void 0;class Rl extends Yt{}Rl.prototype.ValueTypeName="color";class $i extends Yt{}$i.prototype.ValueTypeName="number";class Rm extends Qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Lt.slerpFlat(s,0,r,c-a,r,c,l);return s}}class Vn extends Yt{InterpolantFactoryMethodLinear(e){return new Rm(this.times,this.values,this.getValueSize(),e)}}Vn.prototype.ValueTypeName="quaternion";Vn.prototype.DefaultInterpolation=wi;Vn.prototype.InterpolantFactoryMethodSmooth=void 0;class Ii extends Yt{}Ii.prototype.ValueTypeName="string";Ii.prototype.ValueBufferType=Array;Ii.prototype.DefaultInterpolation=Yi;Ii.prototype.InterpolantFactoryMethodLinear=void 0;Ii.prototype.InterpolantFactoryMethodSmooth=void 0;class Ji extends Yt{}Ji.prototype.ValueTypeName="vector";class Ur{constructor(e,t=-1,n,i=Vr){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 r=0,a=n.length;r!==a;++r)t.push(Im(n[r]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,r=n.length;s!==r;++s)t.push(Yt.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,r=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=Em(l);l=No(l,1,u),c=No(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),r.push(new $i(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,r)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(c)}}const r=[];for(const a in i)r.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,p,g,_){if(p.length!==0){const m=[],f=[];Cl(p,m,f,g),m.length!==0&&_.push(new h(d,m,f))}},i=[],s=e.name||"default",r=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].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 w=0;w!==d[g].morphTargets.length;++w){const S=d[g];m.push(S.time),f.push(S.morphTarget===_?1:0)}i.push(new $i(".morphTargetInfluence["+_+"]",m,f))}l=p.length*r}else{const p=".bones["+t[h].name+"]";n(Ji,p+".position",d,"pos",i),n(Vn,p+".quaternion",d,"rot",i),n(Ji,p+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Pm(o){switch(o.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $i;case"vector":case"vector2":case"vector3":case"vector4":return Ji;case"color":return Rl;case"quaternion":return Vn;case"bool":case"boolean":return Pi;case"string":return Ii}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+o)}function Im(o){if(o.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Pm(o.type);if(o.times===void 0){const t=[],n=[];Cl(o.keys,t,n,"value"),o.times=t,o.values=n}return e.parse!==void 0?e.parse(o):new e(o.name,o.times,o.values,o.interpolation)}const Ei={enabled:!1,files:{},add:function(o,e){this.enabled!==!1&&(this.files[o]=e)},get:function(o){if(this.enabled!==!1)return this.files[o]},remove:function(o){delete this.files[o]},clear:function(){this.files={}}};class Dm{constructor(e,t,n){const i=this;let s=!1,r=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,r,a),s=!0},this.itemEnd=function(u){r++,i.onProgress!==void 0&&i.onProgress(u,r,a),r===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const p=c[h],g=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null}}}const Nm=new Dm;class es{constructor(e){this.manager=e!==void 0?e:Nm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const tn={};class Um extends Error{constructor(e,t){super(e),this.response=t}}class Pl extends es{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ei.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(tn[e]!==void 0){tn[e].push({onLoad:t,onProgress:n,onError:i});return}tn[e]=[],tn[e].push({onLoad:t,onProgress:n,onError:i});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(r).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=tn[e],h=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=d?parseInt(d):0,g=p!==0;let _=0;const m=new ReadableStream({start(f){w();function w(){h.read().then(({done:S,value:x})=>{if(S)f.close();else{_+=x.byteLength;const b=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let C=0,P=u.length;C<P;C++){const N=u[C];N.onProgress&&N.onProgress(b)}f.enqueue(x),w()}})}}});return new Response(m)}else throw new Um(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Ei.add(e,c);const u=tn[e];delete tn[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=tn[e];if(u===void 0)throw this.manager.itemError(e),c;delete tn[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(c)}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 Om extends es{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,r=Ei.get(e);if(r!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(r),s.manager.itemEnd(e)},0),r;const a=Zi("img");function l(){u(),Ei.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Il extends es{constructor(e){super(e)}load(e,t,n,i){const s=new ct,r=new Om(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class zs extends Ke{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Te(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 vr=new De,Uo=new L,Oo=new L;class Qr{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ae(512,512),this.map=null,this.mapPass=null,this.matrix=new De,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Wr,this._frameExtents=new Ae(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Uo.setFromMatrixPosition(e.matrixWorld),t.position.copy(Uo),Oo.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Oo),t.updateMatrixWorld(),vr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(vr)}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 Fm extends Qr{constructor(){super(new Mt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Ti*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Bm extends zs{constructor(e,t,n=0,i=Math.PI/3,s=0,r=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ke.DEFAULT_UP),this.updateMatrix(),this.target=new Ke,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new Fm}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 Fo=new De,ki=new L,Mr=new L;class zm extends Qr{constructor(){super(new Mt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ae(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(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,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ki.setFromMatrixPosition(e.matrixWorld),n.position.copy(ki),Mr.copy(n.position),Mr.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Mr),n.updateMatrixWorld(),i.makeTranslation(-ki.x,-ki.y,-ki.z),Fo.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fo)}}class Dl extends zs{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 zm}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 km extends Qr{constructor(){super(new jr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Vm extends zs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ke.DEFAULT_UP),this.updateMatrix(),this.target=new Ke,this.shadow=new km}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Hm extends zs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Or{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 Gm extends es{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 s=this,r=Ei.get(e);if(r!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(r),s.manager.itemEnd(e)},0),r;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Ei.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}class Wm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Bo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Bo();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Bo(){return(typeof performance>"u"?Date:performance).now()}class Xm{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,r;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,r=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let r=this.cumulativeWeight;if(r===0){for(let a=0;a!==i;++a)n[s+a]=n[a];r=t}else{r+=t;const a=t/r;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=r}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}r>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,r=i;s!==r;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let r=0;r!==s;++r)e[t+r]=e[n+r]}_slerp(e,t,n,i){Lt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const r=this._workIndex*s;Lt.multiplyQuaternionsFlat(e,r,e,t,e,n),Lt.slerpFlat(e,t,e,t,e,r,i)}_lerp(e,t,n,i,s){const r=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*r+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let r=0;r!==s;++r){const a=t+r;e[a]=e[a]+e[n+r]*i}}}const ea="\\[\\]\\.:\\/",jm=new RegExp("["+ea+"]","g"),ta="[^"+ea+"]",qm="[^"+ea.replace("\\.","")+"]",Ym=/((?:WC+[\/:])*)/.source.replace("WC",ta),Km=/(WCOD+)?/.source.replace("WCOD",qm),Zm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ta),$m=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ta),Jm=new RegExp("^"+Ym+Km+Zm+$m+"$"),Qm=["material","materials","bones","map"];class eg{constructor(e,t,n){const i=n||Ve.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ve{constructor(e,t,n){this.path=t,this.parsedPath=n||Ve.parseTrackName(t),this.node=Ve.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 Ve.Composite(e,t,n):new Ve(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(jm,"")}static parseTrackName(e){const t=Jm.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 s=n.nodeName.substring(i+1);Qm.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===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(s){for(let r=0;r<s.length;r++){const a=s[r];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Ve.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;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(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const r=e[i];if(r===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(l=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ve.Composite=eg;Ve.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ve.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ve.prototype.GetterByBindingType=[Ve.prototype._getValue_direct,Ve.prototype._getValue_array,Ve.prototype._getValue_arrayElement,Ve.prototype._getValue_toArray];Ve.prototype.SetterByBindingTypeAndVersioning=[[Ve.prototype._setValue_direct,Ve.prototype._setValue_direct_setNeedsUpdate,Ve.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ve.prototype._setValue_array,Ve.prototype._setValue_array_setNeedsUpdate,Ve.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ve.prototype._setValue_arrayElement,Ve.prototype._setValue_arrayElement_setNeedsUpdate,Ve.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ve.prototype._setValue_fromArray,Ve.prototype._setValue_fromArray_setNeedsUpdate,Ve.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class tg{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,r=s.length,a=new Array(r),l={endingStart:di,endingEnd:di};for(let c=0;c!==r;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qc,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,r=s/i,a=i/s;e.warp(1,r,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,r=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/r,c[1]=t/r,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const r=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Kc:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(r),c[u].accumulateAdditive(a);break;case Vr:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(r),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const r=n===Yc;if(e===0)return s===-1?i:r&&(s&1)===1?t-i:i;if(n===jc){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,r)):this._setEndings(this.repetitions===0,!0,r)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(r&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=fi,i.endingEnd=fi):(e?i.endingStart=this.zeroSlopeAtStart?fi:di:i.endingStart=Is,t?i.endingEnd=this.zeroSlopeAtEnd?fi:di:i.endingEnd=Is)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let r=this._weightInterpolant;r===null&&(r=i._lendControlInterpolant(),this._weightInterpolant=r);const a=r.parameterPositions,l=r.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}const ng=new Float32Array(1);class ig extends yn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,r=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const d=i[h],p=d.name;let g=u[p];if(g!==void 0)++g.referenceCount,r[h]=g;else{if(g=r[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,p));continue}const _=t&&t._propertyBindings[h].binding.parsedPath;g=new Xm(Ve.create(n,p,_),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,p),r[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let r=s[t];if(r===void 0)r={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=r;else{const a=r.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),r.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,r=this._actionsByClip,a=r[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],l.length===0&&delete r[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let r=i[t];r===void 0&&(r={},i[t]=r),r[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,r=this._bindingsByRootAndName,a=r[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete r[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Ll(new Float32Array(2),new Float32Array(2),1,ng),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let r=typeof e=="string"?Ur.findByName(i,e):e;const a=r!==null?r.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(r!==null?n=r.blendMode:n=Vr),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],r===null&&(r=c._clip)}if(r===null)return null;const u=new tg(this,r,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Ur.findByName(n,e):e,r=s?s.uuid:e,a=this._actionsByClip[r];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),r=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,r);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(r);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const r=s.knownActions;for(let a=0,l=r.length;a!==l;++a){const c=r[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const r in n){const a=n[r].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const r in s){const a=s[r];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class zo{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(lt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class sg extends Tl{constructor(e=10,t=10,n=4473924,i=8947848){n=new Te(n),i=new Te(i);const s=t/2,r=e/t,a=e/2,l=[],c=[];for(let d=0,p=0,g=-a;d<=t;d++,g+=r){l.push(-a,0,g,a,0,g),l.push(g,0,-a,g,0,a);const _=d===s?n:i;_.toArray(c,p),p+=3,_.toArray(c,p),p+=3,_.toArray(c,p),p+=3,_.toArray(c,p),p+=3}const u=new Rt;u.setAttribute("position",new ut(l,3)),u.setAttribute("color",new ut(c,3));const h=new Zr({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:kr}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=kr);const ko={type:"change"},yr={type:"start"},Vo={type:"end"};class rg extends yn{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new L,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LE
3416FT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Xn.ROTATE,MIDDLE:Xn.DOLLY,RIGHT:Xn.PAN},this.touches={ONE:jn.ROTATE,TWO:jn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(E){E.addEventListener("keydown",Xe),this._domElementKeyEvents=E},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Xe),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(ko),n.update(),s=i.NONE},this.update=function(){const E=new L,j=new Lt().setFromUnitVectors(e.up,new L(0,1,0)),F=j.clone().invert(),le=new L,de=new Lt,pe=2*Math.PI;return function(){const fe=n.object.position;E.copy(fe).sub(n.target),E.applyQuaternion(j),a.setFromVector3(E),n.autoRotate&&s===i.NONE&&M(P()),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let be=n.minAzimuthAngle,Re=n.maxAzimuthAngle;return isFinite(be)&&isFinite(Re)&&(be<-Math.PI?be+=pe:be>Math.PI&&(be-=pe),Re<-Math.PI?Re+=pe:Re>Math.PI&&(Re-=pe),be<=Re?a.theta=Math.max(be,Math.min(Re,a.theta)):a.theta=a.theta>(be+Re)/2?Math.max(be,a.theta):Math.min(Re,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=c,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),E.setFromSpherical(a),E.applyQuaternion(F),fe.copy(n.target).add(E),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),c=1,h||le.distanceToSquared(n.object.position)>r||8*(1-de.dot(n.object.quaternion))>r?(n.dispatchEvent(ko),le.copy(n.object.position),de.copy(n.object.quaternion),h=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",v),n.domElement.removeEventListener("pointerdown",Ee),n.domElement.removeEventListener("pointercancel",qe),n.domElement.removeEventListener("wheel",Be),n.domElement.removeEventListener("pointermove",Ze),n.domElement.removeEventListener("pointerup",qe),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",Xe),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const r=1e-6,a=new zo,l=new zo;let c=1;const u=new L;let h=!1;const d=new Ae,p=new Ae,g=new Ae,_=new Ae,m=new Ae,f=new Ae,w=new Ae,S=new Ae,x=new Ae,b=[],C={};function P(){return 2*Math.PI/60/60*n.autoRotateSpeed}function N(){return Math.pow(.95,n.zoomSpeed)}function M(E){l.theta-=E}function A(E){l.phi-=E}const K=function(){const E=new L;return function(F,le){E.setFromMatrixColumn(le,0),E.multiplyScalar(-F),u.add(E)}}(),X=function(){const E=new L;
3416return function(F,le){n.screenSpacePanning===!0?E.setFromMatrixColumn(le,1):(E.setFromMatrixColumn(le,0),E.crossVectors(n.object.up,E)),E.multiplyScalar(F),u.add(E)}}(),I=function(){const E=new L;return function(F,le){const de=n.domElement;if(n.object.isPerspectiveCamera){const pe=n.object.position;E.copy(pe).sub(n.target);let ue=E.length();ue*=Math.tan(n.object.fov/2*Math.PI/180),K(2*F*ue/de.clientHeight,n.object.matrix),X(2*le*ue/de.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(K(F*(n.object.right-n.object.left)/n.object.zoom/de.clientWidth,n.object.matrix),X(le*(n.object.top-n.object.bottom)/n.object.zoom/de.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function O(E){n.object.isPerspectiveCamera?c/=E:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*E)),n.object.updateProjectionMatrix(),h=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(E){n.object.isPerspectiveCamera?c*=E:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/E)),n.object.updateProjectionMatrix(),h=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function $(E){d.set(E.clientX,E.clientY)}function J(E){w.set(E.clientX,E.clientY)}function q(E){_.set(E.clientX,E.clientY)}function ne(E){p.set(E.clientX,E.clientY),g.subVectors(p,d).multiplyScalar(n.rotateSpeed);const j=n.domElement;M(2*Math.PI*g.x/j.clientHeight),A(2*Math.PI*g.y/j.clientHeight),d.copy(p),n.update()}function ee(E){S.set(E.clientX,E.clientY),x.subVectors(S,w),x.y>0?O(N()):x.y<0&&z(N()),w.copy(S),n.update()}function Me(E){m.set(E.clientX,E.clientY),f.subVectors(m,_).multiplyScalar(n.panSpeed),I(f.x,f.y),_.copy(m),n.update()}function ie(E){E.deltaY<0?z(N()):E.deltaY>0&&O(N()),n.update()}function V(E){let j=!1;switch(E.code){case n.keys.UP:E.ctrlKey||E.metaKey||E.shiftKey?A(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):I(0,n.keyPanSpeed),j=!0;break;case n.keys.BOTTOM:E.ctrlKey||E.metaKey||E.shiftKey?A(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):I(0,-n.keyPanSpeed),j=!0;break;case n.keys.LEFT:E.ctrlKey||E.metaKey||E.shiftKey?M(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):I(n.keyPanSpeed,0),j=!0;break;case n.keys.RIGHT:E.ctrlKey||E.metaKey||E.shiftKey?M(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):I(-n.keyPanSpeed,0),j=!0;break}j&&(E.preventDefault(),n.update())}function Y(){if(b.length===1)d.set(b[0].pageX,b[0].pageY);else{const E=.5*(b[0].pageX+b[1].pageX),j=.5*(b[0].pageY+b[1].pageY);d.set(E,j)}}function ae(){if(b.length===1)_.set(b[0].pageX,b[0].pageY);else{const E=.5*(b[0].pageX+b[1].pageX),j=.5*(b[0].pageY+b[1].pageY);_.set(E,j)}}function ce(){const E=b[0].pageX-b[1].pageX,j=b[0].pageY-b[1].pageY,F=Math.sqrt(E*E+j*j);w.set(0,F)}function B(){n.enableZoom&&ce(),n.enablePan&&ae()}function Se(){n.enableZoom&&ce(),n.enableRotate&&Y()}function ve(E){if(b.length==1)p.set(E.pageX,E.pageY);else{const F=oe(E),le=.5*(E.pageX+F.x),de=.5*(E.pageY+F.y);p.set(le,de)}g.subVectors(p,d).multiplyScalar(n.rotateSpeed);const j=n.domElement;M(2*Math.PI*g.x/j.clientHeight),A(2*Math.PI*g.y/j.clientHeight),d.copy(p)}function se(E){if(b.length===1)m.set(E.pageX,E.pageY);else{const j=oe(E),F=.5*(E.pageX+j.x),le=.5*(E.pageY+j.y);m.set(F,le)}f.subVectors(m,_).multiplyScalar(n.panSpeed),I(f.x,f.y),_.copy(m)}function xe(E){const j=oe(E),F=E.pageX-j.x,le=E.pageY-j.y,de=Math.sqrt(F*F+le*le);S.set(0,de),x.set(0,Math.pow(S.y/w.y,n.zoomSpeed)),O(x.y),w.copy(S)}function ze(E){n.enableZoom&&xe(E),n.enablePan&&se(E)}function me(E){n.enableZoom&&xe(E),n.enableRotate&&ve(E)}function Ee(E){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(E.pointerId),n.domElement.addEventListener("pointermove",Ze),n.domElement.addEventListener("pointerup",qe)),k(E),E.pointerType==="touch"?ht(E):et(E))}function Ze(E){n.enabled!==!1&&(E.pointerType==="touch"?T(E):$e(E))}function qe(E){Z(E),b.length===0&&(n.domElement.releasePointerCapture(E.pointerId),n.domElement.removeEventListener("pointermove",Ze),n.domElement.removeEventListener("pointerup",qe)),n.dispatchEvent(Vo),s=i.NONE}function et(E){let j;switch(E.button){case 0:j=n.mouseButtons.LEFT;break;case 1:j=n.mouseButtons.MIDDLE;break;case 2:j=n.mouseButtons.RIGHT;break;default:j=-1}switch(j){case Xn.DOLLY:if(n.enableZoom===!1)return;J(E),s=i.DOLLY;break;case Xn.ROTATE:if(E.ctrlKey||E.metaKey||E.shiftKey){if(n.enablePan===!1)return;q(E),s=i.PAN}else{if(n.enableRotate===!1)return;$(E),s=i.ROTATE}break;case Xn.PAN:if(E.ctrlKey||E.metaKey||E.shiftKey){if(n.enableRotate===!1)return;$(E),s=i.ROTATE}else{if(n.enablePan===!1)return;q(E),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(yr)}function $e(E){switch(s){case i.ROTATE:if(n.enableRotate===!1)return;ne(E);break;case i.DOLLY:if(n.enableZoom===!1)return;ee(E);break;case i.PAN:if(n.enablePan===!1)return;Me(E);break}}function Be(E){n.enabled===!1||n.enableZoom===!1||s!==i.NONE||(E.preventDefault(),n.dispatchEvent(yr),ie(E),n.dispatchEvent(Vo))}function Xe(E){n.enabled===!1||n.enablePan===!1||V(E)}function ht(E){switch(te(E),b.length){case 1:switch(n.touches.ONE){case jn.ROTATE:if(n.enableRotate===!1)return;Y(),s=i.TOUCH_ROTATE;break;case jn.PAN:if(n.enablePan===!1)return;ae(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(n.touches.TWO){case jn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;B(),s=i.TOUCH_DOLLY_PAN;break;case jn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Se(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(yr)}function T(E){switch(te(E),s){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;ve(E),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;se(E),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ze(E),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(E),n.update();break;default:s=i.NONE}}function v(E){n.enabled!==!1&&E.preventDefault()}function k(E){b.push(E)}function Z(E){delete C[E.pointerId];for(let j=0;j<b.length;j++)if(b[j].pointerId==E.pointerId){b.splice(j,1);return}}function te(E){let j=C[E.pointerId];j===void 0&&(j=new Ae,C[E.pointerId]=j),j.set(E.pageX,E.pageY)}function oe(E){const j=E.pointerId===b[0].pointerId?b[1]:b[0];return C[j.pointerId]}n.domElement.addEventListener("contextmenu",v),n.domElement.addEventListener("pointerdown",Ee),n.domElement.addEventListener("pointercancel",qe),n.domElement.addEventListener("wheel",Be,{passive:!1}),this.update()}}function Ho(o,e){if(e===Zc)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(e===Lr||e===tl){let t=o.getIndex();if(t===null){const r=[],a=o.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)r.push(l);o.setIndex(r),t=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=t.count-2,i=[];if(e===Lr)for(let r=1;r<=n;r++)i.push(t.getX(0)),i.push(t.getX(r)),i.push(t.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(i.push(t.getX(r)),i.push(t.getX(r+1)),i.push(t.getX(r+2))):(i.push(t.getX(r+2)),i.push(t.getX(r+1)),i.push(t.getX(r)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=o.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),o}class ag extends es{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new hg(t)}),this.register(function(t){return new xg(t)}),this.register(function(t){return new vg(t)}),this.register(function(t){return new Mg(t)}),this.register(function(t){return new fg(t)}),this.register(function(t){return new pg(t)}),this.register(function(t){return new mg(t)}),this.register(function(t){return new gg(t)}),this.register(function(t){return new ug(t)}),this.register(function(t){return new _g(t)}),this.register(function(t){return new dg(t)}
vendor: 4,892 bytes, line 3416
3416),this.register(function(t){return new lg(t)}),this.register(function(t){return new yg(t)}),this.register(function(t){return new Sg(t)})}load(e,t,n,i){const s=this;let r;this.resourcePath!==""?r=this.resourcePath:this.path!==""?r=this.path:r=Or.extractUrlBase(e),this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Pl(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,r,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},n,a)}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 s;const r={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===Nl){try{r[Fe.KHR_BINARY_GLTF]=new bg(e)}catch(h){i&&i(h);return}s=JSON.parse(r[Fe.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Og(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const h=this.pluginCallbacks[u](c);a[h.name]=h,r[h.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){const h=s.extensionsUsed[u],d=s.extensionsRequired||[];switch(h){case Fe.KHR_MATERIALS_UNLIT:r[h]=new cg;break;case Fe.KHR_DRACO_MESH_COMPRESSION:r[h]=new wg(s,this.dracoLoader);break;case Fe.KHR_TEXTURE_TRANSFORM:r[h]=new Tg;break;case Fe.KHR_MESH_QUANTIZATION:r[h]=new Ag;break;default:d.indexOf(h)>=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function og(){let o={};return{get:function(e){return o[e]},add:function(e,t){o[e]=t},remove:function(e){delete o[e]},removeAll:function(){o={}}}}const Fe={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",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_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=Fe.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 s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const u=new Te(16777215);l.color!==void 0&&u.fromArray(l.color);const h=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new Vm(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Dl(u),c.distance=h;break;case"spot":c=new Bm(u),c.distance=h,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,gn(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),t.cac
vendor: 8,462 bytes, line 3416
3416he.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(t.cache,a,l)})}}class cg{constructor(){this.name=Fe.KHR_MATERIALS_UNLIT}getMaterialType(){return In}extendParams(e,t,n){const i=[];e.color=new Te(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const r=s.baseColorFactor;e.color.fromArray(r),e.opacity=r[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,ke))}return Promise.all(i)}}class ug{constructor(e){this.parser=e,this.name=Fe.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 s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class hg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],r=i.extensions[this.name];if(r.clearcoatFactor!==void 0&&(t.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ae(a,a)}return Promise.all(s)}}class dg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],r=i.extensions[this.name];return r.iridescenceFactor!==void 0&&(t.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(t.iridescenceIOR=r.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(s)}}class fg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Te(0,0,0),t.sheenRoughness=0,t.sheen=1;const r=i.extensions[this.name];return r.sheenColorFactor!==void 0&&t.sheenColor.fromArray(r.sheenColorFactor),r.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",r.sheenColorTexture,ke)),r.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(s)}}class pg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],r=i.extensions[this.name];return r.transmissionFactor!==void 0&&(t.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",r.transmissionTexture)),Promise.all(s)}}class mg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],r=i.extensions[this.name];t.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",r.thicknessTexture)),t.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return t.attenuationColor=new Te(a[0],a[1],a[2]),Promise.all(s)}}class gg{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class _g{constructor(e){this.parser=e,this.name=Fe.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Gn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],r=i.extensions[this.name];t.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return t.specularColor=new Te(a[0],a[1],a[2]),r.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",r.specularColorTexture,ke)),Promise.all(s)}}class xg{constructor(e){this.parser=e,this.name=Fe.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 s=i.extensions[this.name],r=t.options.ktx2Loader;if(!r){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,s.source,r)}}class vg{constructor(e){this.parser=e,this.name=Fe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],a=i.images[r.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,r.source,l);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 Mg{constructor(e){this.parser=e,this.name=Fe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const r=s.extensions[t],a=i.images[r.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,r.source,l);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
3416FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class yg{constructor(e){this.name=Fe.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],s=this.parser.getDependency("buffer",i.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.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 s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,h=i.byteStride,d=new Uint8Array(a,l,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,h,d,i.mode,i.filter).then(function(p){return p.buffer}):r.ready.then(function(){const p=new ArrayBuffer(u*h);return r.decodeGltfBuffer(new Uint8Array(p),u,h,d,i.mode,i.filter),p})})}else return null}}class Sg{constructor(e){this.name=Fe.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 c of i.primitives)if(c.mode!==Dt.TRIANGLES&&c.mode!==Dt.TRIANGLE_STRIP&&c.mode!==Dt.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=n.extensions[this.name].attributes,a=[],l={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),h=u.isGroup?u.children:[u],d=c[0].count,p=[];for(const g of h){const _=new De,m=new L,f=new Lt,w=new L(1,1,1),S=new wm(g.geometry,g.material,d);for(let x=0;x<d;x++)l.TRANSLATION&&m.fromBufferAttribute(l.TRANSLATION,x),l.ROTATION&&f.fromBufferAttribute(l.ROTATION,x),l.SCALE&&w.fromBufferAttribute(l.SCALE,x),S.setMatrixAt(x,_.compose(m,f,w));for(const x in l)x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,l[x]);Ke.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),p.push(S)}return u.isGroup?(u.clear(),u.add(...p),u):p[0]}))}}const Nl="glTF",Vi=12,Go={JSON:1313821514,BIN:5130562};class bg{constructor(e){this.name=Fe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Vi),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!==Nl)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-Vi,s=new DataView(e,Vi);let r=0;for(;r<i;){const a=s.getUint32(r,!0);r+=4;const l=s.getUint32(r,!0);if(r+=4,l===Go.JSON){const c=new Uint8Array(e,Vi+r,a);this.content=n.decode(c)}else if(l===Go.BIN){const c=Vi+r;this.body=e.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wg{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Fe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,a={},l={},c={};for(const u in r){const h=Fr[u]||u.toLowerCase();a[h]=r[u]}for(const u in e.attributes){const h=Fr[u]||u.toLowerCase();if(r[u]!==void 0){const d=n.accessors[e.attributes[u]],p=xi[d.componentType];c[h]=p.name,l[h]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(h){i.decodeDracoFile(u,function(d){for(const p in d.attributes){const g=d.attributes[p],_=l[p];_!==void 0&&(g.normalized=_)}h(d)},a,c)})})}}class Tg{constructor(){this.name=Fe.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 Ag{constructor(){this.name=Fe.KHR_MESH_QUANTIZATION}}class Ul extends Qi{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let r=0;r!==i;r++)t[r]=n[s+r];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=i-t,h=(n-t)/u,d=h*h,p=d*h,g=e*c,_=g-c,m=-2*p+3*d,f=p-d,w=1-m,S=f-d+h;for(let x=0;x!==a;x++){const b=r[_+x+a],C=r[_+x+l]*u,P=r[g+x+a],N=r[g+x]*u;s[x]=w*b+S*C+m*P+f*N}return s}}const Eg=new Lt;class Cg extends Ul{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return Eg.fromArray(s).normalize().toArray(s),s}}const Dt={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},xi={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wo={9728:ot,9729:St,9984:Cr,9985:Qo,9986:Cs,9987:On},Xo={33071:Nt,33648:Ps,10497:Si},Sr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Fr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},mn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Lg={CUBICSPLINE:void 0,LINEAR:wi,STEP:Yi},br={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Rg(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new Ri({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:an})),o.DefaultMaterial}function Hi(o,e,t){for(const n in t.extensions)o[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function gn(o,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(o.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Pg(o,e,t){let n=!1,i=!1,s=!1;for(let c=0,u=e.length;c<u;c++){const h=e[c];if(h.POSITION!==void 0&&(n=!0),h.NORMAL!==void 0&&(i=!0),h.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(o);const r=[],a=[],l=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];if(n){const d=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):o.attributes.position;r.push(d)}if(i){const d=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):o.attributes.normal;a.push(d)}if(s){const d=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):o.attributes.color;l.push(d)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(l)]).then(function(c){const u=c[0],h=c[1],d=c[2];return n&&(o.morphAttributes.position=u),i&&(o.morphAttributes.normal=h),s&&(o.morphAttributes.color=d
vendor: 21,193 bytes, line 3416
3416),o.morphTargetsRelative=!0,o})}function Ig(o,e){if(o.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)o.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(o.morphTargetInfluences.length===t.length){o.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)o.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dg(o){const e=o.extensions&&o.extensions[Fe.KHR_DRACO_MESH_COMPRESSION];let t;return e?t="draco:"+e.bufferView+":"+e.indices+":"+jo(e.attributes):t=o.indices+":"+jo(o.attributes)+":"+o.mode,t}function jo(o){let e="";const t=Object.keys(o).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+o[t[n]]+";";return e}function Br(o){switch(o){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 Ng(o){return o.search(/\.jpe?g($|\?)/i)>0||o.search(/^data\:image\/jpeg/)===0?"image/jpeg":o.search(/\.webp($|\?)/i)>0||o.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ug=new De;class Og{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new og,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,s=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&s<98?this.textureLoader=new Il(this.options.manager):this.textureLoader=new Gm(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Pl(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,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){const a={scene:r[0][i.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:i.asset,parser:n,userData:{}};Hi(s,a,i),gn(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const r=t[i].joints;for(let a=0,l=r.length;a<l;a++)e[r[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const r=e[i];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.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(),s=(r,a)=>{const l=this.associations.get(r);l!=null&&this.associations.set(a,l);for(const[c,u]of r.children.entries())s(u,a.children[c])};return s(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 s=e(t[i]);s&&n.push(s)}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(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.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(s,r){return n.getDependency(e,r)})),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[Fe.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,r){n.load(Or.resolveURL(t.uri,i.path),s,void 0,function(){r(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,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const r=Sr[i.type],a=xi[i.componentType],l=i.normalized===!0,c=new a(i.count*r);return Promise.resolve(new yt(c,r,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(r){const a=r[0],l=Sr[i.type],c=xi[i.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,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!==h){const f=Math.floor(d/p),w="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count;let S=t.cache.get(w);S||(_=new c(a,f*p,i.count*p/u),S=new xm(_,p/u),t.cache.add(w,S)),m=new Yr(S,l,d%p/u,g)}else a===null?_=new c(i.count*l):_=new c(a,d,i.count*l),m=new yt(_,l,g);if(i.sparse!==void 0){const f=Sr.SCALAR,w=xi[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,x=i.sparse.values.byteOffset||0,b=new w(r[1],S,i.sparse.count*f),C=new c(r[2],x,i.sparse.count*l);a!==null&&(m=new yt(m.array.slice(),m.itemSize,m.normalized));for(let P=0,N=b.length;P<N;P++){const M=b[P];if(m.setX(M,C[P*l]),l>=2&&m.setY(M,C[P*l+1]),l>=3&&m.setZ(M,C[P*l+2]),l>=4&&m.setW(M,C[P*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,r=t.images[s];let a=this.textureLoader;if(r.uri){const l=n.manager.getHandler(r.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,r=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const d=(s.samplers||{})[r.sampler]||{};return u.magFilter=Wo[d.magFilter]||St,u.minFilter=Wo[d.minFilter]||On,u.wrapS=Xo[d.wrapS]||Si,u.wrapT=Xo[d.wrapT]||Si,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const r=i.images[e],a=self.URL||self.webkitURL;let l=r.uri||"",c=!1;if(r.bufferView!==void 0)l=n.getDependency("bufferView",r.bufferView).then(function(h){c=!0;const d=new Blob([h],{type:r.mimeType});return l=a.createObjectURL(d),l});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(_){const m=new ct(_);m.needsUpdate=!0,d(m)}),t.load(Or.resolveURL(h,s.path),g,void 0,p)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=r.mimeType||Ng(r.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(r=r.clone(),r.channel=n.texCoord),s.extensions[Fe.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[Fe.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(r);r=s.extensions[Fe.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),s.associations.set(r,l)}}return i!==void 0&&(r.encoding=i),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Al,qt.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Zr,qt.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||s||r){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),r&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return Ri}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let r;const a={},l=s.extensions||{},c=[];if(l[Fe.KHR_MATERIALS_UNLIT]){const h=i[Fe.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new Te(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,ke)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),r=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=jt);const u=s.alphaMode||br.OPAQUE;if(u===br.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===br.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&r!==In&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ae(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}return s.occlusionTexture!==void 0&&r!==In&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&r!==In&&(a.emissive=new Te().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&r!==In&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,ke)),Promise.all(c).then(function(){const h=new r(a);return s.name&&(h.name=s.name),gn(h,s),t.associations.set(h,{materials:e}),s.extensions&&Hi(i,h,s),h})}createUniqueName(e){const t=Ve.sanitizeNodeName(e||"");let n=t;for(let i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[Fe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return qo(l,a,t)})}const r=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],u=Dg(c),h=i[u];if(h)r.push(h.promise);else{let d;c.extensions&&c.extensions[Fe.KHR_DRACO_MESH_COMPRESSION]?d=s(c):d=qo(new Rt,c,t),i[u]={primitive:c,promise:d},r.push(d)}}return Promise.all(r)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],r=s.primitives,a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l].material===void 0?Rg(this.cache):this.getDependency("material",r[l].material);a.push(u)}return a.push(t.loadGeometries(r)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),u=l[l.length-1],h=[];for(let p=0,g=u.length;p<g;p++){const _=u[p],m=r[p];let f;const w=c[p];if(m.mode===Dt.TRIANGLES||m.mode===Dt.TRIANGLE_STRIP||m.mode===Dt.TRIANGLE_FAN||m.mode===void 0)f=s.isSkinnedMesh===!0?new Mm(_,w):new mt(_,w),f.isSkinnedMesh===!0&&f.normalizeSkinWeights(),m.mode===Dt.TRIANGLE_STRIP?f.geometry=Ho(f.geometry,tl):m.mode===Dt.TRIANGLE_FAN&&(f.geometry=Ho(f.geometry,Lr));else if(m.mode===Dt.LINES)f=new Tl(_,w);else if(m.mode===Dt.LINE_STRIP)f=new $r(_,w);else if(m.mode===Dt.LINE_LOOP)f=new Tm(_,w);else if(m.mode===Dt.POINTS)f=new Am(_,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(f.geometry.morphAttributes).length>0&&Ig(f,s),f.name=t.createUniqueName(s.name||"mesh_"+e),gn(f,s),m.extensions&&Hi(i,f,m),t.assignFinalMaterial(f),h.push(f)}for(let p=0,g=h.length;p<g;p++)t.associations.set(h[p],{meshes:e,primitives:p});if(h.length===1)return h[0];const d=new Dn;t.associations.set(d,{meshes:e});for(let p=0,g=h.length;p<g;p++)d.add(h[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 Mt(al.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new jr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),gn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;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 s=i.pop(),r=i,a=[],l=[];for(let c=0,u=r.length;c<u;c++){const h=r[c];if(h){a.push(h);const d=new De;s!==null&&d.fromArray(s.array,c*16),l.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Kr(a,l)})}loadAnimation(e){const n=this.json.animations[e],i=n.name?n.name:"animation_"+e,s=[],r=[],a=[],l=[],c=[];for(let u=0,h=n.channels.length;u<h;u++){const d=n.channels[u],p=n.samplers[d.sampler],g=d.target,_=g.node,m=n.parameters!==void 0?n.parameters[p.input]:p.input,f=n.parameters!==void 0?n.parameters[p.output]:p.output;g.node!==void 0&&(s.push(this.getDependency("node",_)),r.push(this.getDependency("accessor",m)),a.push(this.getDependency("accessor",f)),l.push(p),c.push(g))}return Promise.all([Promise.all(s),Promise.all(r),Promise.all(a),Promise.all(l),Promise.all(c)]).then(function(u){const h=u[0],d=u[1],p=u[2],g=u[3],_=u[4],m=[];for(let f=0,w=h.length;f<w;f++){const S=h[f],x=d[f],b=p[f],C=g[f],P=_[f];if(S===void 0)continue;S.updateMatrix();let N;switch(mn[P.path]){case mn.weights:N=$i;break;case mn.rotation:N=Vn;break;case mn.position:case mn.scale:default:N=Ji;break}const M=S.name?S.name:S.uuid,A=C.interpolation!==void 0?Lg[C.interpolation]:wi,K=[];mn[P.path]===mn.weights?S.traverse(function(I){I.morphTargetInfluences&&K.push(I.name?I.name:I.uuid)}):K.push(M);let X=b.array;if(b.normalized){const I=Br(X.constructor),O=new Float32Array(X.length);for(let z=0,$=X.length;z<$;z++)O[z]=X[z]*I;X=O}for(let I=0,O=K.length;I<O;I++){const z=new N(K[I]+"."+mn[P.path],x.array,X,A);C.interpolation==="CUBICSPLINE"&&(z.createInterpolant=function(J){const q=this instanceof Vn?Cg:Ul;return new q(this.times,this.values,this.getValueSize()/3,J)},z.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),m.push(z)}}return new Ur(i,void 0,m)})}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(s){const r=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),r})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),r=[],a=i.children||[];for(let c=0,u=a.length;c<u;c++)r.push(n.getDependency("node",a[c]));const l=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(r),l]).then(function(c){const u=c[0],h=c[1],d=c[2];d!==null&&u.traverse(function(p){p.isSkinnedMesh&&p.bind(d,Ug)});for(let p=0,g=h.length;p<g;p++)u.add(h[p]);return u})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],r=s.name?i.createUniqueName(s.name):"",a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new wl:c.length>1?u=new Dn:c.length===1?u=c[0]:u=new Ke,u!==c[0])for(let h=0,d=c.length;h<d;h++)u.add(c[h]);if(s.name&&(u.userData.name=s.name,u.name=r),gn(u,s),s.extensions&&Hi(n,u,s),s.matrix!==void 0){const h=new De;h.fromArray(s.matrix),u.applyMatrix4(h)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return i.associations.has(u)||i.associations.set(u,{}),i.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new Dn;n.name&&(s.name=i.createUniqueName(n.name)),gn(s,n),n.extensions&&Hi(t,s,n);const r=n.nodes||[],a=[];for(let l=0,c=r.length;l<c;l++)a.push(i.getDependency("node",r[l]));return Promise.all(a).then(function(l){for(let u=0,h=l.length;u<h;u++)s.add(l[u]);const c=u=>{const h=new Map;for(const[d,p]of i.associations)(d instanceof qt||d instanceof ct)&&h.set(d,p);return u.traverse(d=>{const p=i.associations.get(d);p!=null&&h.set(d,p)}),h};return i.associations=c(s),s})}}function Fg(o,e,t){const n=e.attributes,i=new on;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new L(l[0],l[1],l[2]),new L(c[0],c[1],c[2])),a.normalized){const u=Br(xi[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new L,l=new L;for(let c=0,u=s.length;c<u;c++){const h=s[c];if(h.POSITION!==void 0){const d=t.json.accessors[h.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){if(l.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),l.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),l.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),d.normalized){const _=Br(xi[d.componentType]);l.multiplyScalar(_)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}o.boundingBox=i;const r=new ln;i.getCenter(r.center),r.radius=i.min.distanceTo(i.max)/2,o.boundingSphere=r}function qo(o,e,t){const n=e.attributes,i=[];function s(r,a){return t.getDependency("accessor",r).then(function(l){o.setAttribute(a,l)})}for(const r in n){const a=Fr[r]||r.toLowerCase();a in o.attributes||i.push(s(n[r],a))}if(e.indices!==void 0&&!o.index){const r=t.getDependency("accessor",e.indices).then(function(a){o.setIndex(a)});i.push(r)}return gn(o,e),Fg(o,e,t),Promise.all(i).then(function(){return e.targets!==void 0?Pg(o,e.targets,t):o})}const _n={width:window.innerWidth,height:window.innerHeight},zr={UP:"U",DOWN:"D"};let vi=!1,wr=zr.DOWN;const Ol=new Wm,wt=new _m,Wn=new Il,Fl=Wn.load(Jl);Wn.load(Ql);Wn.load(tc);const Bg=Wn.load($l),zg=Wn.load(Zl),Mn=new Mt(75,window.innerWidth/window.innerHeight,.1,1e3),Ds=jg(Mn);let kg=null,Ns=null;$g(kg,4,0,-2,35);window.addEventListener("resize",()=>{_n.width=window.innerWidth,_n.height=window.innerHeight,Mn.aspect=_n.width/_n.height,Mn.updateProjectionMatrix(),Ds.setSize(_n.width,_n.height),Ds.setPixelRatio(Math.min(window.devicePixelRatio,2))});
3416const Vg=new Jr(10,3,16,100),Bl=Gl(Fl);Bl.color=new Te(986895);const Rs=new mt(Vg,Bl);wt.add(Rs);const Hg=Hl(5,5,5,16777215);Hl(-5,5,5,16711680);const Gg=new Hm(16777215);wt.add(Hg,Gg);const Wg=new sg(200,50);wt.add(Wg);const Xg=new rg(Mn,Ds.domElement);wt.add(Xg);function jg(o){const e=new bl({canvas:document.querySelector("#bg"),alpha:!0});return e.setSize(_n.width,_n.height),e.setPixelRatio(Math.min(window.devicePixelRatio,2)),o.position.setZ(30),o.position.setX(-3),e.render(wt,o),e}function qg(){const o=new Bs(.25,24,24),e=new Ri({color:16777215}),t=new mt(o,e),[n,i,s]=Array(3).fill().map(()=>al.randFloatSpread(100));t.position.set(n,i,s),wt.add(t)}Array(200).fill().forEach(qg);const Yg=Wn.load(Yl);wt.background=Yg;location.hash&&location.hash.substr(1);const Kg=Wn.load(Kl),zl=Gl(zg);zl.map=Kg;const Hn=new mt(new Ci(3,3,3),zl);wt.add(Hn);const Un=new mt(new Bs(3,32,32),new Ri({map:Bg,normalMap:Fl}));wt.add(Un);Un.position.z=30;Un.position.setX(-10);Hn.position.z=-5;Hn.position.x=2;let Es=document.body.getBoundingClientRect().top;function kl(o){vi=!0;let e=1;const t=document.body.getBoundingClientRect().top;t>Es&&(wr=zr.UP,e=-1),t<Es&&(wr=zr.DOWN,e=1),Qg("scrollDir =",wr,` 3417t = `,t,` 3418lastScrollY = `,Es),Es=t,console.log("t = "+t),Un.rotation.x+=.05,Un.rotation.y+=.075,Un.rotation.z+=.05,Hn.rotation.y+=.01,Hn.rotation.z+=.01,Mn.position.z=t*-.01,Mn.position.x=t*-2e-4,Mn.rotation.y=t*-2e-4;let n=wt.getObjectByName("wraith_animated");n!=null&&(n.rotation.y+=t*-2e-5*e),o!=null&&console.log("moveCamera",` 3419srcElement.defaultView.scrollY`,o.srcElement.defaultView.scrollY,` 3420target.defaultView.scrollY`,o.target.defaultView.scrollY,` 3421window.scrollY`,window.scrollY)}function Zg(o){vi=!1,console.log(`scrollend 3422isScrolling`,vi)}Jg();document.body.onscroll=kl;document.addEventListener("scrollend",Zg);kl();let nn=Ol.getElapsedTime();function Vl(){nn=Ol.getDelta(),Rs.rotation.x+=.5*nn,Rs.rotation.y+=.6*nn,Rs.rotation.z+=.6*nn,Un.rotation.x+=.5*nn,vi||(Hn.rotation.y-=.6*nn,Hn.rotation.z-=.6*nn),console.log(`animate 3423isScrolling`,vi);let o=wt.getObjectByName("wraith_animated");!vi&&o!=null&&(o.rotation.y+=.6*nn),Ns&&Ns.update(nn*2),Ds.render(wt,Mn),requestAnimationFrame(Vl)}Vl();function Hl(o,e,t,n=16777215,i=1){const s=new Dl(n,1);return s.position.set(o,e,t),s.intensity=i,wt.add(s),s}function Gl(o,e=8.5,t=.2,n=16777215){const i=new Ri;return i.metalness=e,i.roughness=t,i.normalMap=o,i.color=new Te(n),i}function $g(o,e=1,t=0,n=0,i=0){new ag().load("img/gltf/glb/Wraith_Animated.glb",r=>{o=r.scene,o.scale.set(e,e,e),wt.add(o),o.position.z=i,o.position.y=n,o.position.x=t,o.name="wraith_animated",console.log("Wraith load",o);let a=r.animations;if(a&&a.length){Ns=new ig(o);for(const l of a)Ns.clipAction(l).play()}})}function Jg(){const o=e=>{e.preventDefault(),e.stopPropagation(),console.log(e.target.parentNode.href);let t=e.target.parentNode.href.replace(".dev","");console.log("newurl",t),window.open(t)};document.querySelector("#gmail").addEventListener("click",o)}function Qg(...o){document.dlog=document.dlog||{},document.dlog.output=document.dlog.output||document.querySelector("#output"),document.dlog.output.innerText="";for(const e of o)document.dlog.output.innerText+=e}
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.