diff --git a/CHANGELOG.md b/CHANGELOG.md index f40df165107..27b244bd1b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Updated WGLMakie's threejs version from 0.157 to 0.173, fixing some threejs bugs [#4809](https://github.com/MakieOrg/Makie.jl/pull/4809). - Moved Axis3 clip planes slightly outside to avoid clipping objects on the border with 0 margin [#4742](https://github.com/MakieOrg/Makie.jl/pull/4742) - Fixed an issue with transformations not propagating to child plots when their spaces only match indirectly. [#4723](https://github.com/MakieOrg/Makie.jl/pull/4723) - Added a tutorial on creating an inset plot [#4697](https://github.com/MakieOrg/Makie.jl/pull/4697) diff --git a/WGLMakie/src/Camera.js b/WGLMakie/src/Camera.js index c40a7f24bfe..1b1bef55bfc 100644 --- a/WGLMakie/src/Camera.js +++ b/WGLMakie/src/Camera.js @@ -1,4 +1,4 @@ -import * as THREE from "./THREE.js"; +import * as THREE from "https://cdn.esm.sh/v66/three@0.173/es2021/three.js"; import { OrbitControls } from "./OrbitControls.js"; // Unitless is the scene pixel unit space diff --git a/WGLMakie/src/Lines.js b/WGLMakie/src/Lines.js index 20f185ec591..c0c45ffcfe9 100644 --- a/WGLMakie/src/Lines.js +++ b/WGLMakie/src/Lines.js @@ -6,7 +6,6 @@ import { } from "./Shaders.js"; import { deserialize_uniforms } from "./Serialization.js"; -import { IntType } from "./THREE.js"; function filter_by_key(dict, keys, default_value = false) { const result = {}; diff --git a/WGLMakie/src/OrbitControls.js b/WGLMakie/src/OrbitControls.js index 8a39fcb2332..9b1810096cc 100644 --- a/WGLMakie/src/OrbitControls.js +++ b/WGLMakie/src/OrbitControls.js @@ -11,7 +11,7 @@ import { Plane, Ray, MathUtils, -} from "./THREE.js"; +} from "https://cdn.esm.sh/v66/three@0.173/es2021/three.js"; // OrbitControls performs orbiting, dollying (zooming), and panning. // Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). diff --git a/WGLMakie/src/Serialization.js b/WGLMakie/src/Serialization.js index e1425982644..64715117b00 100644 --- a/WGLMakie/src/Serialization.js +++ b/WGLMakie/src/Serialization.js @@ -1,4 +1,4 @@ -import * as THREE from "./THREE.js"; +import * as THREE from "https://cdn.esm.sh/v66/three@0.173/es2021/three.js"; import * as Camera from "./Camera.js"; import { create_line, create_linesegments } from "./Lines.js"; diff --git a/WGLMakie/src/THREE.js b/WGLMakie/src/THREE.js deleted file mode 100644 index 35d525a5b91..00000000000 --- a/WGLMakie/src/THREE.js +++ /dev/null @@ -1,3588 +0,0 @@ -/* esm.sh - esbuild bundle(three@0.157.0) es2021 production */ -var Hc="157",zx={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Vx={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},kd=0,rl=1,Hd=2,kx=3,Hx=0,cd=1,Gd=2,pn=3,Bn=0,Ft=1,gn=2,Gx=2,Dn=0,Wi=1,al=2,ol=3,cl=4,Wd=5,Bi=100,Xd=101,qd=102,ll=103,hl=104,Yd=200,Zd=201,Jd=202,$d=203,ld=204,hd=205,Kd=206,Qd=207,jd=208,ef=209,tf=210,nf=0,sf=1,rf=2,uo=3,af=4,of=5,cf=6,lf=7,xa=0,hf=1,uf=2,Nn=0,df=1,ff=2,pf=3,mf=4,gf=5,Gc=300,zn=301,ci=302,Ir=303,Ur=304,Vs=306,Dr=1e3,It=1001,Nr=1002,pt=1003,fo=1004,Wx=1004,Lr=1005,Xx=1005,mt=1006,ud=1007,qx=1007,li=1008,Yx=1008,On=1009,_f=1010,xf=1011,Wc=1012,dd=1013,Ln=1014,xn=1015,Ts=1016,fd=1017,pd=1018,ii=1020,vf=1021,Wt=1023,yf=1024,Mf=1025,si=1026,Yi=1027,Sf=1028,md=1029,bf=1030,gd=1031,_d=1033,wa=33776,Aa=33777,Ra=33778,Ca=33779,ul=35840,dl=35841,fl=35842,pl=35843,Ef=36196,ml=37492,gl=37496,_l=37808,xl=37809,vl=37810,yl=37811,Ml=37812,Sl=37813,bl=37814,El=37815,Tl=37816,wl=37817,Al=37818,Rl=37819,Cl=37820,Pl=37821,Pa=36492,Ll=36494,Il=36495,Tf=36283,Ul=36284,Dl=36285,Nl=36286,wf=2200,Af=2201,Rf=2202,Or=2300,Fr=2301,La=2302,zi=2400,Vi=2401,Br=2402,Xc=2500,xd=2501,Zx=0,Jx=1,$x=2,vd=3e3,ri=3001,Cf=3200,Pf=3201,mi=0,Lf=1,Xt="",vt="srgb",Mn="srgb-linear",qc="display-p3",va="display-p3-linear",zr="linear",nt="srgb",Vr="rec709",kr="p3",Kx=0,Ia=7680,Qx=7681,jx=7682,ev=7683,tv=34055,nv=34056,iv=5386,sv=512,rv=513,av=514,ov=515,cv=516,lv=517,hv=518,If=519,Uf=512,Df=513,Nf=514,Of=515,Ff=516,Bf=517,zf=518,Vf=519,Hr=35044,uv=35048,dv=35040,fv=35045,pv=35049,mv=35041,gv=35046,_v=35050,xv=35042,vv="100",Ol="300 es",po=1035,vn=2e3,Gr=2001,sn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let 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;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,a=i.length;r>8&255]+Et[s>>16&255]+Et[s>>24&255]+"-"+Et[e&255]+Et[e>>8&255]+"-"+Et[e>>16&15|64]+Et[e>>24&255]+"-"+Et[t&63|128]+Et[t>>8&255]+"-"+Et[t>>16&255]+Et[t>>24&255]+Et[n&255]+Et[n>>8&255]+Et[n>>16&255]+Et[n>>24&255]).toLowerCase()}function ct(s,e,t){return Math.max(e,Math.min(t,s))}function Yc(s,e){return(s%e+e)%e}function kf(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Hf(s,e,t){return s!==e?(t-s)/(e-s):0}function ys(s,e,t){return(1-t)*s+t*e}function Gf(s,e,t,n){return ys(s,e,1-Math.exp(-t*n))}function Wf(s,e=1){return e-Math.abs(Yc(s,e*2)-e)}function Xf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function qf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Yf(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Zf(s,e){return s+Math.random()*(e-s)}function Jf(s){return s*(.5-Math.random())}function $f(s){s!==void 0&&(Fl=s);let e=Fl+=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 Kf(s){return s*ai}function Qf(s){return s*Zi}function mo(s){return(s&s-1)===0&&s!==0}function yd(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Wr(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function jf(s,e,t,n,i){let r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),f=r((n-e)/2),m=a((n-e)/2);switch(i){case"XYX":s.set(o*h,c*u,c*d,o*l);break;case"YZY":s.set(c*d,o*h,c*u,o*l);break;case"ZXZ":s.set(c*u,c*d,o*h,o*l);break;case"XZX":s.set(o*h,c*m,c*f,o*l);break;case"YXY":s.set(c*f,o*h,c*m,o*l);break;case"ZYZ":s.set(c*m,c*f,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ot(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function Be(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}var yv={DEG2RAD:ai,RAD2DEG:Zi,generateUUID:kt,clamp:ct,euclideanModulo:Yc,mapLinear:kf,inverseLerp:Hf,lerp:ys,damp:Gf,pingpong:Wf,smoothstep:Xf,smootherstep:qf,randInt:Yf,randFloat:Zf,randFloatSpread:Jf,seededRandom:$f,degToRad:Kf,radToDeg:Qf,isPowerOfTwo:mo,ceilPowerOfTwo:yd,floorPowerOfTwo:Wr,setQuaternionFromProperEuler:jf,normalize:Be,denormalize:Ot},Z=class s{constructor(e=0,t=0){s.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){let 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){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ct(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},He=class s{constructor(e,t,n,i,r,a,o,c,l){s.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){let h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],v=i[1],x=i[4],y=i[7],b=i[2],w=i[5],R=i[8];return r[0]=a*_+o*v+c*b,r[3]=a*g+o*x+c*w,r[6]=a*p+o*y+c*R,r[1]=l*_+h*v+u*b,r[4]=l*g+h*x+u*w,r[7]=l*p+h*y+u*R,r[2]=d*_+f*v+m*b,r[5]=d*g+f*x+m*w,r[8]=d*p+f*y+m*R,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,f=l*r-a*c,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/m;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*c)*_,e[5]=(i*r-o*t)*_,e[6]=f*_,e[7]=(n*c-l*t)*_,e[8]=(a*t-n*r)*_,this}transpose(){let e,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){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,o){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Ua.makeScale(e,t)),this}rotate(e){return this.premultiply(Ua.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ua.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let 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){let 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){let 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)}},Ua=new He;function Md(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}var ep={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ki(s,e){return new ep[s](e)}function ws(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function tp(){let s=ws("canvas");return s.style.display="block",s}var Bl={};function Ms(s){s in Bl||(Bl[s]=!0,console.warn(s))}var zl=new He().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Vl=new He().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Gs={[Mn]:{transfer:zr,primaries:Vr,toReference:s=>s,fromReference:s=>s},[vt]:{transfer:nt,primaries:Vr,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[va]:{transfer:zr,primaries:kr,toReference:s=>s.applyMatrix3(Vl),fromReference:s=>s.applyMatrix3(zl)},[qc]:{transfer:nt,primaries:kr,toReference:s=>s.convertSRGBToLinear().applyMatrix3(Vl),fromReference:s=>s.applyMatrix3(zl).convertLinearToSRGB()}},np=new Set([Mn,va]),Qe={enabled:!0,_workingColorSpace:Mn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(s){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!s},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!np.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;let n=Gs[e].toReference,i=Gs[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return Gs[s].primaries},getTransfer:function(s){return s===Xt?zr:Gs[s].transfer}};function Xi(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Da(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var gi,Xr=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{gi===void 0&&(gi=ws("canvas")),gi.width=e.width,gi.height=e.height;let n=gi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=gi}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){let t=ws("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Gc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Dr:e.x=e.x-Math.floor(e.x);break;case It:e.x=e.x<0?0:1;break;case Nr: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 Dr:e.y=e.y-Math.floor(e.y);break;case It:e.y=e.y<0?0:1;break;case Nr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Ms("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===vt?ri:vd}set encoding(e){Ms("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===ri?vt:Xt}};St.DEFAULT_IMAGE=null;St.DEFAULT_MAPPING=Gc;St.DEFAULT_ANISOTROPY=1;var je=class s{constructor(e=0,t=0,n=0,i=1){s.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],m=c[9],_=c[2],g=c[6],p=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let x=(l+1)/2,y=(f+1)/2,b=(p+1)/2,w=(h+d)/4,R=(u+_)/4,I=(m+g)/4;return x>y&&x>b?x<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(x),i=w/n,r=R/n):y>b?y<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=w/i,r=I/i):b<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(b),n=R/r,i=I/r),this.set(n,i,r,t),this}let v=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(u-_)/v,this.z=(d-h)/v,this.w=Math.acos((l+f+p-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){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},go=class extends sn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new je(0,0,e,t),this.scissorTest=!1,this.viewport=new je(0,0,e,t);let i={width:e,height:t,depth:1};n.encoding!==void 0&&(Ms("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===ri?vt:Xt),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:mt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new St(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new In(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"})}},qt=class extends go{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},As=class extends St{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=pt,this.minFilter=pt,this.wrapR=It,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},kl=class extends qt{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new As(null,e,t,n),this.texture.isRenderTargetTexture=!0}},qr=class extends St{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=pt,this.minFilter=pt,this.wrapR=It,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Hl=class extends qt{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new qr(null,e,t,n),this.texture.isRenderTargetTexture=!0}},Gl=class extends qt{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;let r=this.texture;this.texture=[];for(let a=0;a=0?1:-1,x=1-p*p;if(x>Number.EPSILON){let b=Math.sqrt(x),w=Math.atan2(b,p*v);g=Math.sin(g*w)/b,o=Math.sin(o*w)/b}let y=o*v;if(c=c*g+d*y,l=l*g+f*y,h=h*g+m*y,u=u*g+_*y,g===1-o){let b=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=b,l*=b,h*=b,u*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){let o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a],d=r[a+1],f=r[a+2],m=r[a+3];return e[t]=o*m+h*u+c*f-l*d,e[t+1]=c*m+h*d+l*u-o*f,e[t+2]=l*m+h*f+o*d-c*u,e[t+3]=h*m-o*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(r/2),d=c(n/2),f=c(i/2),m=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u+d*f*m;break;case"YZX":this._x=d*h*u+l*f*m,this._y=l*f*u+d*h*m,this._z=l*h*m-d*f*u,this._w=l*h*u-d*f*m;break;case"XZY":this._x=d*h*u-l*f*m,this._y=l*f*u-d*h*m,this._z=l*h*m+d*f*u,this._w=l*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(r-l)*f,this._z=(a-i)*f}else if(n>o&&n>u){let f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>u){let f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+h)/f}else{let f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(r+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.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(ct(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let 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){let n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+i*l-r*c,this._y=i*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},A=class s{constructor(e=0,t=0,n=0){s.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(Wl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wl.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=c*t+a*i-o*n,h=c*n+o*t-r*i,u=c*i+r*n-a*t,d=-r*t-a*n-o*i;return this.x=l*c+d*-r+h*-o-u*-a,this.y=h*c+d*-a+u*-r-l*-o,this.z=u*c+d*-o+l*-a-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Oa.copy(this).projectOnVector(e),this.sub(Oa)}reflect(e){return this.sub(Oa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(ct(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let 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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let 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(){let 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}},Oa=new A,Wl=new Ut,Qt=class{constructor(e=new A(1/0,1/0,1/0),t=new A(-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;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,cn),cn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(cs),Ws.subVectors(this.max,cs),xi.subVectors(e.a,cs),vi.subVectors(e.b,cs),yi.subVectors(e.c,cs),Tn.subVectors(vi,xi),wn.subVectors(yi,vi),Wn.subVectors(xi,yi);let t=[0,-Tn.z,Tn.y,0,-wn.z,wn.y,0,-Wn.z,Wn.y,Tn.z,0,-Tn.x,wn.z,0,-wn.x,Wn.z,0,-Wn.x,-Tn.y,Tn.x,0,-wn.y,wn.x,0,-Wn.y,Wn.x,0];return!Fa(t,xi,vi,yi,Ws)||(t=[1,0,0,0,1,0,0,0,1],!Fa(t,xi,vi,yi,Ws))?!1:(Xs.crossVectors(Tn,wn),t=[Xs.x,Xs.y,Xs.z],Fa(t,xi,vi,yi,Ws))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,cn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(cn).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),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)}},on=[new A,new A,new A,new A,new A,new A,new A,new A],cn=new A,_i=new Qt,xi=new A,vi=new A,yi=new A,Tn=new A,wn=new A,Wn=new A,cs=new A,Ws=new A,Xs=new A,Xn=new A;function Fa(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Xn.fromArray(s,r);let o=i.x*Math.abs(Xn.x)+i.y*Math.abs(Xn.y)+i.z*Math.abs(Xn.z),c=e.dot(Xn),l=t.dot(Xn),h=n.dot(Xn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var rp=new Qt,ls=new A,Ba=new A,Yt=class{constructor(e=new A,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):rp.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;rthis.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;ls.subVectors(e,this.center);let t=ls.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ls,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):(Ba.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ls.copy(e.center).add(Ba)),this.expandByPoint(ls.copy(e.center).sub(Ba))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},ln=new A,za=new A,qs=new A,An=new A,Va=new A,Ys=new A,ka=new A,hi=class{constructor(e=new A,t=new A(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,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){za.copy(e).add(t).multiplyScalar(.5),qs.copy(t).sub(e).normalize(),An.copy(this.origin).sub(za);let r=e.distanceTo(t)*.5,a=-this.direction.dot(qs),o=An.dot(this.direction),c=-An.dot(qs),l=An.lengthSq(),h=Math.abs(1-a*a),u,d,f,m;if(h>0)if(u=a*c-o,d=a*o-c,m=r*h,u>=0)if(d>=-m)if(d<=m){let _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d<=-m?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l):d<=m?(u=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),f=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(za).addScaledVector(qs,d),f}intersectSphere(e,t){ln.subVectors(e.center,this.origin);let n=ln.dot(this.direction),i=ln.dot(ln)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,n,i,r){Va.subVectors(t,e),Ys.subVectors(n,e),ka.crossVectors(Va,Ys);let a=this.direction.dot(ka),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;An.subVectors(this.origin,e);let c=o*this.direction.dot(Ys.crossVectors(An,Ys));if(c<0)return null;let l=o*this.direction.dot(Va.cross(An));if(l<0||c+l>a)return null;let h=-o*An.dot(ka);return h<0?null:this.at(h/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ze=class s{constructor(e,t,n,i,r,a,o,c,l,h,u,d,f,m,_,g){s.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l,h,u,d,f,m,_,g)}set(e,t,n,i,r,a,o,c,l,h,u,d,f,m,_,g){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 s().fromArray(this.elements)}copy(e){let 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){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let 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){let t=this.elements,n=e.elements,i=1/Mi.setFromMatrixColumn(e,0).length(),r=1/Mi.setFromMatrixColumn(e,1).length(),a=1/Mi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let d=a*h,f=a*u,m=o*h,_=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+m*l,t[5]=d-_*l,t[9]=-o*c,t[2]=_-d*l,t[6]=m+f*l,t[10]=a*c}else if(e.order==="YXZ"){let d=c*h,f=c*u,m=l*h,_=l*u;t[0]=d+_*o,t[4]=m*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-m,t[6]=_+d*o,t[10]=a*c}else if(e.order==="ZXY"){let d=c*h,f=c*u,m=l*h,_=l*u;t[0]=d-_*o,t[4]=-a*u,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){let d=a*h,f=a*u,m=o*h,_=o*u;t[0]=c*h,t[4]=m*l-f,t[8]=d*l+_,t[1]=c*u,t[5]=_*l+d,t[9]=f*l-m,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){let d=a*c,f=a*l,m=o*c,_=o*l;t[0]=c*h,t[4]=_-d*u,t[8]=m*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+m,t[10]=d-_*u}else if(e.order==="XZY"){let d=a*c,f=a*l,m=o*c,_=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+_,t[5]=a*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=o*h,t[10]=_*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ap,e,op)}lookAt(e,t,n){let i=this.elements;return zt.subVectors(e,t),zt.lengthSq()===0&&(zt.z=1),zt.normalize(),Rn.crossVectors(n,zt),Rn.lengthSq()===0&&(Math.abs(n.z)===1?zt.x+=1e-4:zt.z+=1e-4,zt.normalize(),Rn.crossVectors(n,zt)),Rn.normalize(),Zs.crossVectors(zt,Rn),i[0]=Rn.x,i[4]=Zs.x,i[8]=zt.x,i[1]=Rn.y,i[5]=Zs.y,i[9]=zt.y,i[2]=Rn.z,i[6]=Zs.z,i[10]=zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],v=n[3],x=n[7],y=n[11],b=n[15],w=i[0],R=i[4],I=i[8],M=i[12],T=i[1],O=i[5],Y=i[9],$=i[13],U=i[2],z=i[6],q=i[10],H=i[14],ne=i[3],W=i[7],K=i[11],D=i[15];return r[0]=a*w+o*T+c*U+l*ne,r[4]=a*R+o*O+c*z+l*W,r[8]=a*I+o*Y+c*q+l*K,r[12]=a*M+o*$+c*H+l*D,r[1]=h*w+u*T+d*U+f*ne,r[5]=h*R+u*O+d*z+f*W,r[9]=h*I+u*Y+d*q+f*K,r[13]=h*M+u*$+d*H+f*D,r[2]=m*w+_*T+g*U+p*ne,r[6]=m*R+_*O+g*z+p*W,r[10]=m*I+_*Y+g*q+p*K,r[14]=m*M+_*$+g*H+p*D,r[3]=v*w+x*T+y*U+b*ne,r[7]=v*R+x*O+y*z+b*W,r[11]=v*I+x*Y+y*q+b*K,r[15]=v*M+x*$+y*H+b*D,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],_=e[7],g=e[11],p=e[15];return m*(+r*c*u-i*l*u-r*o*d+n*l*d+i*o*f-n*c*f)+_*(+t*c*f-t*l*d+r*a*d-i*a*f+i*l*h-r*c*h)+g*(+t*l*u-t*o*f-r*a*u+n*a*f+r*o*h-n*l*h)+p*(-i*o*h-t*c*u+t*o*d+i*a*u-n*a*d+n*c*h)}transpose(){let e=this.elements,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){let 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(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],_=e[13],g=e[14],p=e[15],v=u*g*l-_*d*l+_*c*f-o*g*f-u*c*p+o*d*p,x=m*d*l-h*g*l-m*c*f+a*g*f+h*c*p-a*d*p,y=h*_*l-m*u*l+m*o*f-a*_*f-h*o*p+a*u*p,b=m*u*c-h*_*c-m*o*d+a*_*d+h*o*g-a*u*g,w=t*v+n*x+i*y+r*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let R=1/w;return e[0]=v*R,e[1]=(_*d*r-u*g*r-_*i*f+n*g*f+u*i*p-n*d*p)*R,e[2]=(o*g*r-_*c*r+_*i*l-n*g*l-o*i*p+n*c*p)*R,e[3]=(u*c*r-o*d*r-u*i*l+n*d*l+o*i*f-n*c*f)*R,e[4]=x*R,e[5]=(h*g*r-m*d*r+m*i*f-t*g*f-h*i*p+t*d*p)*R,e[6]=(m*c*r-a*g*r-m*i*l+t*g*l+a*i*p-t*c*p)*R,e[7]=(a*d*r-h*c*r+h*i*l-t*d*l-a*i*f+t*c*f)*R,e[8]=y*R,e[9]=(m*u*r-h*_*r-m*n*f+t*_*f+h*n*p-t*u*p)*R,e[10]=(a*_*r-m*o*r+m*n*l-t*_*l-a*n*p+t*o*p)*R,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*f-t*o*f)*R,e[12]=b*R,e[13]=(h*_*i-m*u*i+m*n*d-t*_*d-h*n*g+t*u*g)*R,e[14]=(m*o*i-a*_*i-m*n*c+t*_*c+a*n*g-t*o*g)*R,e[15]=(a*u*i-h*o*i+h*n*c-t*u*c-a*n*d+t*o*d)*R,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let 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){let 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){let 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){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,f=r*h,m=r*u,_=a*h,g=a*u,p=o*u,v=c*l,x=c*h,y=c*u,b=n.x,w=n.y,R=n.z;return i[0]=(1-(_+p))*b,i[1]=(f+y)*b,i[2]=(m-x)*b,i[3]=0,i[4]=(f-y)*w,i[5]=(1-(d+p))*w,i[6]=(g+v)*w,i[7]=0,i[8]=(m+x)*R,i[9]=(g-v)*R,i[10]=(1-(d+_))*R,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,r=Mi.set(i[0],i[1],i[2]).length(),a=Mi.set(i[4],i[5],i[6]).length(),o=Mi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],$t.copy(this);let l=1/r,h=1/a,u=1/o;return $t.elements[0]*=l,$t.elements[1]*=l,$t.elements[2]*=l,$t.elements[4]*=h,$t.elements[5]*=h,$t.elements[6]*=h,$t.elements[8]*=u,$t.elements[9]*=u,$t.elements[10]*=u,t.setFromRotationMatrix($t),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=vn){let c=this.elements,l=2*r/(t-e),h=2*r/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i),f,m;if(o===vn)f=-(a+r)/(a-r),m=-2*a*r/(a-r);else if(o===Gr)f=-a/(a-r),m=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=vn){let c=this.elements,l=1/(t-e),h=1/(n-i),u=1/(a-r),d=(t+e)*l,f=(n+i)*h,m,_;if(o===vn)m=(a+r)*u,_=-2*u;else if(o===Gr)m=r*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-f,c[2]=0,c[6]=0,c[10]=_,c[14]=-m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let 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){let 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}},Mi=new A,$t=new ze,ap=new A(0,0,0),op=new A(1,1,1),Rn=new A,Zs=new A,zt=new A,Xl=new ze,ql=new Ut,Yr=class s{constructor(e=0,t=0,n=0,i=s.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){let i=e.elements,r=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ct(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(ct(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-ct(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ct(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Xl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Xl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ql.setFromEuler(this),this.setFromQuaternion(ql,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}};Yr.DEFAULT_ORDER="XYZ";var Rs=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(a))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(hs,e,lp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(hs,hp,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n0&&(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 r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){let c=[];for(let l in o){let h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Kt.subVectors(i,t),un.subVectors(n,t),Ha.subVectors(e,t);let a=Kt.dot(Kt),o=Kt.dot(un),c=Kt.dot(Ha),l=un.dot(un),h=un.dot(Ha),u=a*l-o*o;if(u===0)return r.set(-2,-1,-1);let d=1/u,f=(l*c-o*h)*d,m=(a*h-o*c)*d;return r.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,dn),dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getUV(e,t,n,i,r,a,o,c){return $s===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),$s=!0),this.getInterpolation(e,t,n,i,r,a,o,c)}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,dn),c.setScalar(0),c.addScaledVector(r,dn.x),c.addScaledVector(a,dn.y),c.addScaledVector(o,dn.z),c}static isFrontFacing(e,t,n,i){return Kt.subVectors(n,t),un.subVectors(e,t),Kt.cross(un).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 Kt.subVectors(this.c,this.b),un.subVectors(this.a,this.b),Kt.cross(un).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return s.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return s.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return $s===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),$s=!0),s.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}getInterpolation(e,t,n,i,r){return s.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return s.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return s.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,r=this.c,a,o;bi.subVectors(i,n),Ei.subVectors(r,n),Ga.subVectors(e,n);let c=bi.dot(Ga),l=Ei.dot(Ga);if(c<=0&&l<=0)return t.copy(n);Wa.subVectors(e,i);let h=bi.dot(Wa),u=Ei.dot(Wa);if(h>=0&&u<=h)return t.copy(i);let d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(bi,a);Xa.subVectors(e,r);let f=bi.dot(Xa),m=Ei.dot(Xa);if(m>=0&&f<=m)return t.copy(r);let _=f*l-c*m;if(_<=0&&l>=0&&m<=0)return o=l/(l-m),t.copy(n).addScaledVector(Ei,o);let g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return Kl.subVectors(r,i),o=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(Kl,o);let p=1/(g+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(bi,a).addScaledVector(Ei,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},fp=0,bt=class extends sn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fp++}),this.uuid=kt(),this.name="",this.type="Material",this.blending=Wi,this.side=Bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ld,this.blendDst=hd,this.blendEquation=Bi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=uo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=If,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ia,this.stencilZFail=Ia,this.stencilZPass=Ia,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(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let 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){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Wi&&(n.blending=this.blending),this.side!==Bn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),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.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(t){let r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Sd={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},Cn={h:0,s:0,l:0},Ks={h:0,s:0,l:0};function qa(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var pe=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=vt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Qe.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Qe.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Qe.workingColorSpace){if(e=Yc(e,1),t=ct(t,0,1),n=ct(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=qa(a,r,e+1/3),this.g=qa(a,r,e),this.b=qa(a,r,e-1/3)}return Qe.toWorkingColorSpace(this,i),this}setStyle(e,t=vt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=vt){let n=Sd[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=Xi(e.r),this.g=Xi(e.g),this.b=Xi(e.b),this}copyLinearToSRGB(e){return this.r=Da(e.r),this.g=Da(e.g),this.b=Da(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vt){return Qe.fromWorkingColorSpace(Tt.copy(this),e),Math.round(ct(Tt.r*255,0,255))*65536+Math.round(ct(Tt.g*255,0,255))*256+Math.round(ct(Tt.b*255,0,255))}getHexString(e=vt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Qe.workingColorSpace){Qe.fromWorkingColorSpace(Tt.copy(this),t);let n=Tt.r,i=Tt.g,r=Tt.b,a=Math.max(n,i,r),o=Math.min(n,i,r),c,l,h=(o+a)/2;if(o===a)c=0,l=0;else{let u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}let r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;!(l&8388608);)l<<=1,h-=8388608;l&=-8388609,h+=947912704,r[c]=l|h}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:a,offsetTable:o}}function Nt(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=ct(s,-65504,65504),_n.floatView[0]=s;let e=_n.uint32View[0],t=e>>23&511;return _n.baseTable[t]+((e&8388607)>>_n.shiftTable[t])}function xs(s){let e=s>>10;return _n.uint32View[0]=_n.mantissaTable[_n.offsetTable[e]+(s&1023)]+_n.exponentTable[e],_n.floatView[0]}var Mv={toHalfFloat:Nt,fromHalfFloat:xs},ft=new A,Qs=new Z,et=class{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=Hr,this.updateRange={offset:0,count:-1},this.gpuType=xn,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.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u0&&(i[c]=h,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let l in i){let h=i[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let d=0,f=u.length;d0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r(e.far-e.near)**2))&&(rh.copy(r).invert(),qn.copy(e.ray).applyMatrix4(rh),!(n.boundingBox!==null&&qn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,qn)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){let g=d[m],p=a[g.materialIndex],v=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let y=v,b=x;yt.far?null:{distance:l,point:rr.clone(),object:s}}function ar(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,wi),s.getVertexPosition(c,Ai),s.getVertexPosition(l,Ri);let h=gp(s,e,t,n,wi,Ai,Ri,sr);if(h){i&&(tr.fromBufferAttribute(i,o),nr.fromBufferAttribute(i,c),ir.fromBufferAttribute(i,l),h.uv=Un.getInterpolation(sr,wi,Ai,Ri,tr,nr,ir,new Z)),r&&(tr.fromBufferAttribute(r,o),nr.fromBufferAttribute(r,c),ir.fromBufferAttribute(r,l),h.uv1=Un.getInterpolation(sr,wi,Ai,Ri,tr,nr,ir,new Z),h.uv2=h.uv1),a&&(oh.fromBufferAttribute(a,o),ch.fromBufferAttribute(a,c),lh.fromBufferAttribute(a,l),h.normal=Un.getInterpolation(sr,wi,Ai,Ri,oh,ch,lh,new A),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:c,c:l,normal:new A,materialIndex:0};Un.getNormal(wi,Ai,Ri,u.normal),h.face=u}return h}var Ji=class s extends Ge{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};let o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],h=[],u=[],d=0,f=0;m("z","y","x",-1,-1,n,t,e,a,r,0),m("z","y","x",1,-1,n,t,-e,a,r,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,r,4),m("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new ve(l,3)),this.setAttribute("normal",new ve(h,3)),this.setAttribute("uv",new ve(u,2));function m(_,g,p,v,x,y,b,w,R,I,M){let T=y/R,O=b/I,Y=y/2,$=b/2,U=w/2,z=R+1,q=I+1,H=0,ne=0,W=new A;for(let K=0;K0?1:-1,h.push(W.x,W.y,W.z),u.push(G/R),u.push(1-K/I),H+=1}}for(let K=0;K0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},Cs=class extends Je{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze,this.coordinateSystem=vn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},yt=class extends Cs{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){let t=.5*this.getFilmHeight()/e;this.fov=Zi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ai*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Zi*2*Math.atan(Math.tan(ai*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(ai*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},Ci=-90,Pi=1,_o=class extends Je{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new yt(Ci,Pi,e,t);i.layers=this.layers,this.add(i);let r=new yt(Ci,Pi,e,t);r.layers=this.layers,this.add(r);let a=new yt(Ci,Pi,e,t);a.layers=this.layers,this.add(a);let o=new yt(Ci,Pi,e,t);o.layers=this.layers,this.add(o);let c=new yt(Ci,Pi,e,t);c.layers=this.layers,this.add(c);let l=new yt(Ci,Pi,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(let l of t)this.remove(l);if(e===vn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Gr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}},Ki=class extends St{constructor(e,t,n,i,r,a,o,c,l,h){e=e!==void 0?e:[],t=t!==void 0?t:zn,super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},xo=class extends qt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Ms("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===ri?vt:Xt),this.texture=new Ki(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:mt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},i=new Ji(5,5,5),r=new jt({name:"CubemapFromEquirect",uniforms:$i(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ft,blending:Dn});r.uniforms.tEquirect.value=t;let a=new Mt(i,r),o=t.minFilter;return t.minFilter===li&&(t.minFilter=mt),new _o(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){let r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}},Ja=new A,Mp=new A,Sp=new He,mn=class{constructor(e=new A(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Ja.subVectors(n,t).cross(Mp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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){let n=e.delta(Ja),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){let 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){let n=t||Sp.getNormalMatrix(e),i=this.coplanarPoint(Ja).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Yn=new Yt,or=new A,Ps=class{constructor(e=new mn,t=new mn,n=new mn,i=new mn,r=new mn,a=new mn){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=vn){let n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],c=i[3],l=i[4],h=i[5],u=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],v=i[13],x=i[14],y=i[15];if(n[0].setComponents(c-r,d-l,g-f,y-p).normalize(),n[1].setComponents(c+r,d+l,g+f,y+p).normalize(),n[2].setComponents(c+a,d+h,g+m,y+v).normalize(),n[3].setComponents(c-a,d-h,g-m,y-v).normalize(),n[4].setComponents(c-o,d-u,g-_,y-x).normalize(),t===vn)n[5].setComponents(c+o,d+u,g+_,y+x).normalize();else if(t===Gr)n[5].setComponents(o,u,_,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Yn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Yn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Yn)}intersectsSprite(e){return Yn.center.set(0,0,0),Yn.radius=.7071067811865476,Yn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yn)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,or.y=i.normal.y>0?e.max.y:e.min.y,or.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(or)<0)return!1}return!0}containsPoint(e){let 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 Ed(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function bp(s,e){let t=e.isWebGL2,n=new WeakMap;function i(l,h){let u=l.array,d=l.usage,f=s.createBuffer();s.bindBuffer(h,f),s.bufferData(h,u,d),l.onUploadCallback();let m;if(u instanceof Float32Array)m=s.FLOAT;else if(u instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)m=s.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=s.UNSIGNED_SHORT;else if(u instanceof Int16Array)m=s.SHORT;else if(u instanceof Uint32Array)m=s.UNSIGNED_INT;else if(u instanceof Int32Array)m=s.INT;else if(u instanceof Int8Array)m=s.BYTE;else if(u instanceof Uint8Array)m=s.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)m=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:f,type:m,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,h,u){let d=h.array,f=h.updateRange;s.bindBuffer(u,l),f.count===-1?s.bufferSubData(u,0,d):(t?s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):s.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1),h.onUploadCallback()}function a(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function o(l){l.isInterleavedBufferAttribute&&(l=l.data);let h=n.get(l);h&&(s.deleteBuffer(h.buffer),n.delete(l))}function c(l,h){if(l.isGLBufferAttribute){let d=n.get(l);(!d||d.version 0 - vec4 plane; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif -#endif`,Bp=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,zp=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,Vp=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,kp=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,Hp=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,Gp=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,Wp=`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`,Xp=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); - return dot( weights, rgb ); -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,qp=`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_v0 0.339 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_v1 0.276 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_v4 0.046 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_v5 0.016 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_v6 0.0038 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,Yp=`vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,Zp=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,Jp=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,$p=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Kp=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,Qp="gl_FragColor = linearToOutputTexel( gl_FragColor );",jp=` -const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( - vec3( 0.8224621, 0.177538, 0.0 ), - vec3( 0.0331941, 0.9668058, 0.0 ), - vec3( 0.0170827, 0.0723974, 0.9105199 ) -); -const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( - vec3( 1.2249401, - 0.2249404, 0.0 ), - vec3( - 0.0420569, 1.0420571, 0.0 ), - vec3( - 0.0196376, - 0.0786361, 1.0982735 ) -); -vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { - return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); -} -vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { - return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); -} -vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferOETF( in vec4 value ) { - 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 ); -} -vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( in vec4 value ) { - return sRGBTransferOETF( value ); -}`,em=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,tm=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,nm=`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,im=`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,sm=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,rm=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,am=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,om=`#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,cm=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,lm=`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`,hm=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,um=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,dm=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,fm=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,pm=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - #if defined ( LEGACY_LIGHTS ) - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #else - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #endif -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,mm=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,gm=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,_m=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,xm=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,vm=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ym=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y; -#endif`,Mm=`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = vec3( 0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void 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 ) { -#else -void 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 ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,Sm=` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal; -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,bm=`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,Em=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Tm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,wm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,Am=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,Rm=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`,Cm=`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - 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 ); - - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,Pm=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,Lm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Im=`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,Um=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,Dm=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,Nm=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,Om=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`,Fm=`#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`,Bm=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`,zm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,Vm=`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,km=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,Hm=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,Gm=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,Wm=`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,Xm=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,qm=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Ym=`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,Zm=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,Jm=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,$m=`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; -const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec2 packDepthToRG( in highp float v ) { - return packDepthToRGBA( v ).yx; -} -float unpackRGToDepth( const in highp vec2 v ) { - return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); -} -vec4 pack2HalfToRGBA( vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,Km=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Qm=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,jm=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,eg=`#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`,tg=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,ng=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,ig=`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - 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 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return shadow; - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`,sg=`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,rg=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,ag=`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,og=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,cg=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`,lg=`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,hg=`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,ug=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,dg=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,fg=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,pg=`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 OptimizedCineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,mg=`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,gg=`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,_g=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,xg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,vg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,yg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`,Mg=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Sg=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - 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 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,bg=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,Eg=`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,Tg=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,wg=`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,Ag=`#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,Rg=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #endif -}`,Cg=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,Pg=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,Lg=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,Ig=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,Ug=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,Dg=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,Ng=`#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,Og=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,Fg=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,Bg=`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,zg=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,Vg=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,kg=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,Hg=`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,Gg=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,Wg=`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,Xg=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,qg=`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,Yg=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,Zg=`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,Jg=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,$g=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,Kg=`#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,Qg=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,jg=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,e_=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,ke={alphahash_fragment:Ep,alphahash_pars_fragment:Tp,alphamap_fragment:wp,alphamap_pars_fragment:Ap,alphatest_fragment:Rp,alphatest_pars_fragment:Cp,aomap_fragment:Pp,aomap_pars_fragment:Lp,begin_vertex:Ip,beginnormal_vertex:Up,bsdfs:Dp,iridescence_fragment:Np,bumpmap_pars_fragment:Op,clipping_planes_fragment:Fp,clipping_planes_pars_fragment:Bp,clipping_planes_pars_vertex:zp,clipping_planes_vertex:Vp,color_fragment:kp,color_pars_fragment:Hp,color_pars_vertex:Gp,color_vertex:Wp,common:Xp,cube_uv_reflection_fragment:qp,defaultnormal_vertex:Yp,displacementmap_pars_vertex:Zp,displacementmap_vertex:Jp,emissivemap_fragment:$p,emissivemap_pars_fragment:Kp,colorspace_fragment:Qp,colorspace_pars_fragment:jp,envmap_fragment:em,envmap_common_pars_fragment:tm,envmap_pars_fragment:nm,envmap_pars_vertex:im,envmap_physical_pars_fragment:mm,envmap_vertex:sm,fog_vertex:rm,fog_pars_vertex:am,fog_fragment:om,fog_pars_fragment:cm,gradientmap_pars_fragment:lm,lightmap_fragment:hm,lightmap_pars_fragment:um,lights_lambert_fragment:dm,lights_lambert_pars_fragment:fm,lights_pars_begin:pm,lights_toon_fragment:gm,lights_toon_pars_fragment:_m,lights_phong_fragment:xm,lights_phong_pars_fragment:vm,lights_physical_fragment:ym,lights_physical_pars_fragment:Mm,lights_fragment_begin:Sm,lights_fragment_maps:bm,lights_fragment_end:Em,logdepthbuf_fragment:Tm,logdepthbuf_pars_fragment:wm,logdepthbuf_pars_vertex:Am,logdepthbuf_vertex:Rm,map_fragment:Cm,map_pars_fragment:Pm,map_particle_fragment:Lm,map_particle_pars_fragment:Im,metalnessmap_fragment:Um,metalnessmap_pars_fragment:Dm,morphcolor_vertex:Nm,morphnormal_vertex:Om,morphtarget_pars_vertex:Fm,morphtarget_vertex:Bm,normal_fragment_begin:zm,normal_fragment_maps:Vm,normal_pars_fragment:km,normal_pars_vertex:Hm,normal_vertex:Gm,normalmap_pars_fragment:Wm,clearcoat_normal_fragment_begin:Xm,clearcoat_normal_fragment_maps:qm,clearcoat_pars_fragment:Ym,iridescence_pars_fragment:Zm,opaque_fragment:Jm,packing:$m,premultiplied_alpha_fragment:Km,project_vertex:Qm,dithering_fragment:jm,dithering_pars_fragment:eg,roughnessmap_fragment:tg,roughnessmap_pars_fragment:ng,shadowmap_pars_fragment:ig,shadowmap_pars_vertex:sg,shadowmap_vertex:rg,shadowmask_pars_fragment:ag,skinbase_vertex:og,skinning_pars_vertex:cg,skinning_vertex:lg,skinnormal_vertex:hg,specularmap_fragment:ug,specularmap_pars_fragment:dg,tonemapping_fragment:fg,tonemapping_pars_fragment:pg,transmission_fragment:mg,transmission_pars_fragment:gg,uv_pars_fragment:_g,uv_pars_vertex:xg,uv_vertex:vg,worldpos_vertex:yg,background_vert:Mg,background_frag:Sg,backgroundCube_vert:bg,backgroundCube_frag:Eg,cube_vert:Tg,cube_frag:wg,depth_vert:Ag,depth_frag:Rg,distanceRGBA_vert:Cg,distanceRGBA_frag:Pg,equirect_vert:Lg,equirect_frag:Ig,linedashed_vert:Ug,linedashed_frag:Dg,meshbasic_vert:Ng,meshbasic_frag:Og,meshlambert_vert:Fg,meshlambert_frag:Bg,meshmatcap_vert:zg,meshmatcap_frag:Vg,meshnormal_vert:kg,meshnormal_frag:Hg,meshphong_vert:Gg,meshphong_frag:Wg,meshphysical_vert:Xg,meshphysical_frag:qg,meshtoon_vert:Yg,meshtoon_frag:Zg,points_vert:Jg,points_frag:$g,shadow_vert:Kg,shadow_frag:Qg,sprite_vert:jg,sprite_frag:e_},le={common:{diffuse:{value:new pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new He},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new He}},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 He}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new He}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new He},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new He},normalScale:{value:new Z(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new He},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new He}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new He}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new He}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pe(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 pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0},uvTransform:{value:new He}},sprite:{diffuse:{value:new pe(16777215)},opacity:{value:1},center:{value:new Z(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new He},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0}}},nn={basic:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new pe(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:Lt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:Lt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new pe(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:Lt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:Lt([le.points,le.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:Lt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:Lt([le.common,le.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:Lt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:Lt([le.sprite,le.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new He},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:Lt([le.common,le.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:Lt([le.lights,le.fog,{color:{value:new pe(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};nn.physical={uniforms:Lt([nn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new He},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new He},clearcoatNormalScale:{value:new Z(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new He},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new He},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new He},sheen:{value:0},sheenColor:{value:new pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new He},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new He},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new He},transmissionSamplerSize:{value:new Z},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new He},attenuationDistance:{value:0},attenuationColor:{value:new pe(0)},specularColor:{value:new pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new He},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new He},anisotropyVector:{value:new Z},anisotropyMap:{value:null},anisotropyMapTransform:{value:new He}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};var cr={r:0,b:0,g:0};function t_(s,e,t,n,i,r,a){let o=new pe(0),c=r===!0?0:1,l,h,u=null,d=0,f=null;function m(g,p){let v=!1,x=p.isScene===!0?p.background:null;x&&x.isTexture&&(x=(p.backgroundBlurriness>0?t:e).get(x)),x===null?_(o,c):x&&x.isColor&&(_(x,1),v=!0);let y=s.xr.getEnvironmentBlendMode();y==="additive"?n.buffers.color.setClear(0,0,0,1,a):y==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||v)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Vs)?(h===void 0&&(h=new Mt(new Ji(1,1,1),new jt({name:"BackgroundCubeMaterial",uniforms:$i(nn.backgroundCube.uniforms),vertexShader:nn.backgroundCube.vertexShader,fragmentShader:nn.backgroundCube.fragmentShader,side:Ft,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(b,w,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,h.material.toneMapped=Qe.getTransfer(x.colorSpace)!==nt,(u!==x||d!==x.version||f!==s.toneMapping)&&(h.material.needsUpdate=!0,u=x,d=x.version,f=s.toneMapping),h.layers.enableAll(),g.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(l===void 0&&(l=new Mt(new $r(2,2),new jt({name:"BackgroundMaterial",uniforms:$i(nn.background.uniforms),vertexShader:nn.background.vertexShader,fragmentShader:nn.background.fragmentShader,side:Bn,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=x,l.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,l.material.toneMapped=Qe.getTransfer(x.colorSpace)!==nt,x.matrixAutoUpdate===!0&&x.updateMatrix(),l.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||f!==s.toneMapping)&&(l.material.needsUpdate=!0,u=x,d=x.version,f=s.toneMapping),l.layers.enableAll(),g.unshift(l,l.geometry,l.material,0,0,null))}function _(g,p){g.getRGB(cr,bd(s)),n.buffers.color.setClear(cr.r,cr.g,cr.b,p,a)}return{getClearColor:function(){return o},setClearColor:function(g,p=1){o.set(g),c=p,_(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(g){c=g,_(o,c)},render:m}}function n_(s,e,t,n){let i=s.getParameter(s.MAX_VERTEX_ATTRIBS),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||r!==null,o={},c=g(null),l=c,h=!1;function u(U,z,q,H,ne){let W=!1;if(a){let K=_(H,q,z);l!==K&&(l=K,f(l.object)),W=p(U,H,q,ne),W&&v(U,H,q,ne)}else{let K=z.wireframe===!0;(l.geometry!==H.id||l.program!==q.id||l.wireframe!==K)&&(l.geometry=H.id,l.program=q.id,l.wireframe=K,W=!0)}ne!==null&&t.update(ne,s.ELEMENT_ARRAY_BUFFER),(W||h)&&(h=!1,I(U,z,q,H),ne!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t.get(ne).buffer))}function d(){return n.isWebGL2?s.createVertexArray():r.createVertexArrayOES()}function f(U){return n.isWebGL2?s.bindVertexArray(U):r.bindVertexArrayOES(U)}function m(U){return n.isWebGL2?s.deleteVertexArray(U):r.deleteVertexArrayOES(U)}function _(U,z,q){let H=q.wireframe===!0,ne=o[U.id];ne===void 0&&(ne={},o[U.id]=ne);let W=ne[z.id];W===void 0&&(W={},ne[z.id]=W);let K=W[H];return K===void 0&&(K=g(d()),W[H]=K),K}function g(U){let z=[],q=[],H=[];for(let ne=0;ne=0){let fe=ne[G],_e=W[G];if(_e===void 0&&(G==="instanceMatrix"&&U.instanceMatrix&&(_e=U.instanceMatrix),G==="instanceColor"&&U.instanceColor&&(_e=U.instanceColor)),fe===void 0||fe.attribute!==_e||_e&&fe.data!==_e.data)return!0;K++}return l.attributesNum!==K||l.index!==H}function v(U,z,q,H){let ne={},W=z.attributes,K=0,D=q.getAttributes();for(let G in D)if(D[G].location>=0){let fe=W[G];fe===void 0&&(G==="instanceMatrix"&&U.instanceMatrix&&(fe=U.instanceMatrix),G==="instanceColor"&&U.instanceColor&&(fe=U.instanceColor));let _e={};_e.attribute=fe,fe&&fe.data&&(_e.data=fe.data),ne[G]=_e,K++}l.attributes=ne,l.attributesNum=K,l.index=H}function x(){let U=l.newAttributes;for(let z=0,q=U.length;z=0){let he=ne[D];if(he===void 0&&(D==="instanceMatrix"&&U.instanceMatrix&&(he=U.instanceMatrix),D==="instanceColor"&&U.instanceColor&&(he=U.instanceColor)),he!==void 0){let fe=he.normalized,_e=he.itemSize,we=t.get(he);if(we===void 0)continue;let Ee=we.buffer,Te=we.type,Ye=we.bytesPerElement,it=n.isWebGL2===!0&&(Te===s.INT||Te===s.UNSIGNED_INT||he.gpuType===dd);if(he.isInterleavedBufferAttribute){let Ce=he.data,L=Ce.stride,oe=he.offset;if(Ce.isInstancedInterleavedBuffer){for(let X=0;X0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=typeof WebGL2RenderingContext<"u"&&s.constructor.name==="WebGL2RenderingContext",o=t.precision!==void 0?t.precision:"highp",c=r(o);c!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",c,"instead."),o=c);let l=a||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),d=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),_=s.getParameter(s.MAX_VERTEX_ATTRIBS),g=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),p=s.getParameter(s.MAX_VARYING_VECTORS),v=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,y=a||e.has("OES_texture_float"),b=x&&y,w=a?s.getParameter(s.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:m,maxAttributes:_,maxVertexUniforms:g,maxVaryings:p,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:w}}function r_(s){let e=this,t=null,n=0,i=!1,r=!1,a=new mn,o=new He,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){let m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=s.get(u);if(!i||m===null||m.length===0||r&&!g)r?h(null):l();else{let v=r?0:n,x=v*4,y=p.clippingState||null;c.value=y,y=h(m,d,x,f);for(let b=0;b!==x;++b)y[b]=t[b];p.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){let _=u!==null?u.length:0,g=null;if(_!==0){if(g=c.value,m!==!0||g===null){let p=f+_*4,v=d.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length0){let l=new xo(c.height/2);return l.fromEquirectangularTexture(s,a),e.set(a,l),a.addEventListener("dispose",i),t(l.texture,a.mapping)}else return null}}return a}function i(a){let o=a.target;o.removeEventListener("dispose",i);let c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}var Ls=class extends Cs{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let 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,r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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}},Hi=4,hh=[.125,.215,.35,.446,.526,.582],ei=20,$a=new Ls,uh=new pe,Ka=null,jn=(1+Math.sqrt(5))/2,Li=1/jn,dh=[new A(1,1,1),new A(-1,1,1),new A(1,1,-1),new A(-1,1,-1),new A(0,jn,Li),new A(0,jn,-Li),new A(Li,0,jn),new A(-Li,0,jn),new A(jn,Li,0),new A(-jn,Li,0)],Kr=class{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){Ka=this._renderer.getRenderTarget(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ph(),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;e2?x:0,x,x),h.setRenderTarget(i),_&&h.render(m,o),h.render(e,o)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=d,h.autoClear=u,e.background=g}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===zn||e.mapping===ci;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=mh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ph());let r=i?this._cubemapMaterial:this._equirectMaterial,a=new Mt(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;let c=this._cubeSize;lr(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,$a)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;iei&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ei}`);let p=[],v=0;for(let R=0;Rx-Hi?i-x+Hi:0),w=4*(this._cubeSize-y);lr(t,b,w,3*y,2*y),c.setRenderTarget(t),c.render(u,$a)}};function o_(s){let e=[],t=[],n=[],i=s,r=s-Hi+1+hh.length;for(let a=0;as-Hi?c=hh[a-s+Hi-1]:a===0&&(c=0),n.push(c);let l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,v=new Float32Array(_*m*f),x=new Float32Array(g*m*f),y=new Float32Array(p*m*f);for(let w=0;w2?0:-1,M=[R,I,0,R+2/3,I,0,R+2/3,I+1,0,R,I,0,R+2/3,I+1,0,R,I+1,0];v.set(M,_*m*w),x.set(d,g*m*w);let T=[w,w,w,w,w,w];y.set(T,p*m*w)}let b=new Ge;b.setAttribute("position",new et(v,_)),b.setAttribute("uv",new et(x,g)),b.setAttribute("faceIndex",new et(y,p)),e.push(b),i>Hi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function fh(s,e,t){let n=new qt(s,e,t);return n.texture.mapping=Vs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function lr(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function c_(s,e,t){let n=new Float32Array(ei),i=new A(0,1,0);return new jt({name:"SphericalGaussianBlur",defines:{n:ei,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Zc(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:Dn,depthTest:!1,depthWrite:!1})}function ph(){return new jt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Zc(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:Dn,depthTest:!1,depthWrite:!1})}function mh(){return new jt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Zc(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:Dn,depthTest:!1,depthWrite:!1})}function Zc(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function l_(s){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){let c=o.mapping,l=c===Ir||c===Ur,h=c===zn||c===ci;if(l||h)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=e.get(o);return t===null&&(t=new Kr(s)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),e.set(o,u),u.texture}else{if(e.has(o))return e.get(o).texture;{let u=o.image;if(l&&u&&u.height>0||h&&u&&i(u)){t===null&&(t=new Kr(s));let d=l?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",r),d.texture}else return null}}}return o}function i(o){let c=0,l=6;for(let h=0;he.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);let O=new Float32Array(M*T*4*m),Y=new As(O,M,T,m);Y.type=xn,Y.needsUpdate=!0;let $=I*4;for(let z=0;z0)return s;let i=e*t,r=gh[i];if(r===void 0&&(r=new Float32Array(i),gh[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function gt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t":" "} ${o}: ${t[a]}`)}return n.join(` -`)}function o0(s){let e=Qe.getPrimaries(Qe.workingColorSpace),t=Qe.getPrimaries(s),n;switch(e===t?n="":e===kr&&t===Vr?n="LinearDisplayP3ToLinearSRGB":e===Vr&&t===kr&&(n="LinearSRGBToLinearDisplayP3"),s){case Mn:case va:return[n,"LinearTransferOETF"];case vt:case qc:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",s),[n,"LinearTransferOETF"]}}function bh(s,e,t){let n=s.getShaderParameter(e,s.COMPILE_STATUS),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";let r=/ERROR: 0:(\d+)/.exec(i);if(r){let a=parseInt(r[1]);return t.toUpperCase()+` - -`+i+` - -`+a0(s.getShaderSource(e),a)}else return i}function c0(s,e){let t=o0(e);return`vec4 ${s}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function l0(s,e){let t;switch(e){case df:t="Linear";break;case ff:t="Reinhard";break;case pf:t="OptimizedCineon";break;case mf:t="ACESFilmic";break;case gf:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function h0(s){return[s.extensionDerivatives||s.envMapCubeUVHeight||s.bumpMap||s.normalMapTangentSpace||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(vs).join(` -`)}function u0(s){let e=[];for(let t in s){let n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function d0(s,e){let t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function So(s){return s.replace(f0,m0)}var p0=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function m0(s,e){let t=ke[e];if(t===void 0){let n=p0.get(e);if(n!==void 0)t=ke[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return So(t)}var g0=/#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 wh(s){return s.replace(g0,_0)}function _0(s,e,t,n){let i="";for(let r=parseInt(e);r0&&(g+=` -`),p=[f,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(vs).join(` -`),p.length>0&&(p+=` -`)):(g=[Ah(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(vs).join(` -`),p=[f,Ah(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Nn?"#define TONE_MAPPING":"",t.toneMapping!==Nn?ke.tonemapping_pars_fragment:"",t.toneMapping!==Nn?l0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.colorspace_pars_fragment,c0("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(vs).join(` -`)),a=So(a),a=Eh(a,t),a=Th(a,t),o=So(o),o=Eh(o,t),o=Th(o,t),a=wh(a),o=wh(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v=`#version 300 es -`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+g,p=["#define varying in",t.glslVersion===Ol?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ol?"":"#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(` -`)+` -`+p);let x=v+g+a,y=v+p+o,b=Sh(i,i.VERTEX_SHADER,x),w=Sh(i,i.FRAGMENT_SHADER,y);if(i.attachShader(_,b),i.attachShader(_,w),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_),s.debug.checkShaderErrors){let M=i.getProgramInfoLog(_).trim(),T=i.getShaderInfoLog(b).trim(),O=i.getShaderInfoLog(w).trim(),Y=!0,$=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(Y=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,b,w);else{let U=bh(i,b,"vertex"),z=bh(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` - -Program Info Log: `+M+` -`+U+` -`+z)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(T===""||O==="")&&($=!1);$&&(this.diagnostics={runnable:Y,programLog:M,vertexShader:{log:T,prefix:g},fragmentShader:{log:O,prefix:p}})}i.deleteShader(b),i.deleteShader(w);let R;this.getUniforms=function(){return R===void 0&&(R=new qi(i,_)),R};let I;return this.getAttributes=function(){return I===void 0&&(I=d0(i,_)),I},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=r0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=w,this}var E0=0,bo=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let 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){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Eo(e),t.set(e,n)),n}},Eo=class{constructor(e){this.id=E0++,this.code=e,this.usedTimes=0}};function T0(s,e,t,n,i,r,a){let o=new Rs,c=new bo,l=[],h=i.isWebGL2,u=i.logarithmicDepthBuffer,d=i.vertexTextures,f=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M){return M===0?"uv":`uv${M}`}function g(M,T,O,Y,$){let U=Y.fog,z=$.geometry,q=M.isMeshStandardMaterial?Y.environment:null,H=(M.isMeshStandardMaterial?t:e).get(M.envMap||q),ne=H&&H.mapping===Vs?H.image.height:null,W=m[M.type];M.precision!==null&&(f=i.getMaxPrecision(M.precision),f!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",f,"instead."));let K=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,D=K!==void 0?K.length:0,G=0;z.morphAttributes.position!==void 0&&(G=1),z.morphAttributes.normal!==void 0&&(G=2),z.morphAttributes.color!==void 0&&(G=3);let he,fe,_e,we;if(W){let tt=nn[W];he=tt.vertexShader,fe=tt.fragmentShader}else he=M.vertexShader,fe=M.fragmentShader,c.update(M),_e=c.getVertexShaderID(M),we=c.getFragmentShaderID(M);let Ee=s.getRenderTarget(),Te=$.isInstancedMesh===!0,Ye=!!M.map,it=!!M.matcap,Ce=!!H,L=!!M.aoMap,oe=!!M.lightMap,X=!!M.bumpMap,ie=!!M.normalMap,J=!!M.displacementMap,Se=!!M.emissiveMap,me=!!M.metalnessMap,ye=!!M.roughnessMap,Ne=M.anisotropy>0,qe=M.clearcoat>0,rt=M.iridescence>0,C=M.sheen>0,S=M.transmission>0,B=Ne&&!!M.anisotropyMap,ee=qe&&!!M.clearcoatMap,j=qe&&!!M.clearcoatNormalMap,te=qe&&!!M.clearcoatRoughnessMap,Me=rt&&!!M.iridescenceMap,re=rt&&!!M.iridescenceThicknessMap,de=C&&!!M.sheenColorMap,Le=C&&!!M.sheenRoughnessMap,Ze=!!M.specularMap,se=!!M.specularColorMap,$e=!!M.specularIntensityMap,Oe=S&&!!M.transmissionMap,Ie=S&&!!M.thicknessMap,Re=!!M.gradientMap,P=!!M.alphaMap,ce=M.alphaTest>0,ae=!!M.alphaHash,ge=!!M.extensions,ue=!!z.attributes.uv1,Q=!!z.attributes.uv2,be=!!z.attributes.uv3,Fe=Nn;return M.toneMapped&&(Ee===null||Ee.isXRRenderTarget===!0)&&(Fe=s.toneMapping),{isWebGL2:h,shaderID:W,shaderType:M.type,shaderName:M.name,vertexShader:he,fragmentShader:fe,defines:M.defines,customVertexShaderID:_e,customFragmentShaderID:we,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:f,instancing:Te,instancingColor:Te&&$.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:Ee===null?s.outputColorSpace:Ee.isXRRenderTarget===!0?Ee.texture.colorSpace:Mn,map:Ye,matcap:it,envMap:Ce,envMapMode:Ce&&H.mapping,envMapCubeUVHeight:ne,aoMap:L,lightMap:oe,bumpMap:X,normalMap:ie,displacementMap:d&&J,emissiveMap:Se,normalMapObjectSpace:ie&&M.normalMapType===Lf,normalMapTangentSpace:ie&&M.normalMapType===mi,metalnessMap:me,roughnessMap:ye,anisotropy:Ne,anisotropyMap:B,clearcoat:qe,clearcoatMap:ee,clearcoatNormalMap:j,clearcoatRoughnessMap:te,iridescence:rt,iridescenceMap:Me,iridescenceThicknessMap:re,sheen:C,sheenColorMap:de,sheenRoughnessMap:Le,specularMap:Ze,specularColorMap:se,specularIntensityMap:$e,transmission:S,transmissionMap:Oe,thicknessMap:Ie,gradientMap:Re,opaque:M.transparent===!1&&M.blending===Wi,alphaMap:P,alphaTest:ce,alphaHash:ae,combine:M.combine,mapUv:Ye&&_(M.map.channel),aoMapUv:L&&_(M.aoMap.channel),lightMapUv:oe&&_(M.lightMap.channel),bumpMapUv:X&&_(M.bumpMap.channel),normalMapUv:ie&&_(M.normalMap.channel),displacementMapUv:J&&_(M.displacementMap.channel),emissiveMapUv:Se&&_(M.emissiveMap.channel),metalnessMapUv:me&&_(M.metalnessMap.channel),roughnessMapUv:ye&&_(M.roughnessMap.channel),anisotropyMapUv:B&&_(M.anisotropyMap.channel),clearcoatMapUv:ee&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:j&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:re&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:de&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Le&&_(M.sheenRoughnessMap.channel),specularMapUv:Ze&&_(M.specularMap.channel),specularColorMapUv:se&&_(M.specularColorMap.channel),specularIntensityMapUv:$e&&_(M.specularIntensityMap.channel),transmissionMapUv:Oe&&_(M.transmissionMap.channel),thicknessMapUv:Ie&&_(M.thicknessMap.channel),alphaMapUv:P&&_(M.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(ie||Ne),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,vertexUv1s:ue,vertexUv2s:Q,vertexUv3s:be,pointsUvs:$.isPoints===!0&&!!z.attributes.uv&&(Ye||P),fog:!!U,useFog:M.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:$.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:D,morphTextureStride:G,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:s.shadowMap.enabled&&O.length>0,shadowMapType:s.shadowMap.type,toneMapping:Fe,useLegacyLights:s._useLegacyLights,decodeVideoTexture:Ye&&M.map.isVideoTexture===!0&&Qe.getTransfer(M.map.colorSpace)===nt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===gn,flipSided:M.side===Ft,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:ge&&M.extensions.derivatives===!0,extensionFragDepth:ge&&M.extensions.fragDepth===!0,extensionDrawBuffers:ge&&M.extensions.drawBuffers===!0,extensionShaderTextureLOD:ge&&M.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function p(M){let T=[];if(M.shaderID?T.push(M.shaderID):(T.push(M.customVertexShaderID),T.push(M.customFragmentShaderID)),M.defines!==void 0)for(let O in M.defines)T.push(O),T.push(M.defines[O]);return M.isRawShaderMaterial===!1&&(v(T,M),x(T,M),T.push(s.outputColorSpace)),T.push(M.customProgramCacheKey),T.join()}function v(M,T){M.push(T.precision),M.push(T.outputColorSpace),M.push(T.envMapMode),M.push(T.envMapCubeUVHeight),M.push(T.mapUv),M.push(T.alphaMapUv),M.push(T.lightMapUv),M.push(T.aoMapUv),M.push(T.bumpMapUv),M.push(T.normalMapUv),M.push(T.displacementMapUv),M.push(T.emissiveMapUv),M.push(T.metalnessMapUv),M.push(T.roughnessMapUv),M.push(T.anisotropyMapUv),M.push(T.clearcoatMapUv),M.push(T.clearcoatNormalMapUv),M.push(T.clearcoatRoughnessMapUv),M.push(T.iridescenceMapUv),M.push(T.iridescenceThicknessMapUv),M.push(T.sheenColorMapUv),M.push(T.sheenRoughnessMapUv),M.push(T.specularMapUv),M.push(T.specularColorMapUv),M.push(T.specularIntensityMapUv),M.push(T.transmissionMapUv),M.push(T.thicknessMapUv),M.push(T.combine),M.push(T.fogExp2),M.push(T.sizeAttenuation),M.push(T.morphTargetsCount),M.push(T.morphAttributeCount),M.push(T.numDirLights),M.push(T.numPointLights),M.push(T.numSpotLights),M.push(T.numSpotLightMaps),M.push(T.numHemiLights),M.push(T.numRectAreaLights),M.push(T.numDirLightShadows),M.push(T.numPointLightShadows),M.push(T.numSpotLightShadows),M.push(T.numSpotLightShadowsWithMaps),M.push(T.numLightProbes),M.push(T.shadowMapType),M.push(T.toneMapping),M.push(T.numClippingPlanes),M.push(T.numClipIntersection),M.push(T.depthPacking)}function x(M,T){o.disableAll(),T.isWebGL2&&o.enable(0),T.supportsVertexTextures&&o.enable(1),T.instancing&&o.enable(2),T.instancingColor&&o.enable(3),T.matcap&&o.enable(4),T.envMap&&o.enable(5),T.normalMapObjectSpace&&o.enable(6),T.normalMapTangentSpace&&o.enable(7),T.clearcoat&&o.enable(8),T.iridescence&&o.enable(9),T.alphaTest&&o.enable(10),T.vertexColors&&o.enable(11),T.vertexAlphas&&o.enable(12),T.vertexUv1s&&o.enable(13),T.vertexUv2s&&o.enable(14),T.vertexUv3s&&o.enable(15),T.vertexTangents&&o.enable(16),T.anisotropy&&o.enable(17),M.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.skinning&&o.enable(4),T.morphTargets&&o.enable(5),T.morphNormals&&o.enable(6),T.morphColors&&o.enable(7),T.premultipliedAlpha&&o.enable(8),T.shadowMapEnabled&&o.enable(9),T.useLegacyLights&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),M.push(o.mask)}function y(M){let T=m[M.type],O;if(T){let Y=nn[T];O=xp.clone(Y.uniforms)}else O=M.uniforms;return O}function b(M,T){let O;for(let Y=0,$=l.length;Y<$;Y++){let U=l[Y];if(U.cacheKey===T){O=U,++O.usedTimes;break}}return O===void 0&&(O=new b0(s,T,M,r),l.push(O)),O}function w(M){if(--M.usedTimes===0){let T=l.indexOf(M);l[T]=l[l.length-1],l.pop(),M.destroy()}}function R(M){c.remove(M)}function I(){c.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:y,acquireProgram:b,releaseProgram:w,releaseShaderCache:R,programs:l,dispose:I}}function w0(){let s=new WeakMap;function e(r){let a=s.get(r);return a===void 0&&(a={},s.set(r,a)),a}function t(r){s.delete(r)}function n(r,a,o){s.get(r)[a]=o}function i(){s=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function A0(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Rh(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Ch(){let s=[],e=0,t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=s[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},s[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=_,p.group=g),e++,p}function o(u,d,f,m,_,g){let p=a(u,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function c(u,d,f,m,_,g){let p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function l(u,d){t.length>1&&t.sort(u||A0),n.length>1&&n.sort(d||Rh),i.length>1&&i.sort(d||Rh)}function h(){for(let u=e,d=s.length;u=r.length?(a=new Ch,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function C0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new A,color:new pe};break;case"SpotLight":t={position:new A,direction:new A,color:new pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new A,color:new pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new A,skyColor:new pe,groundColor:new pe};break;case"RectAreaLight":t={color:new pe,position:new A,halfWidth:new A,halfHeight:new A};break}return s[e.id]=t,t}}}function P0(){let s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}var L0=0;function I0(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function U0(s,e){let t=new C0,n=P0(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)i.probe.push(new A);let r=new A,a=new ze,o=new ze;function c(h,u){let d=0,f=0,m=0;for(let Y=0;Y<9;Y++)i.probe[Y].set(0,0,0);let _=0,g=0,p=0,v=0,x=0,y=0,b=0,w=0,R=0,I=0,M=0;h.sort(I0);let T=u===!0?Math.PI:1;for(let Y=0,$=h.length;Y<$;Y++){let U=h[Y],z=U.color,q=U.intensity,H=U.distance,ne=U.shadow&&U.shadow.map?U.shadow.map.texture:null;if(U.isAmbientLight)d+=z.r*q*T,f+=z.g*q*T,m+=z.b*q*T;else if(U.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(U.sh.coefficients[W],q);M++}else if(U.isDirectionalLight){let W=t.get(U);if(W.color.copy(U.color).multiplyScalar(U.intensity*T),U.castShadow){let K=U.shadow,D=n.get(U);D.shadowBias=K.bias,D.shadowNormalBias=K.normalBias,D.shadowRadius=K.radius,D.shadowMapSize=K.mapSize,i.directionalShadow[_]=D,i.directionalShadowMap[_]=ne,i.directionalShadowMatrix[_]=U.shadow.matrix,y++}i.directional[_]=W,_++}else if(U.isSpotLight){let W=t.get(U);W.position.setFromMatrixPosition(U.matrixWorld),W.color.copy(z).multiplyScalar(q*T),W.distance=H,W.coneCos=Math.cos(U.angle),W.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),W.decay=U.decay,i.spot[p]=W;let K=U.shadow;if(U.map&&(i.spotLightMap[R]=U.map,R++,K.updateMatrices(U),U.castShadow&&I++),i.spotLightMatrix[p]=K.matrix,U.castShadow){let D=n.get(U);D.shadowBias=K.bias,D.shadowNormalBias=K.normalBias,D.shadowRadius=K.radius,D.shadowMapSize=K.mapSize,i.spotShadow[p]=D,i.spotShadowMap[p]=ne,w++}p++}else if(U.isRectAreaLight){let W=t.get(U);W.color.copy(z).multiplyScalar(q),W.halfWidth.set(U.width*.5,0,0),W.halfHeight.set(0,U.height*.5,0),i.rectArea[v]=W,v++}else if(U.isPointLight){let W=t.get(U);if(W.color.copy(U.color).multiplyScalar(U.intensity*T),W.distance=U.distance,W.decay=U.decay,U.castShadow){let K=U.shadow,D=n.get(U);D.shadowBias=K.bias,D.shadowNormalBias=K.normalBias,D.shadowRadius=K.radius,D.shadowMapSize=K.mapSize,D.shadowCameraNear=K.camera.near,D.shadowCameraFar=K.camera.far,i.pointShadow[g]=D,i.pointShadowMap[g]=ne,i.pointShadowMatrix[g]=U.shadow.matrix,b++}i.point[g]=W,g++}else if(U.isHemisphereLight){let W=t.get(U);W.skyColor.copy(U.color).multiplyScalar(q*T),W.groundColor.copy(U.groundColor).multiplyScalar(q*T),i.hemi[x]=W,x++}}v>0&&(e.isWebGL2||s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=le.LTC_FLOAT_1,i.rectAreaLTC2=le.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=le.LTC_HALF_1,i.rectAreaLTC2=le.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=m;let O=i.hash;(O.directionalLength!==_||O.pointLength!==g||O.spotLength!==p||O.rectAreaLength!==v||O.hemiLength!==x||O.numDirectionalShadows!==y||O.numPointShadows!==b||O.numSpotShadows!==w||O.numSpotMaps!==R||O.numLightProbes!==M)&&(i.directional.length=_,i.spot.length=p,i.rectArea.length=v,i.point.length=g,i.hemi.length=x,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=w+R-I,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=I,i.numLightProbes=M,O.directionalLength=_,O.pointLength=g,O.spotLength=p,O.rectAreaLength=v,O.hemiLength=x,O.numDirectionalShadows=y,O.numPointShadows=b,O.numSpotShadows=w,O.numSpotMaps=R,O.numLightProbes=M,i.version=L0++)}function l(h,u){let d=0,f=0,m=0,_=0,g=0,p=u.matrixWorldInverse;for(let v=0,x=h.length;v=o.length?(c=new Ph(s,e),o.push(c)):c=o[a],c}function i(){t=new WeakMap}return{get:n,dispose:i}}var Qr=class extends bt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Cf,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}},jr=class extends bt{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}},N0=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,O0=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function F0(s,e,t){let n=new Ps,i=new Z,r=new Z,a=new je,o=new Qr({depthPacking:Pf}),c=new jr,l={},h=t.maxTextureSize,u={[Bn]:Ft,[Ft]:Bn,[gn]:gn},d=new jt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Z},radius:{value:4}},vertexShader:N0,fragmentShader:O0}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let m=new Ge;m.setAttribute("position",new et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new Mt(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=cd;let p=this.type;this.render=function(b,w,R){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;let I=s.getRenderTarget(),M=s.getActiveCubeFace(),T=s.getActiveMipmapLevel(),O=s.state;O.setBlending(Dn),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);let Y=p!==pn&&this.type===pn,$=p===pn&&this.type!==pn;for(let U=0,z=b.length;Uh||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/ne.x),i.x=r.x*ne.x,H.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/ne.y),i.y=r.y*ne.y,H.mapSize.y=r.y)),H.map===null||Y===!0||$===!0){let K=this.type!==pn?{minFilter:pt,magFilter:pt}:{};H.map!==null&&H.map.dispose(),H.map=new qt(i.x,i.y,K),H.map.texture.name=q.name+".shadowMap",H.camera.updateProjectionMatrix()}s.setRenderTarget(H.map),s.clear();let W=H.getViewportCount();for(let K=0;K0||w.map&&w.alphaTest>0){let O=M.uuid,Y=w.uuid,$=l[O];$===void 0&&($={},l[O]=$);let U=$[Y];U===void 0&&(U=M.clone(),$[Y]=U),M=U}if(M.visible=w.visible,M.wireframe=w.wireframe,I===pn?M.side=w.shadowSide!==null?w.shadowSide:w.side:M.side=w.shadowSide!==null?w.shadowSide:u[w.side],M.alphaMap=w.alphaMap,M.alphaTest=w.alphaTest,M.map=w.map,M.clipShadows=w.clipShadows,M.clippingPlanes=w.clippingPlanes,M.clipIntersection=w.clipIntersection,M.displacementMap=w.displacementMap,M.displacementScale=w.displacementScale,M.displacementBias=w.displacementBias,M.wireframeLinewidth=w.wireframeLinewidth,M.linewidth=w.linewidth,R.isPointLight===!0&&M.isMeshDistanceMaterial===!0){let O=s.properties.get(M);O.light=R}return M}function y(b,w,R,I,M){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===pn)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,b.matrixWorld);let Y=e.update(b),$=b.material;if(Array.isArray($)){let U=Y.groups;for(let z=0,q=U.length;z=1):ne.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),q=H>=2);let W=null,K={},D=s.getParameter(s.SCISSOR_BOX),G=s.getParameter(s.VIEWPORT),he=new je().fromArray(D),fe=new je().fromArray(G);function _e(P,ce,ae,ge){let ue=new Uint8Array(4),Q=s.createTexture();s.bindTexture(P,Q),s.texParameteri(P,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(P,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let be=0;be"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,_,g=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(C,S){return p?new OffscreenCanvas(C,S):ws("canvas")}function x(C,S,B,ee){let j=1;if((C.width>ee||C.height>ee)&&(j=ee/Math.max(C.width,C.height)),j<1||S===!0)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap){let te=S?Wr:Math.floor,Me=te(j*C.width),re=te(j*C.height);_===void 0&&(_=v(Me,re));let de=B?v(Me,re):_;return de.width=Me,de.height=re,de.getContext("2d").drawImage(C,0,0,Me,re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+C.width+"x"+C.height+") to ("+Me+"x"+re+")."),de}else return"data"in C&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+C.width+"x"+C.height+")."),C;return C}function y(C){return mo(C.width)&&mo(C.height)}function b(C){return o?!1:C.wrapS!==It||C.wrapT!==It||C.minFilter!==pt&&C.minFilter!==mt}function w(C,S){return C.generateMipmaps&&S&&C.minFilter!==pt&&C.minFilter!==mt}function R(C){s.generateMipmap(C)}function I(C,S,B,ee,j=!1){if(o===!1)return S;if(C!==null){if(s[C]!==void 0)return s[C];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let te=S;if(S===s.RED&&(B===s.FLOAT&&(te=s.R32F),B===s.HALF_FLOAT&&(te=s.R16F),B===s.UNSIGNED_BYTE&&(te=s.R8)),S===s.RED_INTEGER&&(B===s.UNSIGNED_BYTE&&(te=s.R8UI),B===s.UNSIGNED_SHORT&&(te=s.R16UI),B===s.UNSIGNED_INT&&(te=s.R32UI),B===s.BYTE&&(te=s.R8I),B===s.SHORT&&(te=s.R16I),B===s.INT&&(te=s.R32I)),S===s.RG&&(B===s.FLOAT&&(te=s.RG32F),B===s.HALF_FLOAT&&(te=s.RG16F),B===s.UNSIGNED_BYTE&&(te=s.RG8)),S===s.RGBA){let Me=j?zr:Qe.getTransfer(ee);B===s.FLOAT&&(te=s.RGBA32F),B===s.HALF_FLOAT&&(te=s.RGBA16F),B===s.UNSIGNED_BYTE&&(te=Me===nt?s.SRGB8_ALPHA8:s.RGBA8),B===s.UNSIGNED_SHORT_4_4_4_4&&(te=s.RGBA4),B===s.UNSIGNED_SHORT_5_5_5_1&&(te=s.RGB5_A1)}return(te===s.R16F||te===s.R32F||te===s.RG16F||te===s.RG32F||te===s.RGBA16F||te===s.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function M(C,S,B){return w(C,B)===!0||C.isFramebufferTexture&&C.minFilter!==pt&&C.minFilter!==mt?Math.log2(Math.max(S.width,S.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?S.mipmaps.length:1}function T(C){return C===pt||C===fo||C===Lr?s.NEAREST:s.LINEAR}function O(C){let S=C.target;S.removeEventListener("dispose",O),$(S),S.isVideoTexture&&m.delete(S)}function Y(C){let S=C.target;S.removeEventListener("dispose",Y),z(S)}function $(C){let S=n.get(C);if(S.__webglInit===void 0)return;let B=C.source,ee=g.get(B);if(ee){let j=ee[S.__cacheKey];j.usedTimes--,j.usedTimes===0&&U(C),Object.keys(ee).length===0&&g.delete(B)}n.remove(C)}function U(C){let S=n.get(C);s.deleteTexture(S.__webglTexture);let B=C.source,ee=g.get(B);delete ee[S.__cacheKey],a.memory.textures--}function z(C){let S=C.texture,B=n.get(C),ee=n.get(S);if(ee.__webglTexture!==void 0&&(s.deleteTexture(ee.__webglTexture),a.memory.textures--),C.depthTexture&&C.depthTexture.dispose(),C.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(B.__webglFramebuffer[j]))for(let te=0;te=c&&console.warn("THREE.WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+c),q+=1,C}function W(C){let S=[];return S.push(C.wrapS),S.push(C.wrapT),S.push(C.wrapR||0),S.push(C.magFilter),S.push(C.minFilter),S.push(C.anisotropy),S.push(C.internalFormat),S.push(C.format),S.push(C.type),S.push(C.generateMipmaps),S.push(C.premultiplyAlpha),S.push(C.flipY),S.push(C.unpackAlignment),S.push(C.colorSpace),S.join()}function K(C,S){let B=n.get(C);if(C.isVideoTexture&&qe(C),C.isRenderTargetTexture===!1&&C.version>0&&B.__version!==C.version){let ee=C.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ye(B,C,S);return}}t.bindTexture(s.TEXTURE_2D,B.__webglTexture,s.TEXTURE0+S)}function D(C,S){let B=n.get(C);if(C.version>0&&B.__version!==C.version){Ye(B,C,S);return}t.bindTexture(s.TEXTURE_2D_ARRAY,B.__webglTexture,s.TEXTURE0+S)}function G(C,S){let B=n.get(C);if(C.version>0&&B.__version!==C.version){Ye(B,C,S);return}t.bindTexture(s.TEXTURE_3D,B.__webglTexture,s.TEXTURE0+S)}function he(C,S){let B=n.get(C);if(C.version>0&&B.__version!==C.version){it(B,C,S);return}t.bindTexture(s.TEXTURE_CUBE_MAP,B.__webglTexture,s.TEXTURE0+S)}let fe={[Dr]:s.REPEAT,[It]:s.CLAMP_TO_EDGE,[Nr]:s.MIRRORED_REPEAT},_e={[pt]:s.NEAREST,[fo]:s.NEAREST_MIPMAP_NEAREST,[Lr]:s.NEAREST_MIPMAP_LINEAR,[mt]:s.LINEAR,[ud]:s.LINEAR_MIPMAP_NEAREST,[li]:s.LINEAR_MIPMAP_LINEAR},we={[Uf]:s.NEVER,[Vf]:s.ALWAYS,[Df]:s.LESS,[Of]:s.LEQUAL,[Nf]:s.EQUAL,[zf]:s.GEQUAL,[Ff]:s.GREATER,[Bf]:s.NOTEQUAL};function Ee(C,S,B){if(B?(s.texParameteri(C,s.TEXTURE_WRAP_S,fe[S.wrapS]),s.texParameteri(C,s.TEXTURE_WRAP_T,fe[S.wrapT]),(C===s.TEXTURE_3D||C===s.TEXTURE_2D_ARRAY)&&s.texParameteri(C,s.TEXTURE_WRAP_R,fe[S.wrapR]),s.texParameteri(C,s.TEXTURE_MAG_FILTER,_e[S.magFilter]),s.texParameteri(C,s.TEXTURE_MIN_FILTER,_e[S.minFilter])):(s.texParameteri(C,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(C,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),(C===s.TEXTURE_3D||C===s.TEXTURE_2D_ARRAY)&&s.texParameteri(C,s.TEXTURE_WRAP_R,s.CLAMP_TO_EDGE),(S.wrapS!==It||S.wrapT!==It)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(C,s.TEXTURE_MAG_FILTER,T(S.magFilter)),s.texParameteri(C,s.TEXTURE_MIN_FILTER,T(S.minFilter)),S.minFilter!==pt&&S.minFilter!==mt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),S.compareFunction&&(s.texParameteri(C,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(C,s.TEXTURE_COMPARE_FUNC,we[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){let ee=e.get("EXT_texture_filter_anisotropic");if(S.magFilter===pt||S.minFilter!==Lr&&S.minFilter!==li||S.type===xn&&e.has("OES_texture_float_linear")===!1||o===!1&&S.type===Ts&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||n.get(S).__currentAnisotropy)&&(s.texParameterf(C,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy)}}function Te(C,S){let B=!1;C.__webglInit===void 0&&(C.__webglInit=!0,S.addEventListener("dispose",O));let ee=S.source,j=g.get(ee);j===void 0&&(j={},g.set(ee,j));let te=W(S);if(te!==C.__cacheKey){j[te]===void 0&&(j[te]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,B=!0),j[te].usedTimes++;let Me=j[C.__cacheKey];Me!==void 0&&(j[C.__cacheKey].usedTimes--,Me.usedTimes===0&&U(S)),C.__cacheKey=te,C.__webglTexture=j[te].texture}return B}function Ye(C,S,B){let ee=s.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(ee=s.TEXTURE_2D_ARRAY),S.isData3DTexture&&(ee=s.TEXTURE_3D);let j=Te(C,S),te=S.source;t.bindTexture(ee,C.__webglTexture,s.TEXTURE0+B);let Me=n.get(te);if(te.version!==Me.__version||j===!0){t.activeTexture(s.TEXTURE0+B);let re=Qe.getPrimaries(Qe.workingColorSpace),de=S.colorSpace===Xt?null:Qe.getPrimaries(S.colorSpace),Le=S.colorSpace===Xt||re===de?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);let Ze=b(S)&&y(S.image)===!1,se=x(S.image,Ze,!1,h);se=rt(S,se);let $e=y(se)||o,Oe=r.convert(S.format,S.colorSpace),Ie=r.convert(S.type),Re=I(S.internalFormat,Oe,Ie,S.colorSpace,S.isVideoTexture);Ee(ee,S,$e);let P,ce=S.mipmaps,ae=o&&S.isVideoTexture!==!0,ge=Me.__version===void 0||j===!0,ue=M(S,se,$e);if(S.isDepthTexture)Re=s.DEPTH_COMPONENT,o?S.type===xn?Re=s.DEPTH_COMPONENT32F:S.type===Ln?Re=s.DEPTH_COMPONENT24:S.type===ii?Re=s.DEPTH24_STENCIL8:Re=s.DEPTH_COMPONENT16:S.type===xn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===si&&Re===s.DEPTH_COMPONENT&&S.type!==Wc&&S.type!==Ln&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=Ln,Ie=r.convert(S.type)),S.format===Yi&&Re===s.DEPTH_COMPONENT&&(Re=s.DEPTH_STENCIL,S.type!==ii&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=ii,Ie=r.convert(S.type))),ge&&(ae?t.texStorage2D(s.TEXTURE_2D,1,Re,se.width,se.height):t.texImage2D(s.TEXTURE_2D,0,Re,se.width,se.height,0,Oe,Ie,null));else if(S.isDataTexture)if(ce.length>0&&$e){ae&&ge&&t.texStorage2D(s.TEXTURE_2D,ue,Re,ce[0].width,ce[0].height);for(let Q=0,be=ce.length;Q>=1,be>>=1}}else if(ce.length>0&&$e){ae&&ge&&t.texStorage2D(s.TEXTURE_2D,ue,Re,ce[0].width,ce[0].height);for(let Q=0,be=ce.length;Q0&&ge++,t.texStorage2D(s.TEXTURE_CUBE_MAP,ge,P,se[0].width,se[0].height));for(let Q=0;Q<6;Q++)if(Ze){ce?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,se[Q].width,se[Q].height,Ie,Re,se[Q].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,P,se[Q].width,se[Q].height,0,Ie,Re,se[Q].data);for(let be=0;be>te),se=Math.max(1,S.height>>te);j===s.TEXTURE_3D||j===s.TEXTURE_2D_ARRAY?t.texImage3D(j,te,de,Ze,se,S.depth,0,Me,re,null):t.texImage2D(j,te,de,Ze,se,0,Me,re,null)}t.bindFramebuffer(s.FRAMEBUFFER,C),Ne(S)?d.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ee,j,n.get(B).__webglTexture,0,ye(S)):(j===s.TEXTURE_2D||j>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,ee,j,n.get(B).__webglTexture,te),t.bindFramebuffer(s.FRAMEBUFFER,null)}function L(C,S,B){if(s.bindRenderbuffer(s.RENDERBUFFER,C),S.depthBuffer&&!S.stencilBuffer){let ee=o===!0?s.DEPTH_COMPONENT24:s.DEPTH_COMPONENT16;if(B||Ne(S)){let j=S.depthTexture;j&&j.isDepthTexture&&(j.type===xn?ee=s.DEPTH_COMPONENT32F:j.type===Ln&&(ee=s.DEPTH_COMPONENT24));let te=ye(S);Ne(S)?d.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,te,ee,S.width,S.height):s.renderbufferStorageMultisample(s.RENDERBUFFER,te,ee,S.width,S.height)}else s.renderbufferStorage(s.RENDERBUFFER,ee,S.width,S.height);s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,C)}else if(S.depthBuffer&&S.stencilBuffer){let ee=ye(S);B&&Ne(S)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,ee,s.DEPTH24_STENCIL8,S.width,S.height):Ne(S)?d.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ee,s.DEPTH24_STENCIL8,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,S.width,S.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,C)}else{let ee=S.isWebGLMultipleRenderTargets===!0?S.texture:[S.texture];for(let j=0;j0){B.__webglFramebuffer[re]=[];for(let de=0;de0){B.__webglFramebuffer=[];for(let re=0;re0&&Ne(C)===!1){let re=te?S:[S];B.__webglMultisampledFramebuffer=s.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let de=0;de0)for(let de=0;de0)for(let de=0;de0&&Ne(C)===!1){let S=C.isWebGLMultipleRenderTargets?C.texture:[C.texture],B=C.width,ee=C.height,j=s.COLOR_BUFFER_BIT,te=[],Me=C.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,re=n.get(C),de=C.isWebGLMultipleRenderTargets===!0;if(de)for(let Le=0;Le0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function qe(C){let S=a.render.frame;m.get(C)!==S&&(m.set(C,S),C.update())}function rt(C,S){let B=C.colorSpace,ee=C.format,j=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||C.format===po||B!==Mn&&B!==Xt&&(Qe.getTransfer(B)===nt?o===!1?e.has("EXT_sRGB")===!0&&ee===Wt?(C.format=po,C.minFilter=mt,C.generateMipmaps=!1):S=Xr.sRGBToLinear(S):(ee!==Wt||j!==On)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),S}this.allocateTextureUnit=ne,this.resetTextureUnits=H,this.setTexture2D=K,this.setTexture2DArray=D,this.setTexture3D=G,this.setTextureCube=he,this.rebindTextures=ie,this.setupRenderTarget=J,this.updateRenderTargetMipmap=Se,this.updateMultisampleRenderTarget=me,this.setupDepthRenderbuffer=X,this.setupFrameBufferTexture=Ce,this.useMultisampledRTT=Ne}function V0(s,e,t){let n=t.isWebGL2;function i(r,a=Xt){let o,c=Qe.getTransfer(a);if(r===On)return s.UNSIGNED_BYTE;if(r===fd)return s.UNSIGNED_SHORT_4_4_4_4;if(r===pd)return s.UNSIGNED_SHORT_5_5_5_1;if(r===_f)return s.BYTE;if(r===xf)return s.SHORT;if(r===Wc)return s.UNSIGNED_SHORT;if(r===dd)return s.INT;if(r===Ln)return s.UNSIGNED_INT;if(r===xn)return s.FLOAT;if(r===Ts)return n?s.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(r===vf)return s.ALPHA;if(r===Wt)return s.RGBA;if(r===yf)return s.LUMINANCE;if(r===Mf)return s.LUMINANCE_ALPHA;if(r===si)return s.DEPTH_COMPONENT;if(r===Yi)return s.DEPTH_STENCIL;if(r===po)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(r===Sf)return s.RED;if(r===md)return s.RED_INTEGER;if(r===bf)return s.RG;if(r===gd)return s.RG_INTEGER;if(r===_d)return s.RGBA_INTEGER;if(r===wa||r===Aa||r===Ra||r===Ca)if(c===nt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(r===wa)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Aa)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ra)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ca)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(r===wa)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Aa)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ra)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ca)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===ul||r===dl||r===fl||r===pl)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(r===ul)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===dl)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===fl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===pl)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Ef)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===ml||r===gl)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(r===ml)return c===nt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(r===gl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===_l||r===xl||r===vl||r===yl||r===Ml||r===Sl||r===bl||r===El||r===Tl||r===wl||r===Al||r===Rl||r===Cl||r===Pl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(r===_l)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===xl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===vl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===yl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Ml)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Sl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===bl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===El)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Tl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===wl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Al)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Rl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Cl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Pl)return c===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Pa||r===Ll||r===Il)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(r===Pa)return c===nt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Ll)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===Il)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===Tf||r===Ul||r===Dl||r===Nl)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(r===Pa)return o.COMPRESSED_RED_RGTC1_EXT;if(r===Ul)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Dl)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Nl)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ii?n?s.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):s[r]!==void 0?s[r]:null}return{convert:i}}var To=class extends yt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},ti=class extends Je{constructor(){super(),this.isGroup=!0,this.type="Group"}},k0={type:"move"},Ss=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ti,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 ti,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ti,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),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){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(let _ of e.hand.values()){let g=t.getJointPose(_,n),p=this._getHandJoint(l,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}let h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;l.inputState.pinching&&d>f+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(k0)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new ti;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},wo=class extends St{constructor(e,t,n,i,r,a,o,c,l,h){if(h=h!==void 0?h:si,h!==si&&h!==Yi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===si&&(n=Ln),n===void 0&&h===Yi&&(n=ii),super(null,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:pt,this.minFilter=c!==void 0?c:pt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ao=class extends sn{constructor(e,t){super();let n=this,i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,m=null,_=t.getContextAttributes(),g=null,p=null,v=[],x=[],y=new yt;y.layers.enable(1),y.viewport=new je;let b=new yt;b.layers.enable(2),b.viewport=new je;let w=[y,b],R=new To;R.layers.enable(1),R.layers.enable(2);let I=null,M=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(D){let G=v[D];return G===void 0&&(G=new Ss,v[D]=G),G.getTargetRaySpace()},this.getControllerGrip=function(D){let G=v[D];return G===void 0&&(G=new Ss,v[D]=G),G.getGripSpace()},this.getHand=function(D){let G=v[D];return G===void 0&&(G=new Ss,v[D]=G),G.getHandSpace()};function T(D){let G=x.indexOf(D.inputSource);if(G===-1)return;let he=v[G];he!==void 0&&(he.update(D.inputSource,D.frame,l||a),he.dispatchEvent({type:D.type,data:D.inputSource}))}function O(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",O),i.removeEventListener("inputsourceschange",Y);for(let D=0;D=0&&(x[fe]=null,v[fe].disconnect(he))}for(let G=0;G=x.length){x.push(he),fe=we;break}else if(x[we]===null){x[we]=he,fe=we;break}if(fe===-1)break}let _e=v[fe];_e&&_e.connect(he)}}let $=new A,U=new A;function z(D,G,he){$.setFromMatrixPosition(G.matrixWorld),U.setFromMatrixPosition(he.matrixWorld);let fe=$.distanceTo(U),_e=G.projectionMatrix.elements,we=he.projectionMatrix.elements,Ee=_e[14]/(_e[10]-1),Te=_e[14]/(_e[10]+1),Ye=(_e[9]+1)/_e[5],it=(_e[9]-1)/_e[5],Ce=(_e[8]-1)/_e[0],L=(we[8]+1)/we[0],oe=Ee*Ce,X=Ee*L,ie=fe/(-Ce+L),J=ie*-Ce;G.matrixWorld.decompose(D.position,D.quaternion,D.scale),D.translateX(J),D.translateZ(ie),D.matrixWorld.compose(D.position,D.quaternion,D.scale),D.matrixWorldInverse.copy(D.matrixWorld).invert();let Se=Ee+ie,me=Te+ie,ye=oe-J,Ne=X+(fe-J),qe=Ye*Te/me*Se,rt=it*Te/me*Se;D.projectionMatrix.makePerspective(ye,Ne,qe,rt,Se,me),D.projectionMatrixInverse.copy(D.projectionMatrix).invert()}function q(D,G){G===null?D.matrixWorld.copy(D.matrix):D.matrixWorld.multiplyMatrices(G.matrixWorld,D.matrix),D.matrixWorldInverse.copy(D.matrixWorld).invert()}this.updateCamera=function(D){if(i===null)return;R.near=b.near=y.near=D.near,R.far=b.far=y.far=D.far,(I!==R.near||M!==R.far)&&(i.updateRenderState({depthNear:R.near,depthFar:R.far}),I=R.near,M=R.far);let G=D.parent,he=R.cameras;q(R,G);for(let fe=0;fe0&&(g.alphaTest.value=p.alphaTest);let v=e.get(p).envMap;if(v&&(g.envMap.value=v,g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap){g.lightMap.value=p.lightMap;let x=s._useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=p.lightMapIntensity*x,t(p.lightMap,g.lightMapTransform)}p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function c(g,p,v,x){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=x*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function l(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),e.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ft&&g.clearcoatNormalScale.value.negate())),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){let v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function G0(s,e,t,n){let i={},r={},a=[],o=t.isWebGL2?s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(v,x){let y=x.program;n.uniformBlockBinding(v,y)}function l(v,x){let y=i[v.id];y===void 0&&(m(v),y=h(v),i[v.id]=y,v.addEventListener("dispose",g));let b=x.program;n.updateUBOMapping(v,b);let w=e.render.frame;r[v.id]!==w&&(d(v),r[v.id]=w)}function h(v){let x=u();v.__bindingPointIndex=x;let y=s.createBuffer(),b=v.__size,w=v.usage;return s.bindBuffer(s.UNIFORM_BUFFER,y),s.bufferData(s.UNIFORM_BUFFER,b,w),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,x,y),y}function u(){for(let v=0;v0){w=y%b;let Y=b-w;w!==0&&Y-T.boundary<0&&(y+=b-w,M.__offset=y)}y+=T.storage}return w=y%b,w>0&&(y+=b-w),v.__size=y,v.__cache={},this}function _(v){let x={boundary:0,storage:0};return typeof v=="number"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),x}function g(v){let x=v.target;x.removeEventListener("dispose",g);let y=a.indexOf(x.__bindingPointIndex);a.splice(y,1),s.deleteBuffer(i[x.id]),delete i[x.id],delete r[x.id]}function p(){for(let v in i)s.deleteBuffer(i[v]);a=[],i={},r={}}return{bind:c,update:l,dispose:p}}var Ro=class{constructor(e={}){let{canvas:t=tp(),context:n=null,depth:i=!0,stencil:r=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let d;n!==null?d=n.getContextAttributes().alpha:d=a;let f=new Uint32Array(4),m=new Int32Array(4),_=null,g=null,p=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=vt,this._useLegacyLights=!1,this.toneMapping=Nn,this.toneMappingExposure=1;let x=this,y=!1,b=0,w=0,R=null,I=-1,M=null,T=new je,O=new je,Y=null,$=new pe(0),U=0,z=t.width,q=t.height,H=1,ne=null,W=null,K=new je(0,0,z,q),D=new je(0,0,z,q),G=!1,he=new Ps,fe=!1,_e=!1,we=null,Ee=new ze,Te=new Z,Ye=new A,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return R===null?H:1}let L=n;function oe(E,N){for(let V=0;V0?g=v[v.length-1]:g=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function jc(E,N,V,F){if(E.visible===!1)return;if(E.layers.test(N.layers)){if(E.isGroup)V=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(N);else if(E.isLight)g.pushLight(E),E.castShadow&&g.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||he.intersectsSprite(E)){F&&Ye.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Ee);let Ae=S.update(E),Ue=E.material;Ue.visible&&_.push(E,Ae,Ue,V,Ye.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||he.intersectsObject(E))){let Ae=S.update(E),Ue=E.material;if(F&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Ye.copy(E.boundingSphere.center)):(Ae.boundingSphere===null&&Ae.computeBoundingSphere(),Ye.copy(Ae.boundingSphere.center)),Ye.applyMatrix4(E.matrixWorld).applyMatrix4(Ee)),Array.isArray(Ue)){let De=Ae.groups;for(let We=0,Pe=De.length;We0&&Od(k,xe,N,V),F&&J.viewport(T.copy(F)),k.length>0&&ks(k,N,V),xe.length>0&&ks(xe,N,V),Ae.length>0&&ks(Ae,N,V),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Od(E,N,V,F){let k=ie.isWebGL2;we===null&&(we=new qt(1,1,{generateMipmaps:!0,type:X.has("EXT_color_buffer_half_float")?Ts:On,minFilter:li,samples:k?4:0})),x.getDrawingBufferSize(Te),k?we.setSize(Te.x,Te.y):we.setSize(Wr(Te.x),Wr(Te.y));let xe=x.getRenderTarget();x.setRenderTarget(we),x.getClearColor($),U=x.getClearAlpha(),U<1&&x.setClearColor(16777215,.5),x.clear();let Ae=x.toneMapping;x.toneMapping=Nn,ks(E,V,F),ye.updateMultisampleRenderTarget(we),ye.updateRenderTargetMipmap(we);let Ue=!1;for(let De=0,We=N.length;De0),Ve=!!V.morphAttributes.position,at=!!V.morphAttributes.normal,lt=!!V.morphAttributes.color,Ht=Nn;F.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Ht=x.toneMapping);let an=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,ut=an!==void 0?an.length:0,Xe=me.get(F),Sa=g.state.lights;if(fe===!0&&(_e===!0||E!==M)){let Bt=E===M&&F.id===I;Me.setState(F,E,Bt)}let dt=!1;F.version===Xe.__version?(Xe.needsLights&&Xe.lightsStateVersion!==Sa.state.version||Xe.outputColorSpace!==Ue||k.isInstancedMesh&&Xe.instancing===!1||!k.isInstancedMesh&&Xe.instancing===!0||k.isSkinnedMesh&&Xe.skinning===!1||!k.isSkinnedMesh&&Xe.skinning===!0||k.isInstancedMesh&&Xe.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Xe.instancingColor===!1&&k.instanceColor!==null||Xe.envMap!==De||F.fog===!0&&Xe.fog!==xe||Xe.numClippingPlanes!==void 0&&(Xe.numClippingPlanes!==Me.numPlanes||Xe.numIntersection!==Me.numIntersection)||Xe.vertexAlphas!==We||Xe.vertexTangents!==Pe||Xe.morphTargets!==Ve||Xe.morphNormals!==at||Xe.morphColors!==lt||Xe.toneMapping!==Ht||ie.isWebGL2===!0&&Xe.morphTargetsCount!==ut)&&(dt=!0):(dt=!0,Xe.__version=F.version);let Hn=Xe.currentProgram;dt===!0&&(Hn=Hs(F,N,k));let il=!1,os=!1,ba=!1,Ct=Hn.getUniforms(),Gn=Xe.uniforms;if(J.useProgram(Hn.program)&&(il=!0,os=!0,ba=!0),F.id!==I&&(I=F.id,os=!0),il||M!==E){Ct.setValue(L,"projectionMatrix",E.projectionMatrix),Ct.setValue(L,"viewMatrix",E.matrixWorldInverse);let Bt=Ct.map.cameraPosition;Bt!==void 0&&Bt.setValue(L,Ye.setFromMatrixPosition(E.matrixWorld)),ie.logarithmicDepthBuffer&&Ct.setValue(L,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(F.isMeshPhongMaterial||F.isMeshToonMaterial||F.isMeshLambertMaterial||F.isMeshBasicMaterial||F.isMeshStandardMaterial||F.isShaderMaterial)&&Ct.setValue(L,"isOrthographic",E.isOrthographicCamera===!0),M!==E&&(M=E,os=!0,ba=!0)}if(k.isSkinnedMesh){Ct.setOptional(L,k,"bindMatrix"),Ct.setOptional(L,k,"bindMatrixInverse");let Bt=k.skeleton;Bt&&(ie.floatVertexTextures?(Bt.boneTexture===null&&Bt.computeBoneTexture(),Ct.setValue(L,"boneTexture",Bt.boneTexture,ye),Ct.setValue(L,"boneTextureSize",Bt.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."))}let Ea=V.morphAttributes;if((Ea.position!==void 0||Ea.normal!==void 0||Ea.color!==void 0&&ie.isWebGL2===!0)&&Le.update(k,V,Hn),(os||Xe.receiveShadow!==k.receiveShadow)&&(Xe.receiveShadow=k.receiveShadow,Ct.setValue(L,"receiveShadow",k.receiveShadow)),F.isMeshGouraudMaterial&&F.envMap!==null&&(Gn.envMap.value=De,Gn.flipEnvMap.value=De.isCubeTexture&&De.isRenderTargetTexture===!1?-1:1),os&&(Ct.setValue(L,"toneMappingExposure",x.toneMappingExposure),Xe.needsLights&&Bd(Gn,ba),xe&&F.fog===!0&&ee.refreshFogUniforms(Gn,xe),ee.refreshMaterialUniforms(Gn,F,H,q,we),qi.upload(L,Xe.uniformsList,Gn,ye)),F.isShaderMaterial&&F.uniformsNeedUpdate===!0&&(qi.upload(L,Xe.uniformsList,Gn,ye),F.uniformsNeedUpdate=!1),F.isSpriteMaterial&&Ct.setValue(L,"center",k.center),Ct.setValue(L,"modelViewMatrix",k.modelViewMatrix),Ct.setValue(L,"normalMatrix",k.normalMatrix),Ct.setValue(L,"modelMatrix",k.matrixWorld),F.isShaderMaterial||F.isRawShaderMaterial){let Bt=F.uniformsGroups;for(let Ta=0,Vd=Bt.length;Ta0&&ye.useMultisampledRTT(E)===!1?k=me.get(E).__webglMultisampledFramebuffer:Array.isArray(Pe)?k=Pe[V]:k=Pe,T.copy(E.viewport),O.copy(E.scissor),Y=E.scissorTest}else T.copy(K).multiplyScalar(H).floor(),O.copy(D).multiplyScalar(H).floor(),Y=G;if(J.bindFramebuffer(L.FRAMEBUFFER,k)&&ie.drawBuffers&&F&&J.drawBuffers(E,k),J.viewport(T),J.scissor(O),J.setScissorTest(Y),xe){let De=me.get(E.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+N,De.__webglTexture,V)}else if(Ae){let De=me.get(E.texture),We=N||0;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,De.__webglTexture,V||0,We)}I=-1},this.readRenderTargetPixels=function(E,N,V,F,k,xe,Ae){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ue=me.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Ae!==void 0&&(Ue=Ue[Ae]),Ue){J.bindFramebuffer(L.FRAMEBUFFER,Ue);try{let De=E.texture,We=De.format,Pe=De.type;if(We!==Wt&&$e.convert(We)!==L.getParameter(L.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Ve=Pe===Ts&&(X.has("EXT_color_buffer_half_float")||ie.isWebGL2&&X.has("EXT_color_buffer_float"));if(Pe!==On&&$e.convert(Pe)!==L.getParameter(L.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Pe===xn&&(ie.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=E.width-F&&V>=0&&V<=E.height-k&&L.readPixels(N,V,F,k,$e.convert(We),$e.convert(Pe),xe)}finally{let De=R!==null?me.get(R).__webglFramebuffer:null;J.bindFramebuffer(L.FRAMEBUFFER,De)}}},this.copyFramebufferToTexture=function(E,N,V=0){let F=Math.pow(2,-V),k=Math.floor(N.image.width*F),xe=Math.floor(N.image.height*F);ye.setTexture2D(N,0),L.copyTexSubImage2D(L.TEXTURE_2D,V,0,0,E.x,E.y,k,xe),J.unbindTexture()},this.copyTextureToTexture=function(E,N,V,F=0){let k=N.image.width,xe=N.image.height,Ae=$e.convert(V.format),Ue=$e.convert(V.type);ye.setTexture2D(V,0),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,V.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,V.unpackAlignment),N.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,F,E.x,E.y,k,xe,Ae,Ue,N.image.data):N.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,F,E.x,E.y,N.mipmaps[0].width,N.mipmaps[0].height,Ae,N.mipmaps[0].data):L.texSubImage2D(L.TEXTURE_2D,F,E.x,E.y,Ae,Ue,N.image),F===0&&V.generateMipmaps&&L.generateMipmap(L.TEXTURE_2D),J.unbindTexture()},this.copyTextureToTexture3D=function(E,N,V,F,k=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let xe=E.max.x-E.min.x+1,Ae=E.max.y-E.min.y+1,Ue=E.max.z-E.min.z+1,De=$e.convert(F.format),We=$e.convert(F.type),Pe;if(F.isData3DTexture)ye.setTexture3D(F,0),Pe=L.TEXTURE_3D;else if(F.isDataArrayTexture)ye.setTexture2DArray(F,0),Pe=L.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,F.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,F.unpackAlignment);let Ve=L.getParameter(L.UNPACK_ROW_LENGTH),at=L.getParameter(L.UNPACK_IMAGE_HEIGHT),lt=L.getParameter(L.UNPACK_SKIP_PIXELS),Ht=L.getParameter(L.UNPACK_SKIP_ROWS),an=L.getParameter(L.UNPACK_SKIP_IMAGES),ut=V.isCompressedTexture?V.mipmaps[0]:V.image;L.pixelStorei(L.UNPACK_ROW_LENGTH,ut.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,ut.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,E.min.x),L.pixelStorei(L.UNPACK_SKIP_ROWS,E.min.y),L.pixelStorei(L.UNPACK_SKIP_IMAGES,E.min.z),V.isDataTexture||V.isData3DTexture?L.texSubImage3D(Pe,k,N.x,N.y,N.z,xe,Ae,Ue,De,We,ut.data):V.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),L.compressedTexSubImage3D(Pe,k,N.x,N.y,N.z,xe,Ae,Ue,De,ut.data)):L.texSubImage3D(Pe,k,N.x,N.y,N.z,xe,Ae,Ue,De,We,ut),L.pixelStorei(L.UNPACK_ROW_LENGTH,Ve),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,at),L.pixelStorei(L.UNPACK_SKIP_PIXELS,lt),L.pixelStorei(L.UNPACK_SKIP_ROWS,Ht),L.pixelStorei(L.UNPACK_SKIP_IMAGES,an),k===0&&F.generateMipmaps&&L.generateMipmap(Pe),J.unbindTexture()},this.initTexture=function(E){E.isCubeTexture?ye.setTextureCube(E,0):E.isData3DTexture?ye.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ye.setTexture2DArray(E,0):ye.setTexture2D(E,0),J.unbindTexture()},this.resetState=function(){b=0,w=0,R=null,J.reset(),Oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===qc?"display-p3":"srgb",t.unpackColorSpace=Qe.workingColorSpace===va?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===vt?ri:vd}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===ri?vt:Mn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},Co=class extends Ro{};Co.prototype.isWebGL1Renderer=!0;var Po=class s{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new pe(e),this.density=t}clone(){return new s(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},Lo=class s{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new pe(e),this.near=t,this.far=n}clone(){return new s(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Io=class extends Je{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){let 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}},Is=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hr,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=kt()}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,r=this.stride;ie.far||t.push({distance:c,point:ds.clone(),uv:Un.getInterpolation(ds,hr,ps,ur,Lh,ja,Ih,new Z),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function dr(s,e,t,n,i,r){Ni.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(fs.x=r*Ni.x-i*Ni.y,fs.y=i*Ni.x+r*Ni.y):fs.copy(Ni),s.copy(e),s.x+=fs.x,s.y+=fs.y,s.applyMatrix4(Cd)}var fr=new A,Uh=new A,Do=class extends Je{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){fr.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(fr);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){fr.setFromMatrixPosition(e.matrixWorld),Uh.setFromMatrixPosition(this.matrixWorld);let n=fr.distanceTo(Uh)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;ic)continue;d.applyMatrix4(this.matrixWorld);let I=e.ray.origin.distanceTo(d);Ie.far||t.push({distance:I,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{let p=Math.max(0,a.start),v=Math.min(g.count,a.start+a.count);for(let x=p,y=v-1;xc)continue;d.applyMatrix4(this.matrixWorld);let w=e.ray.origin.distanceTo(d);we.far||t.push({distance:w,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;ri.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,object:a})}}var Jh=class extends St{constructor(e,t,n,i,r,a,o,c,l){super(e,t,n,i,r,a,o,c,l),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:mt,this.magFilter=r!==void 0?r:mt,this.generateMipmaps=!1;let h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},$h=class extends St{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pt,this.minFilter=pt,this.generateMipmaps=!1,this.needsUpdate=!0}},Us=class extends St{constructor(e,t,n,i,r,a,o,c,l,h,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},Kh=class extends Us{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=It}},Qh=class extends Us{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,zn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},jh=class extends St{constructor(e,t,n,i,r,a,o,c,l){super(e,t,n,i,r,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},Zt=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,r=n.length,a;t?a=t:a=e*n[r-1];let o=0,c=r-1,l;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),l=n[i]-a,l<0)o=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===a)return i/(r-1);let h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let a=this.getPoint(i),o=this.getPoint(r),c=t||(a.isVector2?new Z:new A);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new A,i=[],r=[],a=[],o=new A,c=new ze;for(let f=0;f<=e;f++){let m=f/e;i[f]=this.getTangentAt(m,new A)}r[0]=new A,a[0]=new A;let l=Number.MAX_VALUE,h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();let m=Math.acos(ct(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(o,m))}a[f].crossVectors(i[f],r[f])}if(t===!0){let f=Math.acos(ct(r[0].dot(r[e]),-1,1));f/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(f=-f);for(let m=1;m<=e;m++)r[m].applyMatrix4(c.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],r[m])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Ds=class extends Zt{constructor(e=0,t=0,n=1,i=1,r=0,a=Math.PI*2,o=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=c}getPoint(e,t){let n=t||new Z,i=Math.PI*2,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(o)/r)+1)*r:c===0&&o===r-1&&(o=r-2,c=1);let l,h;this.closed||o>0?l=i[(o-1)%r]:(xr.subVectors(i[0],i[1]).add(i[0]),l=xr);let u=i[o%r],d=i[(o+1)%r];if(this.closed||o+2i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(eu(o,c.x,l.x,h.x,u.x),eu(o,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){let a=i[r]-n,o=this.curves[r],c=o.getLength(),l=c===0?0:1-a/c;return o.getPointAt(l,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},la=class s extends Ge{constructor(e=[new Z(0,-.5),new Z(.5,0),new Z(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=ct(i,0,Math.PI*2);let r=[],a=[],o=[],c=[],l=[],h=1/t,u=new A,d=new Z,f=new A,m=new A,_=new A,g=0,p=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),c.push(f.x,f.y,f.z);break;case e.length-1:c.push(_.x,_.y,_.z);break;default:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),c.push(f.x,f.y,f.z),_.copy(m)}for(let v=0;v<=t;v++){let x=n+v*h*i,y=Math.sin(x),b=Math.cos(x);for(let w=0;w<=e.length-1;w++){u.x=e[w].x*y,u.y=e[w].y,u.z=e[w].x*b,a.push(u.x,u.y,u.z),d.x=v/t,d.y=w/(e.length-1),o.push(d.x,d.y);let R=c[3*w+0]*y,I=c[3*w+1],M=c[3*w+0]*b;l.push(R,I,M)}}for(let v=0;v0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new ve(u,3)),this.setAttribute("normal",new ve(d,3)),this.setAttribute("uv",new ve(f,2));function v(){let y=new A,b=new A,w=0,R=(t-e)/n;for(let I=0;I<=r;I++){let M=[],T=I/r,O=T*(t-e)+e;for(let Y=0;Y<=i;Y++){let $=Y/i,U=$*c+o,z=Math.sin(U),q=Math.cos(U);b.x=O*z,b.y=-T*n+g,b.z=O*q,u.push(b.x,b.y,b.z),y.set(z,R,q).normalize(),d.push(y.x,y.y,y.z),f.push($,1-T),M.push(m++)}_.push(M)}for(let I=0;I.9&&R<.1&&(x<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),b<.2&&(a[v+4]+=1))}}function d(v){r.push(v.x,v.y,v.z)}function f(v,x){let y=v*3;x.x=e[y+0],x.y=e[y+1],x.z=e[y+2]}function m(){let v=new A,x=new A,y=new A,b=new A,w=new Z,R=new Z,I=new Z;for(let M=0,T=0;M80*t){o=l=s[0],c=h=s[1];for(let m=t;ml&&(l=u),d>h&&(h=d);f=Math.max(l-o,h-c),f=f!==0?32767/f:0}return Os(r,a,t,o,c,f,0),a}};function Pd(s,e,t,n,i){let r,a;if(i===gx(s,e,t,n)>0)for(r=e;r=e;r-=n)a=tu(r,s[r],s[r+1],a);return a&&Ma(a,a.next)&&(Bs(a),a=a.next),a}function fi(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Ma(t,t.next)||st(t.prev,t,t.next)===0)){if(Bs(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Os(s,e,t,n,i,r,a){if(!s)return;!a&&r&&hx(s,n,i,r);let o=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?nx(s,n,i,r):tx(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(l.i/t|0),Bs(s),s=l.next,o=l.next;continue}if(s=l,s===o){a?a===1?(s=ix(fi(s),e,t),Os(s,e,t,n,i,r,2)):a===2&&sx(s,e,t,n,i,r):Os(fi(s),e,t,n,i,r,1);break}}}function tx(s){let e=s.prev,t=s,n=s.next;if(st(e,t,n)>=0)return!1;let i=e.x,r=t.x,a=n.x,o=e.y,c=t.y,l=n.y,h=ir?i>a?i:a:r>a?r:a,f=o>c?o>l?o:l:c>l?c:l,m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Gi(i,o,r,c,a,l,m.x,m.y)&&st(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function nx(s,e,t,n){let i=s.prev,r=s,a=s.next;if(st(i,r,a)>=0)return!1;let o=i.x,c=r.x,l=a.x,h=i.y,u=r.y,d=a.y,f=oc?o>l?o:l:c>l?c:l,g=h>u?h>d?h:d:u>d?u:d,p=Ko(f,m,e,t,n),v=Ko(_,g,e,t,n),x=s.prevZ,y=s.nextZ;for(;x&&x.z>=p&&y&&y.z<=v;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Gi(o,h,c,u,l,d,x.x,x.y)&&st(x.prev,x,x.next)>=0||(x=x.prevZ,y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&Gi(o,h,c,u,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Gi(o,h,c,u,l,d,x.x,x.y)&&st(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&Gi(o,h,c,u,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function ix(s,e,t){let n=s;do{let i=n.prev,r=n.next.next;!Ma(i,r)&&Ld(i,n,n.next,r)&&Fs(i,r)&&Fs(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Bs(n),Bs(n.next),n=s=r),n=n.next}while(n!==s);return fi(n)}function sx(s,e,t,n,i,r){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&fx(a,o)){let c=Id(a,o);a=fi(a,a.next),c=fi(c,c.next),Os(a,e,t,n,i,r,0),Os(c,e,t,n,i,r,0);return}o=o.next}a=a.next}while(a!==s)}function rx(s,e,t,n){let i=[],r,a,o,c,l;for(r=0,a=e.length;r=t.next.y&&t.next.y!==t.y){let d=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x=t.x&&t.x>=c&&r!==t.x&&Gi(ai.x||t.x===i.x&&lx(i,t)))&&(i=t,h=u)),t=t.next;while(t!==o);return i}function lx(s,e){return st(s.prev,s,e.prev)<0&&st(e.next,s,s.next)<0}function hx(s,e,t,n){let i=s;do i.z===0&&(i.z=Ko(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,ux(i)}function ux(s){let e,t,n,i,r,a,o,c,l=1;do{for(t=s,s=null,r=null,a=0;t;){for(a++,n=t,o=0,e=0;e0||c>0&&n;)o!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(a>1);return s}function Ko(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function dx(s){let e=s,t=s;do(e.x=(s-a)*(r-o)&&(s-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(i-a)*(n-o)}function fx(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!px(s,e)&&(Fs(s,e)&&Fs(e,s)&&mx(s,e)&&(st(s.prev,s,e.prev)||st(s,e.prev,e))||Ma(s,e)&&st(s.prev,s,s.next)>0&&st(e.prev,e,e.next)>0)}function st(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Ma(s,e){return s.x===e.x&&s.y===e.y}function Ld(s,e,t,n){let i=br(st(s,e,t)),r=br(st(s,e,n)),a=br(st(t,n,s)),o=br(st(t,n,e));return!!(i!==r&&a!==o||i===0&&Sr(s,t,e)||r===0&&Sr(s,n,e)||a===0&&Sr(t,s,n)||o===0&&Sr(t,e,n))}function Sr(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function br(s){return s>0?1:s<0?-1:0}function px(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&Ld(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Fs(s,e){return st(s.prev,s,s.next)<0?st(s,e,s.next)>=0&&st(s,s.prev,e)>=0:st(s,e,s.prev)<0||st(s,s.next,e)<0}function mx(s,e){let t=s,n=!1,i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function Id(s,e){let t=new Qo(s.i,s.x,s.y),n=new Qo(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function tu(s,e,t,n){let i=new Qo(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Bs(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Qo(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gx(s,e,t,n){let i=0;for(let r=e,a=t-n;r2&&s[e-1].equals(s[0])&&s.pop()}function iu(s,e){for(let t=0;tNumber.EPSILON){let S=Math.sqrt(rt),B=Math.sqrt(Ne*Ne+qe*qe),ee=oe.x-ye/S,j=oe.y+me/S,te=X.x-qe/B,Me=X.y+Ne/B,re=((te-ee)*qe-(Me-j)*Ne)/(me*qe-ye*Ne);ie=ee+me*re-L.x,J=j+ye*re-L.y;let de=ie*ie+J*J;if(de<=2)return new Z(ie,J);Se=Math.sqrt(de/2)}else{let S=!1;me>Number.EPSILON?Ne>Number.EPSILON&&(S=!0):me<-Number.EPSILON?Ne<-Number.EPSILON&&(S=!0):Math.sign(ye)===Math.sign(qe)&&(S=!0),S?(ie=-ye,J=me,Se=Math.sqrt(rt)):(ie=me,J=ye,Se=Math.sqrt(rt/2))}return new Z(ie/Se,J/Se)}let W=[];for(let L=0,oe=U.length,X=oe-1,ie=L+1;L=0;L--){let oe=L/g,X=f*Math.cos(oe*Math.PI/2),ie=m*Math.sin(oe*Math.PI/2)+_;for(let J=0,Se=U.length;J=0;){let ie=X,J=X-1;J<0&&(J=L.length-1);for(let Se=0,me=h+g*2;Se0)&&f.push(x,y,w),(p!==n-1||c0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},uc=class extends bt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=xa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},dc=class extends bt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},fc=class extends bt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},pc=class extends bt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=xa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},mc=class extends bt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=mi,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}},gc=class extends wt{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function ni(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Ud(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Dd(s){function e(i,r){return s[i]-s[r]}let t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function _c(s,e,t){let n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){let o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function $c(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push.apply(t,a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}function yx(s,e,t,n,i=30){let r=s.clone();r.name=e;let a=[];for(let c=0;c=n)){u.push(l.times[f]);for(let _=0;_r.tracks[c].times[0]&&(o=r.tracks[c].times[0]);for(let c=0;c=o.times[m]){let p=m*u+h,v=p+u-h;_=o.values.slice(p,v)}else{let p=o.createInterpolant(),v=h,x=u-h;p.evaluate(r),_=p.resultBuffer.slice(v,x)}c==="quaternion"&&new Ut().fromArray(_).normalize().conjugate().toArray(_);let g=l.times.length;for(let p=0;p=r)){let o=t[1];e=r)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Ud(i))for(let o=0,c=i.length;o!==c;++o){let l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===La,r=e.length-1,a=1;for(let o=1;o0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Jt.prototype.TimeBufferType=Float32Array;Jt.prototype.ValueBufferType=Float32Array;Jt.prototype.DefaultInterpolation=Fr;var Vn=class extends Jt{};Vn.prototype.ValueTypeName="bool";Vn.prototype.ValueBufferType=Array;Vn.prototype.DefaultInterpolation=Or;Vn.prototype.InterpolantFactoryMethodLinear=void 0;Vn.prototype.InterpolantFactoryMethodSmooth=void 0;var pa=class extends Jt{};pa.prototype.ValueTypeName="color";var ts=class extends Jt{};ts.prototype.ValueTypeName="number";var yc=class extends es{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t),l=e*o;for(let h=l+o;l!==h;l+=4)Ut.slerpFlat(r,0,a,l-o,a,l,c);return r}},pi=class extends Jt{InterpolantFactoryMethodLinear(e){return new yc(this.times,this.values,this.getValueSize(),e)}};pi.prototype.ValueTypeName="quaternion";pi.prototype.DefaultInterpolation=Fr;pi.prototype.InterpolantFactoryMethodSmooth=void 0;var kn=class extends Jt{};kn.prototype.ValueTypeName="string";kn.prototype.ValueBufferType=Array;kn.prototype.DefaultInterpolation=Or;kn.prototype.InterpolantFactoryMethodLinear=void 0;kn.prototype.InterpolantFactoryMethodSmooth=void 0;var ns=class extends Jt{};ns.prototype.ValueTypeName="vector";var is=class{constructor(e,t=-1,n,i=Xc){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=kt(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(bx(n[a]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,a=n.length;r!==a;++r)t.push(Jt.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let o=0;o1){let u=h[1],d=i[u];d||(i[u]=d=[]),d.push(l)}}let a=[];for(let o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(u,d,f,m,_){if(f.length!==0){let g=[],p=[];$c(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u{t&&t(r),this.manager.itemEnd(e)},0),r;if(fn[e]!==void 0){fn[e].push({onLoad:t,onProgress:n,onError:i});return}fn[e]=[],fn[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=fn[e],u=l.body.getReader(),d=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),f=d?parseInt(d):0,m=f!==0,_=0,g=new ReadableStream({start(p){v();function v(){u.read().then(({done:x,value:y})=>{if(x)p.close();else{_+=y.byteLength;let b=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let w=0,R=h.length;w{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o===void 0)return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(m=>f.decode(m))}}}).then(l=>{ss.add(e,l);let h=fn[e];delete fn[e];for(let u=0,d=h.length;u{let h=fn[e];if(h===void 0)throw this.manager.itemError(e),l;delete fn[e];for(let u=0,d=h.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},au=class extends Dt{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new rn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(r.parse(JSON.parse(o)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){let t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let r in e.uniforms){let a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=new pe().setHex(a.value);break;case"v2":i.uniforms[r].value=new Z().fromArray(a.value);break;case"v3":i.uniforms[r].value=new A().fromArray(a.value);break;case"v4":i.uniforms[r].value=new je().fromArray(a.value);break;case"m3":i.uniforms[r].value=new He().fromArray(a.value);break;case"m4":i.uniforms[r].value=new ze().fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(let r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new Z().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Z().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){let t={ShadowMaterial:cc,SpriteMaterial:ea,RawShaderMaterial:lc,ShaderMaterial:jt,PointsMaterial:na,MeshPhysicalMaterial:hc,MeshStandardMaterial:da,MeshPhongMaterial:uc,MeshToonMaterial:dc,MeshNormalMaterial:fc,MeshLambertMaterial:pc,MeshDepthMaterial:Qr,MeshDistanceMaterial:jr,MeshBasicMaterial:Sn,MeshMatcapMaterial:mc,LineDashedMaterial:gc,LineBasicMaterial:wt,Material:bt};return new t[e]}},ga=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){let c=new ma(t);r=new rs(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;l0){i=new rs(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a"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);let r=this,a=ss.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){ss.add(e,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){i&&i(c),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}},Er,_a=class{static getContext(){return Er===void 0&&(Er=new(window.AudioContext||window.webkitAudioContext)),Er}static setContext(e){Er=e}},xu=class extends Dt{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new rn(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{let l=c.slice(0);_a.getContext().decodeAudioData(l,function(u){t(u)},o)}catch(l){o(l)}},n,i);function o(c){i?i(c):console.error(c),r.manager.itemError(e)}}},vu=new ze,yu=new ze,Zn=new ze,Mu=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new yt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new yt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Zn.copy(e.projectionMatrix);let i=t.eyeSep/2,r=i*t.near/t.focus,a=t.near*Math.tan(ai*t.fov*.5)/t.zoom,o,c;yu.elements[12]=-i,vu.elements[12]=i,o=-a*t.aspect+r,c=a*t.aspect+r,Zn.elements[0]=2*t.near/(c-o),Zn.elements[8]=(c+o)/(c-o),this.cameraL.projectionMatrix.copy(Zn),o=-a*t.aspect-r,c=a*t.aspect-r,Zn.elements[0]=2*t.near/(c-o),Zn.elements[8]=(c+o)/(c-o),this.cameraR.projectionMatrix.copy(Zn)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(vu)}},Oc=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Su(),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){let t=Su();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Su(){return(typeof performance>"u"?Date:performance).now()}var Jn=new A,bu=new Ut,wx=new A,$n=new A,Eu=class extends Je{constructor(){super(),this.type="AudioListener",this.context=_a.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Oc}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Jn,bu,wx),$n.set(0,0,-1).applyQuaternion(bu),t.positionX){let i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Jn.x,i),t.positionY.linearRampToValueAtTime(Jn.y,i),t.positionZ.linearRampToValueAtTime(Jn.z,i),t.forwardX.linearRampToValueAtTime($n.x,i),t.forwardY.linearRampToValueAtTime($n.y,i),t.forwardZ.linearRampToValueAtTime($n.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Jn.x,Jn.y,Jn.z),t.setOrientation($n.x,$n.y,$n.z,n.x,n.y,n.z)}},Fc=class extends Je{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Ut.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;Ut.multiplyQuaternionsFlat(e,a,e,t,e,n),Ut.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let o=0;o!==r;++o){let c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let o=t+a;e[o]=e[o]+e[n+a]*i}}},Kc="\\[\\]\\.:\\/",Rx=new RegExp("["+Kc+"]","g"),Qc="[^"+Kc+"]",Cx="[^"+Kc.replace("\\.","")+"]",Px=/((?:WC+[\/:])*)/.source.replace("WC",Qc),Lx=/(WCOD+)?/.source.replace("WCOD",Cx),Ix=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qc),Ux=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qc),Dx=new RegExp("^"+Px+Lx+Ix+Ux+"$"),Nx=["material","materials","bones","map"],zc=class{constructor(e,t,n){let i=n||Ke.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Ke=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.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 s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Rx,"")}static parseTrackName(e){let t=Dx.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let 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){let r=n.nodeName.substring(i+1);Nx.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let a=0;a=r){let u=r++,d=e[u];t[d.uuid]=h,e[h]=d,t[l]=u,e[u]=c;for(let f=0,m=i;f!==m;++f){let _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=r}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=e.length;for(let o=0,c=arguments.length;o!==c;++o){let l=arguments[o],h=l.uuid,u=t[h];if(u!==void 0)if(delete t[h],u0&&(t[f.uuid]=u),e[u]=f,e.pop();for(let m=0,_=i;m!==_;++m){let g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(i!==void 0)return r[i];let a=this._paths,o=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(u);for(let d=h,f=c.length;d!==f;++d){let m=c[d];u[d]=new Ke(m,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,c=a[o],l=e[o];t[l]=n,a[n]=c,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}},Vc=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let r=t.tracks,a=r.length,o=new Array(a),c={endingStart:zi,endingEnd:zi};for(let l=0;l!==a;++l){let h=r[l].createInterpolant(null);o[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Af,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){let i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){let 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){let i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);let c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let 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}let r=this._startTime;if(r!==null){let c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case xd:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Xc:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let 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;let n=this._timeScaleInterpolant;if(n!==null){let 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){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===Rf;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===wf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){let o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);let c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=Vi,i.endingEnd=Vi):(e?i.endingStart=this.zeroSlopeAtStart?Vi:zi:i.endingStart=Br,t?i.endingEnd=this.zeroSlopeAtEnd?Vi:zi:i.endingEnd=Br)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,c=a.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=n,this}},Ox=new Float32Array(1),Cu=class extends sn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let d=i[u],f=d.name,m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,c,f));continue}let _=t&&t._propertyBindings[u].binding.parsedPath;m=new Bc(Ke.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,c,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let 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){let t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,a);let o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}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}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))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Bu).distanceTo(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}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)}},Vu=new A,Tr=new A,ku=class{constructor(e=new A,t=new A){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Vu.subVectors(e,this.start),Tr.subVectors(this.end,this.start);let n=Tr.dot(Tr),r=Tr.dot(Vu)/n;return t&&(r=ct(r,0,1)),r}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},Hu=new A,Gu=class extends Je{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let n=new Ge,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,c=32;a1)for(let u=0;u.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{sd.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(sd,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},ad=class extends en{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ge;i.setAttribute("position",new ve(t,3)),i.setAttribute("color",new ve(n,3));let r=new wt({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){let i=new pe,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},od=class{constructor(){this.type="ShapePath",this.color=new pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ji,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){let v=[];for(let x=0,y=p.length;xNumber.EPSILON){if(T<0&&(R=v[w],M=-M,I=v[b],T=-T),p.yI.y)continue;if(p.y===R.y){if(p.x===R.x)return!0}else{let O=T*(p.x-R.x)-M*(p.y-R.y);if(O===0)return!0;if(O<0)continue;y=!y}}else{if(p.y!==R.y)continue;if(I.x<=p.x&&p.x<=R.x||R.x<=p.x&&p.x<=I.x)return!0}}return y}let i=yn.isClockWise,r=this.subPaths;if(r.length===0)return[];let a,o,c,l=[];if(r.length===1)return o=r[0],c=new Fn,c.curves=o.curves,l.push(c),l;let h=!i(r[0].getPoints());h=e?!h:h;let u=[],d=[],f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,v=r.length;p1){let p=!1,v=0;for(let x=0,y=d.length;x0&&p===!1&&(f=u)}let g;for(let p=0,v=d.length;p> 8 & 255] + Et[s1 >> 16 & 255] + Et[s1 >> 24 & 255] + "-" + Et[e & 255] + Et[e >> 8 & 255] + "-" + Et[e >> 16 & 15 | 64] + Et[e >> 24 & 255] + "-" + Et[t & 63 | 128] + Et[t >> 8 & 255] + "-" + Et[t >> 16 & 255] + Et[t >> 24 & 255] + Et[n & 255] + Et[n >> 8 & 255] + Et[n >> 16 & 255] + Et[n >> 24 & 255]).toLowerCase(); +], ua = 1234567, De = Math.PI / 180, Ui = 180 / Math.PI; +function It() { + let h = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0; + return (ut[h & 255] + ut[h >> 8 & 255] + ut[h >> 16 & 255] + ut[h >> 24 & 255] + "-" + ut[t & 255] + ut[t >> 8 & 255] + "-" + ut[t >> 16 & 15 | 64] + ut[t >> 24 & 255] + "-" + ut[e & 63 | 128] + ut[e >> 8 & 255] + "-" + ut[e >> 16 & 255] + ut[e >> 24 & 255] + ut[i & 255] + ut[i >> 8 & 255] + ut[i >> 16 & 255] + ut[i >> 24 & 255]).toLowerCase(); } -function ct(s1, e, t) { - return Math.max(e, Math.min(t, s1)); +function N(h, t, e) { + return Math.max(t, Math.min(e, h)); } -function Yc(s1, e) { - return (s1 % e + e) % e; +function qo(h, t) { + return (h % t + t) % t; } -function kf(s1, e, t, n, i) { - return n + (s1 - e) * (i - n) / (t - e); +function Zc(h, t, e, i, s) { + return i + (h - t) * (s - i) / (e - t); } -function Hf(s1, e, t) { - return s1 !== e ? (t - s1) / (e - s1) : 0; +function Yc(h, t, e) { + return h !== t ? (e - h) / (t - h) : 0; } -function ys(s1, e, t) { - return (1 - t) * s1 + t * e; +function Ni(h, t, e) { + return (1 - e) * h + e * t; } -function Gf(s1, e, t, n) { - return ys(s1, e, 1 - Math.exp(-t * n)); +function $c(h, t, e, i) { + return Ni(h, t, 1 - Math.exp(-e * i)); } -function Wf(s1, e = 1) { - return e - Math.abs(Yc(s1, e * 2) - e); +function Qc(h, t = 1) { + return t - Math.abs(qo(h, t * 2) - t); } -function Xf(s1, e, t) { - return s1 <= e ? 0 : s1 >= t ? 1 : (s1 = (s1 - e) / (t - e), s1 * s1 * (3 - 2 * s1)); +function jc(h, t, e) { + return h <= t ? 0 : h >= e ? 1 : (h = (h - t) / (e - t), h * h * (3 - 2 * h)); } -function qf(s1, e, t) { - return s1 <= e ? 0 : s1 >= t ? 1 : (s1 = (s1 - e) / (t - e), s1 * s1 * s1 * (s1 * (s1 * 6 - 15) + 10)); +function Kc(h, t, e) { + return h <= t ? 0 : h >= e ? 1 : (h = (h - t) / (e - t), h * h * h * (h * (h * 6 - 15) + 10)); } -function Yf(s1, e) { - return s1 + Math.floor(Math.random() * (e - s1 + 1)); +function tu(h, t) { + return h + Math.floor(Math.random() * (t - h + 1)); } -function Zf(s1, e) { - return s1 + Math.random() * (e - s1); +function eu(h, t) { + return h + Math.random() * (t - h); } -function Jf(s1) { - return s1 * (.5 - Math.random()); +function iu(h) { + return h * (.5 - Math.random()); } -function $f(s1) { - s1 !== void 0 && (Fl = s1); - let e = Fl += 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 su(h) { + h !== void 0 && (ua = h); + let t = ua += 1831565813; + return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296; } -function Kf(s1) { - return s1 * ai; +function nu(h) { + return h * De; } -function Qf(s1) { - return s1 * Zi; +function ru(h) { + return h * Ui; } -function mo(s1) { - return (s1 & s1 - 1) === 0 && s1 !== 0; +function ou(h) { + return (h & h - 1) === 0 && h !== 0; } -function yd(s1) { - return Math.pow(2, Math.ceil(Math.log(s1) / Math.LN2)); +function au(h) { + return Math.pow(2, Math.ceil(Math.log(h) / Math.LN2)); } -function Wr(s1) { - return Math.pow(2, Math.floor(Math.log(s1) / Math.LN2)); +function hu(h) { + return Math.pow(2, Math.floor(Math.log(h) / Math.LN2)); } -function jf(s1, e, t, n, i) { - let r = Math.cos, a = Math.sin, o = r(t / 2), c = a(t / 2), l = r((e + n) / 2), h = a((e + n) / 2), u = r((e - n) / 2), d = a((e - n) / 2), f = r((n - e) / 2), m = a((n - e) / 2); - switch(i){ +function lu(h, t, e, i, s) { + let n = Math.cos, r = Math.sin, o = n(e / 2), a = r(e / 2), l = n((t + i) / 2), c = r((t + i) / 2), u = n((t - i) / 2), d = r((t - i) / 2), p = n((i - t) / 2), f = r((i - t) / 2); + switch(s){ case "XYX": - s1.set(o * h, c * u, c * d, o * l); + h.set(o * c, a * u, a * d, o * l); break; case "YZY": - s1.set(c * d, o * h, c * u, o * l); + h.set(a * d, o * c, a * u, o * l); break; case "ZXZ": - s1.set(c * u, c * d, o * h, o * l); + h.set(a * u, a * d, o * c, o * l); break; case "XZX": - s1.set(o * h, c * m, c * f, o * l); + h.set(o * c, a * f, a * p, o * l); break; case "YXY": - s1.set(c * f, o * h, c * m, o * l); + h.set(a * p, o * c, a * f, o * l); break; case "ZYZ": - s1.set(c * m, c * f, o * h, o * l); + h.set(a * f, a * p, o * c, o * l); break; default: - console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i); + console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + s); } } -function Ot(s1, e) { - switch(e.constructor){ +function xt(h, t) { + switch(t.constructor){ case Float32Array: - return s1; + return h; case Uint32Array: - return s1 / 4294967295; + return h / 4294967295; case Uint16Array: - return s1 / 65535; + return h / 65535; case Uint8Array: - return s1 / 255; + return h / 255; case Int32Array: - return Math.max(s1 / 2147483647, -1); + return Math.max(h / 2147483647, -1); case Int16Array: - return Math.max(s1 / 32767, -1); + return Math.max(h / 32767, -1); case Int8Array: - return Math.max(s1 / 127, -1); + return Math.max(h / 127, -1); default: throw new Error("Invalid component type."); } } -function Be(s1, e) { - switch(e.constructor){ +function V(h, t) { + switch(t.constructor){ case Float32Array: - return s1; + return h; case Uint32Array: - return Math.round(s1 * 4294967295); + return Math.round(h * 4294967295); case Uint16Array: - return Math.round(s1 * 65535); + return Math.round(h * 65535); case Uint8Array: - return Math.round(s1 * 255); + return Math.round(h * 255); case Int32Array: - return Math.round(s1 * 2147483647); + return Math.round(h * 2147483647); case Int16Array: - return Math.round(s1 * 32767); + return Math.round(h * 32767); case Int8Array: - return Math.round(s1 * 127); + return Math.round(h * 127); default: throw new Error("Invalid component type."); } } -var yv = { - DEG2RAD: ai, - RAD2DEG: Zi, - generateUUID: kt, - clamp: ct, - euclideanModulo: Yc, - mapLinear: kf, - inverseLerp: Hf, - lerp: ys, - damp: Gf, - pingpong: Wf, - smoothstep: Xf, - smootherstep: qf, - randInt: Yf, - randFloat: Zf, - randFloatSpread: Jf, - seededRandom: $f, - degToRad: Kf, - radToDeg: Qf, - isPowerOfTwo: mo, - ceilPowerOfTwo: yd, - floorPowerOfTwo: Wr, - setQuaternionFromProperEuler: jf, - normalize: Be, - denormalize: Ot -}, Z = class s1 { - constructor(e = 0, t = 0){ - s1.prototype.isVector2 = !0, this.x = e, this.y = t; +var Tf = { + DEG2RAD: De, + RAD2DEG: Ui, + generateUUID: It, + clamp: N, + euclideanModulo: qo, + mapLinear: Zc, + inverseLerp: Yc, + lerp: Ni, + damp: $c, + pingpong: Qc, + smoothstep: jc, + smootherstep: Kc, + randInt: tu, + randFloat: eu, + randFloatSpread: iu, + seededRandom: su, + degToRad: nu, + radToDeg: ru, + isPowerOfTwo: ou, + ceilPowerOfTwo: au, + floorPowerOfTwo: hu, + setQuaternionFromProperEuler: lu, + normalize: V, + denormalize: xt +}, T = class h { + constructor(t = 0, e = 0){ + h.prototype.isVector2 = !0, this.x = t, this.y = e; } get width() { return this.x; } - set width(e) { - this.x = e; + set width(t) { + this.x = t; } get height() { return this.y; } - set height(e) { - this.y = e; + set height(t) { + this.y = t; } - set(e, t) { - return this.x = e, this.y = t, this; + set(t, e) { + return this.x = t, this.y = e, this; } - setScalar(e) { - return this.x = e, this.y = e, this; + setScalar(t) { + return this.x = t, this.y = t, this; } - setX(e) { - return this.x = e, this; + setX(t) { + return this.x = t, this; } - setY(e) { - return this.y = e, this; + setY(t) { + return this.y = t, this; } - setComponent(e, t) { - switch(e){ + setComponent(t, e) { + switch(t){ case 0: - this.x = t; + this.x = e; break; case 1: - this.y = t; + this.y = e; break; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } return this; } - getComponent(e) { - switch(e){ + getComponent(t) { + switch(t){ case 0: return this.x; case 1: return this.y; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } } clone() { return new this.constructor(this.x, this.y); } - copy(e) { - return this.x = e.x, this.y = e.y, this; + copy(t) { + return this.x = t.x, this.y = t.y, this; } - add(e) { - return this.x += e.x, this.y += e.y, this; + add(t) { + return this.x += t.x, this.y += t.y, this; } - addScalar(e) { - return this.x += e, this.y += e, this; + addScalar(t) { + return this.x += t, this.y += t, this; } - addVectors(e, t) { - return this.x = e.x + t.x, this.y = e.y + t.y, this; + addVectors(t, e) { + return this.x = t.x + e.x, this.y = t.y + e.y, this; } - addScaledVector(e, t) { - return this.x += e.x * t, this.y += e.y * t, this; + addScaledVector(t, e) { + return this.x += t.x * e, this.y += t.y * e, this; } - sub(e) { - return this.x -= e.x, this.y -= e.y, this; + sub(t) { + return this.x -= t.x, this.y -= t.y, this; } - subScalar(e) { - return this.x -= e, this.y -= e, this; + subScalar(t) { + return this.x -= t, this.y -= t, this; } - subVectors(e, t) { - return this.x = e.x - t.x, this.y = e.y - t.y, this; + subVectors(t, e) { + return this.x = t.x - e.x, this.y = t.y - e.y, this; } - multiply(e) { - return this.x *= e.x, this.y *= e.y, this; + multiply(t) { + return this.x *= t.x, this.y *= t.y, this; } - multiplyScalar(e) { - return this.x *= e, this.y *= e, this; + multiplyScalar(t) { + return this.x *= t, this.y *= t, this; } - divide(e) { - return this.x /= e.x, this.y /= e.y, this; + divide(t) { + return this.x /= t.x, this.y /= t.y, this; } - divideScalar(e) { - return this.multiplyScalar(1 / e); + divideScalar(t) { + return this.multiplyScalar(1 / t); } - applyMatrix3(e) { - let 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; + applyMatrix3(t) { + let e = this.x, i = this.y, s = t.elements; + return this.x = s[0] * e + s[3] * i + s[6], this.y = s[1] * e + s[4] * i + s[7], this; } - min(e) { - return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this; + min(t) { + return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this; } - max(e) { - return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this; + max(t) { + return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.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; + clamp(t, e) { + return this.x = N(this.x, t.x, e.x), this.y = N(this.y, t.y, e.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; + clampScalar(t, e) { + return this.x = N(this.x, t, e), this.y = N(this.y, t, e), this; } - clampLength(e, t) { - let n = this.length(); - return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))); + clampLength(t, e) { + let i = this.length(); + return this.divideScalar(i || 1).multiplyScalar(N(i, t, e)); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this; @@ -576,11 +580,11 @@ var yv = { negate() { return this.x = -this.x, this.y = -this.y, this; } - dot(e) { - return this.x * e.x + this.y * e.y; + dot(t) { + return this.x * t.x + this.y * t.y; } - cross(e) { - return this.x * e.y - this.y * e.x; + cross(t) { + return this.x * t.y - this.y * t.x; } lengthSq() { return this.x * this.x + this.y * this.y; @@ -597,46 +601,46 @@ var yv = { angle() { return Math.atan2(-this.y, -this.x) + Math.PI; } - angleTo(e) { - let t = Math.sqrt(this.lengthSq() * e.lengthSq()); - if (t === 0) return Math.PI / 2; - let n = this.dot(e) / t; - return Math.acos(ct(n, -1, 1)); + angleTo(t) { + let e = Math.sqrt(this.lengthSq() * t.lengthSq()); + if (e === 0) return Math.PI / 2; + let i = this.dot(t) / e; + return Math.acos(N(i, -1, 1)); } - distanceTo(e) { - return Math.sqrt(this.distanceToSquared(e)); + distanceTo(t) { + return Math.sqrt(this.distanceToSquared(t)); } - distanceToSquared(e) { - let t = this.x - e.x, n = this.y - e.y; - return t * t + n * n; + distanceToSquared(t) { + let e = this.x - t.x, i = this.y - t.y; + return e * e + i * i; } - manhattanDistanceTo(e) { - return Math.abs(this.x - e.x) + Math.abs(this.y - e.y); + manhattanDistanceTo(t) { + return Math.abs(this.x - t.x) + Math.abs(this.y - t.y); } - setLength(e) { - return this.normalize().multiplyScalar(e); + setLength(t) { + return this.normalize().multiplyScalar(t); } - lerp(e, t) { - return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this; + lerp(t, e) { + return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, 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; + lerpVectors(t, e, i) { + return this.x = t.x + (e.x - t.x) * i, this.y = t.y + (e.y - t.y) * i, this; } - equals(e) { - return e.x === this.x && e.y === this.y; + equals(t) { + return t.x === this.x && t.y === this.y; } - fromArray(e, t = 0) { - return this.x = e[t], this.y = e[t + 1], this; + fromArray(t, e = 0) { + return this.x = t[e], this.y = t[e + 1], this; } - toArray(e = [], t = 0) { - return e[t] = this.x, e[t + 1] = this.y, e; + toArray(t = [], e = 0) { + return t[e] = this.x, t[e + 1] = this.y, t; } - fromBufferAttribute(e, t) { - return this.x = e.getX(t), this.y = e.getY(t), this; + fromBufferAttribute(t, e) { + return this.x = t.getX(e), this.y = t.getY(e), this; } - rotateAround(e, t) { - let n = Math.cos(t), i = Math.sin(t), r = this.x - e.x, a = this.y - e.y; - return this.x = r * n - a * i + e.x, this.y = r * i + a * n + e.y, this; + rotateAround(t, e) { + let i = Math.cos(e), s = Math.sin(e), n = this.x - t.x, r = this.y - t.y; + return this.x = n * i - r * s + t.x, this.y = n * s + r * i + t.y, this; } random() { return this.x = Math.random(), this.y = Math.random(), this; @@ -644,9 +648,9 @@ var yv = { *[Symbol.iterator]() { yield this.x, yield this.y; } -}, He = class s1 { - constructor(e, t, n, i, r, a, o, c, l){ - s1.prototype.isMatrix3 = !0, this.elements = [ +}, Gt = class h { + constructor(t, e, i, s, n, r, o, a, l){ + h.prototype.isMatrix3 = !0, this.elements = [ 1, 0, 0, @@ -656,106 +660,106 @@ var yv = { 0, 0, 1 - ], e !== void 0 && this.set(e, t, n, i, r, a, o, c, l); + ], t !== void 0 && this.set(t, e, i, s, n, r, o, a, l); } - set(e, t, n, i, r, a, o, c, l) { - let h = this.elements; - return h[0] = e, h[1] = i, h[2] = o, h[3] = t, h[4] = r, h[5] = c, h[6] = n, h[7] = a, h[8] = l, this; + set(t, e, i, s, n, r, o, a, l) { + let c = this.elements; + return c[0] = t, c[1] = s, c[2] = o, c[3] = e, c[4] = n, c[5] = a, c[6] = i, c[7] = r, c[8] = l, this; } identity() { return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this; } - copy(e) { - let 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; + copy(t) { + let e = this.elements, i = t.elements; + return e[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], this; } - extractBasis(e, t, n) { - return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this; + extractBasis(t, e, i) { + return t.setFromMatrix3Column(this, 0), e.setFromMatrix3Column(this, 1), i.setFromMatrix3Column(this, 2), this; } - setFromMatrix4(e) { - let 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; + setFromMatrix4(t) { + let e = t.elements; + return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]), this; } - multiply(e) { - return this.multiplyMatrices(this, e); + multiply(t) { + return this.multiplyMatrices(this, t); } - premultiply(e) { - return this.multiplyMatrices(e, this); + premultiply(t) { + return this.multiplyMatrices(t, this); } - multiplyMatrices(e, t) { - let n = e.elements, i = t.elements, r = this.elements, a = n[0], o = n[3], c = n[6], l = n[1], h = n[4], u = n[7], d = n[2], f = n[5], m = n[8], _ = i[0], g = i[3], p = i[6], v = i[1], x1 = i[4], y1 = i[7], b = i[2], w = i[5], R = i[8]; - return r[0] = a * _ + o * v + c * b, r[3] = a * g + o * x1 + c * w, r[6] = a * p + o * y1 + c * R, r[1] = l * _ + h * v + u * b, r[4] = l * g + h * x1 + u * w, r[7] = l * p + h * y1 + u * R, r[2] = d * _ + f * v + m * b, r[5] = d * g + f * x1 + m * w, r[8] = d * p + f * y1 + m * R, this; + multiplyMatrices(t, e) { + let i = t.elements, s = e.elements, n = this.elements, r = i[0], o = i[3], a = i[6], l = i[1], c = i[4], u = i[7], d = i[2], p = i[5], f = i[8], m = s[0], y1 = s[3], g = s[6], x1 = s[1], b = s[4], M = s[7], _ = s[2], v = s[5], S = s[8]; + return n[0] = r * m + o * x1 + a * _, n[3] = r * y1 + o * b + a * v, n[6] = r * g + o * M + a * S, n[1] = l * m + c * x1 + u * _, n[4] = l * y1 + c * b + u * v, n[7] = l * g + c * M + u * S, n[2] = d * m + p * x1 + f * _, n[5] = d * y1 + p * b + f * v, n[8] = d * g + p * M + f * S, this; } - multiplyScalar(e) { - let 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; + multiplyScalar(t) { + let e = this.elements; + return e[0] *= t, e[3] *= t, e[6] *= t, e[1] *= t, e[4] *= t, e[7] *= t, e[2] *= t, e[5] *= t, e[8] *= t, this; } determinant() { - let e = this.elements, t = e[0], n = e[1], i = e[2], r = e[3], a = e[4], o = e[5], c = e[6], l = e[7], h = e[8]; - return t * a * h - t * o * l - n * r * h + n * o * c + i * r * l - i * a * c; + let t = this.elements, e = t[0], i = t[1], s = t[2], n = t[3], r = t[4], o = t[5], a = t[6], l = t[7], c = t[8]; + return e * r * c - e * o * l - i * n * c + i * o * a + s * n * l - s * r * a; } invert() { - let e = this.elements, t = e[0], n = e[1], i = e[2], r = e[3], a = e[4], o = e[5], c = e[6], l = e[7], h = e[8], u = h * a - o * l, d = o * c - h * r, f = l * r - a * c, m = t * u + n * d + i * f; - if (m === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - let _ = 1 / m; - return e[0] = u * _, e[1] = (i * l - h * n) * _, e[2] = (o * n - i * a) * _, e[3] = d * _, e[4] = (h * t - i * c) * _, e[5] = (i * r - o * t) * _, e[6] = f * _, e[7] = (n * c - l * t) * _, e[8] = (a * t - n * r) * _, this; + let t = this.elements, e = t[0], i = t[1], s = t[2], n = t[3], r = t[4], o = t[5], a = t[6], l = t[7], c = t[8], u = c * r - o * l, d = o * a - c * n, p = l * n - r * a, f = e * u + i * d + s * p; + if (f === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); + let m = 1 / f; + return t[0] = u * m, t[1] = (s * l - c * i) * m, t[2] = (o * i - s * r) * m, t[3] = d * m, t[4] = (c * e - s * a) * m, t[5] = (s * n - o * e) * m, t[6] = p * m, t[7] = (i * a - l * e) * m, t[8] = (r * e - i * n) * m, this; } transpose() { - let e, 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; + let t, e = this.elements; + return t = e[1], e[1] = e[3], e[3] = t, t = e[2], e[2] = e[6], e[6] = t, t = e[5], e[5] = e[7], e[7] = t, this; } - getNormalMatrix(e) { - return this.setFromMatrix4(e).invert().transpose(); + getNormalMatrix(t) { + return this.setFromMatrix4(t).invert().transpose(); } - transposeIntoArray(e) { - let 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; + transposeIntoArray(t) { + let e = this.elements; + return t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8], this; } - setUvTransform(e, t, n, i, r, a, o) { - let c = Math.cos(r), l = Math.sin(r); - return this.set(n * c, n * l, -n * (c * a + l * o) + a + e, -i * l, i * c, -i * (-l * a + c * o) + o + t, 0, 0, 1), this; + setUvTransform(t, e, i, s, n, r, o) { + let a = Math.cos(n), l = Math.sin(n); + return this.set(i * a, i * l, -i * (a * r + l * o) + r + t, -s * l, s * a, -s * (-l * r + a * o) + o + e, 0, 0, 1), this; } - scale(e, t) { - return this.premultiply(Ua.makeScale(e, t)), this; + scale(t, e) { + return this.premultiply(Bn.makeScale(t, e)), this; } - rotate(e) { - return this.premultiply(Ua.makeRotation(-e)), this; + rotate(t) { + return this.premultiply(Bn.makeRotation(-t)), this; } - translate(e, t) { - return this.premultiply(Ua.makeTranslation(e, t)), this; + translate(t, e) { + return this.premultiply(Bn.makeTranslation(t, e)), this; } - makeTranslation(e, t) { - return e.isVector2 ? this.set(1, 0, e.x, 0, 1, e.y, 0, 0, 1) : this.set(1, 0, e, 0, 1, t, 0, 0, 1), this; + makeTranslation(t, e) { + return t.isVector2 ? this.set(1, 0, t.x, 0, 1, t.y, 0, 0, 1) : this.set(1, 0, t, 0, 1, e, 0, 0, 1), this; } - makeRotation(e) { - let t = Math.cos(e), n = Math.sin(e); - return this.set(t, -n, 0, n, t, 0, 0, 0, 1), this; + makeRotation(t) { + let e = Math.cos(t), i = Math.sin(t); + return this.set(e, -i, 0, i, e, 0, 0, 0, 1), this; } - makeScale(e, t) { - return this.set(e, 0, 0, 0, t, 0, 0, 0, 1), this; + makeScale(t, e) { + return this.set(t, 0, 0, 0, e, 0, 0, 0, 1), this; } - equals(e) { - let t = this.elements, n = e.elements; - for(let i = 0; i < 9; i++)if (t[i] !== n[i]) return !1; + equals(t) { + let e = this.elements, i = t.elements; + for(let s = 0; s < 9; s++)if (e[s] !== i[s]) return !1; return !0; } - fromArray(e, t = 0) { - for(let n = 0; n < 9; n++)this.elements[n] = e[n + t]; + fromArray(t, e = 0) { + for(let i = 0; i < 9; i++)this.elements[i] = t[i + e]; return this; } - toArray(e = [], t = 0) { - let 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; + toArray(t = [], e = 0) { + let i = this.elements; + return t[e] = i[0], t[e + 1] = i[1], t[e + 2] = i[2], t[e + 3] = i[3], t[e + 4] = i[4], t[e + 5] = i[5], t[e + 6] = i[6], t[e + 7] = i[7], t[e + 8] = i[8], t; } clone() { return new this.constructor().fromArray(this.elements); } -}, Ua = new He; -function Md(s1) { - for(let e = s1.length - 1; e >= 0; --e)if (s1[e] >= 65535) return !0; +}, Bn = new Gt; +function cu(h) { + for(let t = h.length - 1; t >= 0; --t)if (h[t] >= 65535) return !0; return !1; } -var ep = { +var uu = { Int8Array, Uint8Array, Uint8ClampedArray, @@ -766,165 +770,208 @@ var ep = { Float32Array, Float64Array }; -function ki(s1, e) { - return new ep[s1](e); -} -function ws(s1) { - return document.createElementNS("http://www.w3.org/1999/xhtml", s1); -} -function tp() { - let s1 = ws("canvas"); - return s1.style.display = "block", s1; -} -var Bl = {}; -function Ms(s1) { - s1 in Bl || (Bl[s1] = !0, console.warn(s1)); -} -var zl = new He().set(.8224621, .177538, 0, .0331941, .9668058, 0, .0170827, .0723974, .9105199), Vl = new He().set(1.2249401, -.2249404, 0, -.0420569, 1.0420571, 0, -.0196376, -.0786361, 1.0982735), Gs = { - [Mn]: { - transfer: zr, - primaries: Vr, - toReference: (s1)=>s1, - fromReference: (s1)=>s1 - }, - [vt]: { - transfer: nt, - primaries: Vr, - toReference: (s1)=>s1.convertSRGBToLinear(), - fromReference: (s1)=>s1.convertLinearToSRGB() - }, - [va]: { - transfer: zr, - primaries: kr, - toReference: (s1)=>s1.applyMatrix3(Vl), - fromReference: (s1)=>s1.applyMatrix3(zl) - }, - [qc]: { - transfer: nt, - primaries: kr, - toReference: (s1)=>s1.convertSRGBToLinear().applyMatrix3(Vl), - fromReference: (s1)=>s1.applyMatrix3(zl).convertLinearToSRGB() - } -}, np = new Set([ - Mn, - va -]), Qe = { - enabled: !0, - _workingColorSpace: Mn, - get legacyMode () { - return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."), !this.enabled; - }, - set legacyMode (s){ - console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."), this.enabled = !s; - }, - get workingColorSpace () { - return this._workingColorSpace; - }, - set workingColorSpace (s){ - if (!np.has(s)) throw new Error(`Unsupported working color space, "${s}".`); - this._workingColorSpace = s; - }, - convert: function(s1, e, t) { - if (this.enabled === !1 || e === t || !e || !t) return s1; - let n = Gs[e].toReference, i = Gs[t].fromReference; - return i(n(s1)); - }, - fromWorkingColorSpace: function(s1, e) { - return this.convert(s1, this._workingColorSpace, e); - }, - toWorkingColorSpace: function(s1, e) { - return this.convert(s1, e, this._workingColorSpace); - }, - getPrimaries: function(s1) { - return Gs[s1].primaries; - }, - getTransfer: function(s1) { - return s1 === Xt ? zr : Gs[s1].transfer; - } -}; -function Xi(s1) { - return s1 < .04045 ? s1 * .0773993808 : Math.pow(s1 * .9478672986 + .0521327014, 2.4); -} -function Da(s1) { - return s1 < .0031308 ? s1 * 12.92 : 1.055 * Math.pow(s1, .41666) - .055; +function ci(h, t) { + return new uu[h](t); +} +function Ys(h) { + return document.createElementNS("http://www.w3.org/1999/xhtml", h); +} +function If() { + let h = Ys("canvas"); + return h.style.display = "block", h; +} +var da = {}; +function Cf(h) { + h in da || (da[h] = !0, console.warn(h)); +} +function zf(h, t, e) { + return new Promise(function(i, s) { + function n() { + switch(h.clientWaitSync(t, h.SYNC_FLUSH_COMMANDS_BIT, 0)){ + case h.WAIT_FAILED: + s(); + break; + case h.TIMEOUT_EXPIRED: + setTimeout(n, e); + break; + default: + i(); + } + } + setTimeout(n, e); + }); } -var gi, Xr = class { - static getDataURL(e) { - if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; - let t; - if (e instanceof HTMLCanvasElement) t = e; +function Ff(h) { + let t = h.elements; + t[2] = .5 * t[2] + .5 * t[3], t[6] = .5 * t[6] + .5 * t[7], t[10] = .5 * t[10] + .5 * t[11], t[14] = .5 * t[14] + .5 * t[15]; +} +function Bf(h) { + let t = h.elements; + t[11] === -1 ? (t[10] = -t[10] - 1, t[14] = -t[14]) : (t[10] = -t[10], t[14] = -t[14] + 1); +} +var pa = new Gt().set(.4123908, .3575843, .1804808, .212639, .7151687, .0721923, .0193308, .1191948, .9505322), fa = new Gt().set(3.2409699, -1.5373832, -.4986108, -.9692436, 1.8759675, .0415551, .0556301, -.203977, 1.0569715); +function du() { + let h = { + enabled: !0, + workingColorSpace: ha, + spaces: {}, + convert: function(s, n, r) { + return this.enabled === !1 || n === r || !n || !r || (this.spaces[n].transfer === Fn && (s.r = ae(s.r), s.g = ae(s.g), s.b = ae(s.b)), this.spaces[n].primaries !== this.spaces[r].primaries && (s.applyMatrix3(this.spaces[n].toXYZ), s.applyMatrix3(this.spaces[r].fromXYZ)), this.spaces[r].transfer === Fn && (s.r = di(s.r), s.g = di(s.g), s.b = di(s.b))), s; + }, + fromWorkingColorSpace: function(s, n) { + return this.convert(s, this.workingColorSpace, n); + }, + toWorkingColorSpace: function(s, n) { + return this.convert(s, n, this.workingColorSpace); + }, + getPrimaries: function(s) { + return this.spaces[s].primaries; + }, + getTransfer: function(s) { + return s === zl ? la : this.spaces[s].transfer; + }, + getLuminanceCoefficients: function(s, n = this.workingColorSpace) { + return s.fromArray(this.spaces[n].luminanceCoefficients); + }, + define: function(s) { + Object.assign(this.spaces, s); + }, + _getMatrix: function(s, n, r) { + return s.copy(this.spaces[n].toXYZ).multiply(this.spaces[r].fromXYZ); + }, + _getDrawingBufferColorSpace: function(s) { + return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace; + }, + _getUnpackColorSpace: function(s = this.workingColorSpace) { + return this.spaces[s].workingColorSpaceConfig.unpackColorSpace; + } + }, t = [ + .64, + .33, + .3, + .6, + .15, + .06 + ], e = [ + .2126, + .7152, + .0722 + ], i = [ + .3127, + .329 + ]; + return h.define({ + [ha]: { + primaries: t, + whitePoint: i, + transfer: la, + toXYZ: pa, + fromXYZ: fa, + luminanceCoefficients: e, + workingColorSpaceConfig: { + unpackColorSpace: Bt + }, + outputColorSpaceConfig: { + drawingBufferColorSpace: Bt + } + }, + [Bt]: { + primaries: t, + whitePoint: i, + transfer: Fn, + toXYZ: pa, + fromXYZ: fa, + luminanceCoefficients: e, + outputColorSpaceConfig: { + drawingBufferColorSpace: Bt + } + } + }), h; +} +var Tt = du(); +function ae(h) { + return h < .04045 ? h * .0773993808 : Math.pow(h * .9478672986 + .0521327014, 2.4); +} +function di(h) { + return h < .0031308 ? h * 12.92 : 1.055 * Math.pow(h, .41666) - .055; +} +var Ge, yr = class { + static getDataURL(t) { + if (/^data:/i.test(t.src) || typeof HTMLCanvasElement > "u") return t.src; + let e; + if (t instanceof HTMLCanvasElement) e = t; else { - gi === void 0 && (gi = ws("canvas")), gi.width = e.width, gi.height = e.height; - let n = gi.getContext("2d"); - e instanceof ImageData ? n.putImageData(e, 0, 0) : n.drawImage(e, 0, 0, e.width, e.height), t = gi; - } - 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) { - let t = ws("canvas"); - t.width = e.width, t.height = e.height; - let n = t.getContext("2d"); - n.drawImage(e, 0, 0, e.width, e.height); - let i = n.getImageData(0, 0, e.width, e.height), r = i.data; - for(let a = 0; a < r.length; a++)r[a] = Xi(r[a] / 255) * 255; - return n.putImageData(i, 0, 0), t; - } else if (e.data) { - let t = e.data.slice(0); - for(let n = 0; n < t.length; n++)t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[n] = Math.floor(Xi(t[n] / 255) * 255) : t[n] = Xi(t[n]); + Ge === void 0 && (Ge = Ys("canvas")), Ge.width = t.width, Ge.height = t.height; + let i = Ge.getContext("2d"); + t instanceof ImageData ? i.putImageData(t, 0, 0) : i.drawImage(t, 0, 0, t.width, t.height), e = Ge; + } + return e.toDataURL("image/png"); + } + static sRGBToLinear(t) { + if (typeof HTMLImageElement < "u" && t instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && t instanceof ImageBitmap) { + let e = Ys("canvas"); + e.width = t.width, e.height = t.height; + let i = e.getContext("2d"); + i.drawImage(t, 0, 0, t.width, t.height); + let s = i.getImageData(0, 0, t.width, t.height), n = s.data; + for(let r = 0; r < n.length; r++)n[r] = ae(n[r] / 255) * 255; + return i.putImageData(s, 0, 0), e; + } else if (t.data) { + let e = t.data.slice(0); + for(let i = 0; i < e.length; i++)e instanceof Uint8Array || e instanceof Uint8ClampedArray ? e[i] = Math.floor(ae(e[i] / 255) * 255) : e[i] = ae(e[i]); return { - data: t, - width: e.width, - height: e.height + data: e, + width: t.width, + height: t.height }; - } else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e; + } else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), t; } -}, ip = 0, In = class { - constructor(e = null){ +}, pu = 0, be = class { + constructor(t = null){ this.isSource = !0, Object.defineProperty(this, "id", { - value: ip++ - }), this.uuid = kt(), this.data = e, this.version = 0; + value: pu++ + }), this.uuid = It(), this.data = t, this.dataReady = !0, this.version = 0; } - set needsUpdate(e) { - e === !0 && this.version++; + set needsUpdate(t) { + t === !0 && this.version++; } - toJSON(e) { - let t = e === void 0 || typeof e == "string"; - if (!t && e.images[this.uuid] !== void 0) return e.images[this.uuid]; - let n = { + toJSON(t) { + let e = t === void 0 || typeof t == "string"; + if (!e && t.images[this.uuid] !== void 0) return t.images[this.uuid]; + let i = { uuid: this.uuid, url: "" - }, i = this.data; - if (i !== null) { - let r; - if (Array.isArray(i)) { - r = []; - for(let a = 0, o = i.length; a < o; a++)i[a].isDataTexture ? r.push(Na(i[a].image)) : r.push(Na(i[a])); - } else r = Na(i); - n.url = r; + }, s = this.data; + if (s !== null) { + let n; + if (Array.isArray(s)) { + n = []; + for(let r = 0, o = s.length; r < o; r++)s[r].isDataTexture ? n.push(En(s[r].image)) : n.push(En(s[r])); + } else n = En(s); + i.url = n; } - return t || (e.images[this.uuid] = n), n; + return e || (t.images[this.uuid] = i), i; } }; -function Na(s1) { - return typeof HTMLImageElement < "u" && s1 instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && s1 instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && s1 instanceof ImageBitmap ? Xr.getDataURL(s1) : s1.data ? { - data: Array.from(s1.data), - width: s1.width, - height: s1.height, - type: s1.data.constructor.name +function En(h) { + return typeof HTMLImageElement < "u" && h instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && h instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && h instanceof ImageBitmap ? yr.getDataURL(h) : h.data ? { + data: Array.from(h.data), + width: h.width, + height: h.height, + type: h.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } -var sp = 0, St = class s1 extends sn { - constructor(e = s1.DEFAULT_IMAGE, t = s1.DEFAULT_MAPPING, n = It, i = It, r = mt, a = li, o = Wt, c = On, l = s1.DEFAULT_ANISOTROPY, h = Xt){ +var fu = 0, lt = class h extends qt { + constructor(t = h.DEFAULT_IMAGE, e = h.DEFAULT_MAPPING, i = Ht, s = Ht, n = Et, r = vn, o = Li, a = Sl, l = h.DEFAULT_ANISOTROPY, c = zl){ super(), this.isTexture = !0, Object.defineProperty(this, "id", { - value: sp++ - }), this.uuid = kt(), this.name = "", this.source = new In(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = i, this.magFilter = r, this.minFilter = a, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = c, this.offset = new Z(0, 0), this.repeat = new Z(1, 1), this.center = new Z(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new He, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, typeof h == "string" ? this.colorSpace = h : (Ms("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace = h === ri ? vt : Xt), this.userData = {}, this.version = 0, this.onUpdate = null, this.isRenderTargetTexture = !1, this.needsPMREMUpdate = !1; + value: fu++ + }), this.uuid = It(), this.name = "", this.source = new be(t), this.mipmaps = [], this.mapping = e, this.channel = 0, this.wrapS = i, this.wrapT = s, this.magFilter = n, this.minFilter = r, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = a, this.offset = new T(0, 0), this.repeat = new T(1, 1), this.center = new T(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Gt, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = c, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.pmremVersion = 0; } get image() { return this.source.data; } - set image(e = null) { - this.source.data = e; + set image(t = null) { + this.source.data = t; } updateMatrix() { this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); @@ -932,13 +979,13 @@ var sp = 0, St = class s1 extends sn { clone() { return new this.constructor().copy(this); } - copy(e) { - return this.name = e.name, this.source = e.source, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.channel = e.channel, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.colorSpace = e.colorSpace, this.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this; + copy(t) { + return this.name = t.name, this.source = t.source, this.mipmaps = t.mipmaps.slice(0), this.mapping = t.mapping, this.channel = t.channel, this.wrapS = t.wrapS, this.wrapT = t.wrapT, this.magFilter = t.magFilter, this.minFilter = t.minFilter, this.anisotropy = t.anisotropy, this.format = t.format, this.internalFormat = t.internalFormat, this.type = t.type, this.offset.copy(t.offset), this.repeat.copy(t.repeat), this.center.copy(t.center), this.rotation = t.rotation, this.matrixAutoUpdate = t.matrixAutoUpdate, this.matrix.copy(t.matrix), this.generateMipmaps = t.generateMipmaps, this.premultiplyAlpha = t.premultiplyAlpha, this.flipY = t.flipY, this.unpackAlignment = t.unpackAlignment, this.colorSpace = t.colorSpace, this.renderTarget = t.renderTarget, this.isRenderTargetTexture = t.isRenderTargetTexture, this.userData = JSON.parse(JSON.stringify(t.userData)), this.needsUpdate = !0, this; } - toJSON(e) { - let t = e === void 0 || typeof e == "string"; - if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid]; - let n = { + toJSON(t) { + let e = t === void 0 || typeof t == "string"; + if (!e && t.textures[this.uuid] !== void 0) return t.textures[this.uuid]; + let i = { metadata: { version: 4.6, type: "Texture", @@ -946,7 +993,7 @@ var sp = 0, St = class s1 extends sn { }, uuid: this.uuid, name: this.name, - image: this.source.toJSON(e).uuid, + image: this.source.toJSON(t).uuid, mapping: this.mapping, channel: this.channel, repeat: [ @@ -978,107 +1025,104 @@ var sp = 0, St = class s1 extends sn { premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; - return Object.keys(this.userData).length > 0 && (n.userData = this.userData), t || (e.textures[this.uuid] = n), n; + return Object.keys(this.userData).length > 0 && (i.userData = this.userData), e || (t.textures[this.uuid] = i), i; } dispose() { this.dispatchEvent({ type: "dispose" }); } - transformUv(e) { - if (this.mapping !== Gc) return e; - if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch(this.wrapS){ - case Dr: - e.x = e.x - Math.floor(e.x); + transformUv(t) { + if (this.mapping !== Lo) return t; + if (t.applyMatrix3(this.matrix), t.x < 0 || t.x > 1) switch(this.wrapS){ + case pr: + t.x = t.x - Math.floor(t.x); break; - case It: - e.x = e.x < 0 ? 0 : 1; + case Ht: + t.x = t.x < 0 ? 0 : 1; break; - case Nr: - Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x); + case fr: + Math.abs(Math.floor(t.x) % 2) === 1 ? t.x = Math.ceil(t.x) - t.x : t.x = t.x - Math.floor(t.x); break; } - if (e.y < 0 || e.y > 1) switch(this.wrapT){ - case Dr: - e.y = e.y - Math.floor(e.y); + if (t.y < 0 || t.y > 1) switch(this.wrapT){ + case pr: + t.y = t.y - Math.floor(t.y); break; - case It: - e.y = e.y < 0 ? 0 : 1; + case Ht: + t.y = t.y < 0 ? 0 : 1; break; - case Nr: - Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y); + case fr: + Math.abs(Math.floor(t.y) % 2) === 1 ? t.y = Math.ceil(t.y) - t.y : t.y = t.y - Math.floor(t.y); break; } - return this.flipY && (e.y = 1 - e.y), e; - } - set needsUpdate(e) { - e === !0 && (this.version++, this.source.needsUpdate = !0); + return this.flipY && (t.y = 1 - t.y), t; } - get encoding() { - return Ms("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace === vt ? ri : vd; + set needsUpdate(t) { + t === !0 && (this.version++, this.source.needsUpdate = !0); } - set encoding(e) { - Ms("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace = e === ri ? vt : Xt; + set needsPMREMUpdate(t) { + t === !0 && this.pmremVersion++; } }; -St.DEFAULT_IMAGE = null; -St.DEFAULT_MAPPING = Gc; -St.DEFAULT_ANISOTROPY = 1; -var je = class s1 { - constructor(e = 0, t = 0, n = 0, i = 1){ - s1.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = i; +lt.DEFAULT_IMAGE = null; +lt.DEFAULT_MAPPING = Lo; +lt.DEFAULT_ANISOTROPY = 1; +var ot = class h { + constructor(t = 0, e = 0, i = 0, s = 1){ + h.prototype.isVector4 = !0, this.x = t, this.y = e, this.z = i, this.w = s; } get width() { return this.z; } - set width(e) { - this.z = e; + set width(t) { + this.z = t; } get height() { return this.w; } - set height(e) { - this.w = e; + set height(t) { + this.w = t; } - set(e, t, n, i) { - return this.x = e, this.y = t, this.z = n, this.w = i, this; + set(t, e, i, s) { + return this.x = t, this.y = e, this.z = i, this.w = s, this; } - setScalar(e) { - return this.x = e, this.y = e, this.z = e, this.w = e, this; + setScalar(t) { + return this.x = t, this.y = t, this.z = t, this.w = t, this; } - setX(e) { - return this.x = e, this; + setX(t) { + return this.x = t, this; } - setY(e) { - return this.y = e, this; + setY(t) { + return this.y = t, this; } - setZ(e) { - return this.z = e, this; + setZ(t) { + return this.z = t, this; } - setW(e) { - return this.w = e, this; + setW(t) { + return this.w = t, this; } - setComponent(e, t) { - switch(e){ + setComponent(t, e) { + switch(t){ case 0: - this.x = t; + this.x = e; break; case 1: - this.y = t; + this.y = e; break; case 2: - this.z = t; + this.z = e; break; case 3: - this.w = t; + this.w = e; break; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } return this; } - getComponent(e) { - switch(e){ + getComponent(t) { + switch(t){ case 0: return this.x; case 1: @@ -1088,80 +1132,87 @@ var je = class s1 { case 3: return this.w; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } } 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; + copy(t) { + return this.x = t.x, this.y = t.y, this.z = t.z, this.w = t.w !== void 0 ? t.w : 1, this; } - add(e) { - return this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this; + add(t) { + return this.x += t.x, this.y += t.y, this.z += t.z, this.w += t.w, this; } - addScalar(e) { - return this.x += e, this.y += e, this.z += e, this.w += e, this; + addScalar(t) { + return this.x += t, this.y += t, this.z += t, this.w += t, 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; + addVectors(t, e) { + return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this.w = t.w + e.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; + addScaledVector(t, e) { + return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this.w += t.w * e, this; } - sub(e) { - return this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this; + sub(t) { + return this.x -= t.x, this.y -= t.y, this.z -= t.z, this.w -= t.w, this; } - subScalar(e) { - return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this; + subScalar(t) { + return this.x -= t, this.y -= t, this.z -= t, this.w -= t, 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; + subVectors(t, e) { + return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this.w = t.w - e.w, this; } - multiply(e) { - return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this; + multiply(t) { + return this.x *= t.x, this.y *= t.y, this.z *= t.z, this.w *= t.w, this; } - multiplyScalar(e) { - return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this; + multiplyScalar(t) { + return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this; } - applyMatrix4(e) { - let t = this.x, n = this.y, i = this.z, r = this.w, a = e.elements; - return this.x = a[0] * t + a[4] * n + a[8] * i + a[12] * r, this.y = a[1] * t + a[5] * n + a[9] * i + a[13] * r, this.z = a[2] * t + a[6] * n + a[10] * i + a[14] * r, this.w = a[3] * t + a[7] * n + a[11] * i + a[15] * r, this; + applyMatrix4(t) { + let e = this.x, i = this.y, s = this.z, n = this.w, r = t.elements; + return this.x = r[0] * e + r[4] * i + r[8] * s + r[12] * n, this.y = r[1] * e + r[5] * i + r[9] * s + r[13] * n, this.z = r[2] * e + r[6] * i + r[10] * s + r[14] * n, this.w = r[3] * e + r[7] * i + r[11] * s + r[15] * n, this; } - divideScalar(e) { - return this.multiplyScalar(1 / e); + divide(t) { + return this.x /= t.x, this.y /= t.y, this.z /= t.z, this.w /= t.w, this; } - setAxisAngleFromQuaternion(e) { - this.w = 2 * Math.acos(e.w); - let 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; + divideScalar(t) { + return this.multiplyScalar(1 / t); } - setAxisAngleFromRotationMatrix(e) { - let t, n, i, r, c = e.elements, l = c[0], h = c[4], u = c[8], d = c[1], f = c[5], m = c[9], _ = c[2], g = c[6], p = c[10]; - if (Math.abs(h - d) < .01 && Math.abs(u - _) < .01 && Math.abs(m - g) < .01) { - if (Math.abs(h + d) < .1 && Math.abs(u + _) < .1 && Math.abs(m + g) < .1 && Math.abs(l + f + p - 3) < .1) return this.set(1, 0, 0, 0), this; - t = Math.PI; - let x1 = (l + 1) / 2, y1 = (f + 1) / 2, b = (p + 1) / 2, w = (h + d) / 4, R = (u + _) / 4, I = (m + g) / 4; - return x1 > y1 && x1 > b ? x1 < .01 ? (n = 0, i = .707106781, r = .707106781) : (n = Math.sqrt(x1), i = w / n, r = R / n) : y1 > b ? y1 < .01 ? (n = .707106781, i = 0, r = .707106781) : (i = Math.sqrt(y1), n = w / i, r = I / i) : b < .01 ? (n = .707106781, i = .707106781, r = 0) : (r = Math.sqrt(b), n = R / r, i = I / r), this.set(n, i, r, t), this; + setAxisAngleFromQuaternion(t) { + this.w = 2 * Math.acos(t.w); + let e = Math.sqrt(1 - t.w * t.w); + return e < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = t.x / e, this.y = t.y / e, this.z = t.z / e), this; + } + setAxisAngleFromRotationMatrix(t) { + let e, i, s, n, a = t.elements, l = a[0], c = a[4], u = a[8], d = a[1], p = a[5], f = a[9], m = a[2], y1 = a[6], g = a[10]; + if (Math.abs(c - d) < .01 && Math.abs(u - m) < .01 && Math.abs(f - y1) < .01) { + if (Math.abs(c + d) < .1 && Math.abs(u + m) < .1 && Math.abs(f + y1) < .1 && Math.abs(l + p + g - 3) < .1) return this.set(1, 0, 0, 0), this; + e = Math.PI; + let b = (l + 1) / 2, M = (p + 1) / 2, _ = (g + 1) / 2, v = (c + d) / 4, S = (u + m) / 4, A = (f + y1) / 4; + return b > M && b > _ ? b < .01 ? (i = 0, s = .707106781, n = .707106781) : (i = Math.sqrt(b), s = v / i, n = S / i) : M > _ ? M < .01 ? (i = .707106781, s = 0, n = .707106781) : (s = Math.sqrt(M), i = v / s, n = A / s) : _ < .01 ? (i = .707106781, s = .707106781, n = 0) : (n = Math.sqrt(_), i = S / n, s = A / n), this.set(i, s, n, e), this; } - let v = Math.sqrt((g - m) * (g - m) + (u - _) * (u - _) + (d - h) * (d - h)); - return Math.abs(v) < .001 && (v = 1), this.x = (g - m) / v, this.y = (u - _) / v, this.z = (d - h) / v, this.w = Math.acos((l + f + p - 1) / 2), this; + let x1 = Math.sqrt((y1 - f) * (y1 - f) + (u - m) * (u - m) + (d - c) * (d - c)); + return Math.abs(x1) < .001 && (x1 = 1), this.x = (y1 - f) / x1, this.y = (u - m) / x1, this.z = (d - c) / x1, this.w = Math.acos((l + p + g - 1) / 2), this; + } + setFromMatrixPosition(t) { + let e = t.elements; + return this.x = e[12], this.y = e[13], this.z = e[14], this.w = e[15], this; } - min(e) { - return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this; + min(t) { + return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this.w = Math.min(this.w, t.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; + max(t) { + return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this.w = Math.max(this.w, t.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; + clamp(t, e) { + return this.x = N(this.x, t.x, e.x), this.y = N(this.y, t.y, e.y), this.z = N(this.z, t.z, e.z), this.w = N(this.w, t.w, e.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; + clampScalar(t, e) { + return this.x = N(this.x, t, e), this.y = N(this.y, t, e), this.z = N(this.z, t, e), this.w = N(this.w, t, e), this; } - clampLength(e, t) { - let n = this.length(); - return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))); + clampLength(t, e) { + let i = this.length(); + return this.divideScalar(i || 1).multiplyScalar(N(i, t, e)); } 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; @@ -1178,8 +1229,8 @@ var je = class s1 { 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; + dot(t) { + return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w; } lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; @@ -1193,26 +1244,26 @@ var je = class s1 { normalize() { return this.divideScalar(this.length() || 1); } - setLength(e) { - return this.normalize().multiplyScalar(e); + setLength(t) { + return this.normalize().multiplyScalar(t); } - 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; + lerp(t, e) { + return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this.w += (t.w - this.w) * e, 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; + lerpVectors(t, e, i) { + return this.x = t.x + (e.x - t.x) * i, this.y = t.y + (e.y - t.y) * i, this.z = t.z + (e.z - t.z) * i, this.w = t.w + (e.w - t.w) * i, this; } - equals(e) { - return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w; + equals(t) { + return t.x === this.x && t.y === this.y && t.z === this.z && t.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; + fromArray(t, e = 0) { + return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this.w = t[e + 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; + toArray(t = [], e = 0) { + return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t[e + 3] = this.w, t; } - 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; + fromBufferAttribute(t, e) { + return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this.w = t.getW(e), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this; @@ -1220,214 +1271,226 @@ var je = class s1 { *[Symbol.iterator]() { yield this.x, yield this.y, yield this.z, yield this.w; } -}, go = class extends sn { - constructor(e = 1, t = 1, n = {}){ - super(), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = 1, this.scissor = new je(0, 0, e, t), this.scissorTest = !1, this.viewport = new je(0, 0, e, t); - let i = { - width: e, - height: t, +}, Wi = class extends qt { + constructor(t = 1, e = 1, i = {}){ + super(), this.isRenderTarget = !0, this.width = t, this.height = e, this.depth = 1, this.scissor = new ot(0, 0, t, e), this.scissorTest = !1, this.viewport = new ot(0, 0, t, e); + let s = { + width: t, + height: e, depth: 1 }; - n.encoding !== void 0 && (Ms("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."), n.colorSpace = n.encoding === ri ? vt : Xt), n = Object.assign({ + i = Object.assign({ generateMipmaps: !1, internalFormat: null, - minFilter: mt, + minFilter: Et, depthBuffer: !0, stencilBuffer: !1, + resolveDepthBuffer: !0, + resolveStencilBuffer: !0, depthTexture: null, - samples: 0 - }, n), this.texture = new St(i, n.mapping, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.flipY = !1, this.texture.generateMipmaps = n.generateMipmaps, this.texture.internalFormat = n.internalFormat, this.depthBuffer = n.depthBuffer, this.stencilBuffer = n.stencilBuffer, this.depthTexture = n.depthTexture, this.samples = n.samples; - } - setSize(e, t, n = 1) { - (this.width !== e || this.height !== t || this.depth !== n) && (this.width = e, this.height = t, this.depth = n, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = n, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t); + samples: 0, + count: 1 + }, i); + let n = new lt(s, i.mapping, i.wrapS, i.wrapT, i.magFilter, i.minFilter, i.format, i.type, i.anisotropy, i.colorSpace); + n.flipY = !1, n.generateMipmaps = i.generateMipmaps, n.internalFormat = i.internalFormat, this.textures = []; + let r = i.count; + for(let o = 0; o < r; o++)this.textures[o] = n.clone(), this.textures[o].isRenderTargetTexture = !0, this.textures[o].renderTarget = this; + this.depthBuffer = i.depthBuffer, this.stencilBuffer = i.stencilBuffer, this.resolveDepthBuffer = i.resolveDepthBuffer, this.resolveStencilBuffer = i.resolveStencilBuffer, this._depthTexture = null, this.depthTexture = i.depthTexture, this.samples = i.samples; + } + get texture() { + return this.textures[0]; + } + set texture(t) { + this.textures[0] = t; + } + set depthTexture(t) { + this._depthTexture !== null && (this._depthTexture.renderTarget = null), t !== null && (t.renderTarget = this), this._depthTexture = t; + } + get depthTexture() { + return this._depthTexture; + } + setSize(t, e, i = 1) { + if (this.width !== t || this.height !== e || this.depth !== i) { + this.width = t, this.height = e, this.depth = i; + for(let s = 0, n = this.textures.length; s < n; s++)this.textures[s].image.width = t, this.textures[s].image.height = e, this.textures[s].image.depth = i; + this.dispose(); + } + this.viewport.set(0, 0, t, e), this.scissor.set(0, 0, t, e); } clone() { return new this.constructor().copy(this); } - copy(e) { - this.width = e.width, this.height = e.height, this.depth = e.depth, this.scissor.copy(e.scissor), this.scissorTest = e.scissorTest, this.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.texture.isRenderTargetTexture = !0; - let t = Object.assign({}, e.texture.image); - return this.texture.source = new In(t), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this; + copy(t) { + this.width = t.width, this.height = t.height, this.depth = t.depth, this.scissor.copy(t.scissor), this.scissorTest = t.scissorTest, this.viewport.copy(t.viewport), this.textures.length = 0; + for(let i = 0, s = t.textures.length; i < s; i++)this.textures[i] = t.textures[i].clone(), this.textures[i].isRenderTargetTexture = !0, this.textures[i].renderTarget = this; + let e = Object.assign({}, t.texture.image); + return this.texture.source = new be(e), this.depthBuffer = t.depthBuffer, this.stencilBuffer = t.stencilBuffer, this.resolveDepthBuffer = t.resolveDepthBuffer, this.resolveStencilBuffer = t.resolveStencilBuffer, t.depthTexture !== null && (this.depthTexture = t.depthTexture.clone()), this.samples = t.samples, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } -}, qt = class extends go { - constructor(e = 1, t = 1, n = {}){ - super(e, t, n), this.isWebGLRenderTarget = !0; +}, Hi = class extends Wi { + constructor(t = 1, e = 1, i = {}){ + super(t, e, i), this.isWebGLRenderTarget = !0; } -}, As = class extends St { - constructor(e = null, t = 1, n = 1, i = 1){ +}, $s = class extends lt { + constructor(t = null, e = 1, i = 1, s = 1){ super(null), this.isDataArrayTexture = !0, this.image = { - data: e, - width: t, - height: n, - depth: i - }, this.magFilter = pt, this.minFilter = pt, this.wrapR = It, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; + data: t, + width: e, + height: i, + depth: s + }, this.magFilter = Ut, this.minFilter = Ut, this.wrapR = Ht, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = new Set; } -}, kl = class extends qt { - constructor(e = 1, t = 1, n = 1){ - super(e, t), this.isWebGLArrayRenderTarget = !0, this.depth = n, this.texture = new As(null, e, t, n), this.texture.isRenderTargetTexture = !0; + addLayerUpdate(t) { + this.layerUpdates.add(t); } -}, qr = class extends St { - constructor(e = null, t = 1, n = 1, i = 1){ + clearLayerUpdates() { + this.layerUpdates.clear(); + } +}, ma = class extends Hi { + constructor(t = 1, e = 1, i = 1, s = {}){ + super(t, e, s), this.isWebGLArrayRenderTarget = !0, this.depth = i, this.texture = new $s(null, t, e, i), this.texture.isRenderTargetTexture = !0; + } +}, Qs = class extends lt { + constructor(t = null, e = 1, i = 1, s = 1){ super(null), this.isData3DTexture = !0, this.image = { - data: e, - width: t, - height: n, - depth: i - }, this.magFilter = pt, this.minFilter = pt, this.wrapR = It, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; - } -}, Hl = class extends qt { - constructor(e = 1, t = 1, n = 1){ - super(e, t), this.isWebGL3DRenderTarget = !0, this.depth = n, this.texture = new qr(null, e, t, n), this.texture.isRenderTargetTexture = !0; - } -}, Gl = class extends qt { - constructor(e = 1, t = 1, n = 1, i = {}){ - super(e, t, i), this.isWebGLMultipleRenderTargets = !0; - let r = this.texture; - this.texture = []; - for(let a = 0; a < n; a++)this.texture[a] = r.clone(), this.texture[a].isRenderTargetTexture = !0; - } - setSize(e, t, n = 1) { - if (this.width !== e || this.height !== t || this.depth !== n) { - this.width = e, this.height = t, this.depth = n; - for(let i = 0, r = this.texture.length; i < r; i++)this.texture[i].image.width = e, this.texture[i].image.height = t, this.texture[i].image.depth = n; - this.dispose(); - } - this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t); + data: t, + width: e, + height: i, + depth: s + }, this.magFilter = Ut, this.minFilter = Ut, this.wrapR = Ht, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; } - copy(e) { - this.dispose(), this.width = e.width, this.height = e.height, this.depth = e.depth, this.scissor.copy(e.scissor), this.scissorTest = e.scissorTest, this.viewport.copy(e.viewport), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.texture.length = 0; - for(let t = 0, n = e.texture.length; t < n; t++)this.texture[t] = e.texture[t].clone(), this.texture[t].isRenderTargetTexture = !0; - return this; +}, ya = class extends Hi { + constructor(t = 1, e = 1, i = 1, s = {}){ + super(t, e, s), this.isWebGL3DRenderTarget = !0, this.depth = i, this.texture = new Qs(null, t, e, i), this.texture.isRenderTargetTexture = !0; } -}, Ut = class { - constructor(e = 0, t = 0, n = 0, i = 1){ - this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = i; +}, bt = class { + constructor(t = 0, e = 0, i = 0, s = 1){ + this.isQuaternion = !0, this._x = t, this._y = e, this._z = i, this._w = s; } - static slerpFlat(e, t, n, i, r, a, o) { - let c = n[i + 0], l = n[i + 1], h = n[i + 2], u = n[i + 3], d = r[a + 0], f = r[a + 1], m = r[a + 2], _ = r[a + 3]; + static slerpFlat(t, e, i, s, n, r, o) { + let a = i[s + 0], l = i[s + 1], c = i[s + 2], u = i[s + 3], d = n[r + 0], p = n[r + 1], f = n[r + 2], m = n[r + 3]; if (o === 0) { - e[t + 0] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; + t[e + 0] = a, t[e + 1] = l, t[e + 2] = c, t[e + 3] = u; return; } if (o === 1) { - e[t + 0] = d, e[t + 1] = f, e[t + 2] = m, e[t + 3] = _; + t[e + 0] = d, t[e + 1] = p, t[e + 2] = f, t[e + 3] = m; return; } - if (u !== _ || c !== d || l !== f || h !== m) { - let g = 1 - o, p = c * d + l * f + h * m + u * _, v = p >= 0 ? 1 : -1, x1 = 1 - p * p; - if (x1 > Number.EPSILON) { - let b = Math.sqrt(x1), w = Math.atan2(b, p * v); - g = Math.sin(g * w) / b, o = Math.sin(o * w) / b; + if (u !== m || a !== d || l !== p || c !== f) { + let y1 = 1 - o, g = a * d + l * p + c * f + u * m, x1 = g >= 0 ? 1 : -1, b = 1 - g * g; + if (b > Number.EPSILON) { + let _ = Math.sqrt(b), v = Math.atan2(_, g * x1); + y1 = Math.sin(y1 * v) / _, o = Math.sin(o * v) / _; } - let y1 = o * v; - if (c = c * g + d * y1, l = l * g + f * y1, h = h * g + m * y1, u = u * g + _ * y1, g === 1 - o) { - let b = 1 / Math.sqrt(c * c + l * l + h * h + u * u); - c *= b, l *= b, h *= b, u *= b; + let M = o * x1; + if (a = a * y1 + d * M, l = l * y1 + p * M, c = c * y1 + f * M, u = u * y1 + m * M, y1 === 1 - o) { + let _ = 1 / Math.sqrt(a * a + l * l + c * c + u * u); + a *= _, l *= _, c *= _, u *= _; } } - e[t] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; + t[e] = a, t[e + 1] = l, t[e + 2] = c, t[e + 3] = u; } - static multiplyQuaternionsFlat(e, t, n, i, r, a) { - let o = n[i], c = n[i + 1], l = n[i + 2], h = n[i + 3], u = r[a], d = r[a + 1], f = r[a + 2], m = r[a + 3]; - return e[t] = o * m + h * u + c * f - l * d, e[t + 1] = c * m + h * d + l * u - o * f, e[t + 2] = l * m + h * f + o * d - c * u, e[t + 3] = h * m - o * u - c * d - l * f, e; + static multiplyQuaternionsFlat(t, e, i, s, n, r) { + let o = i[s], a = i[s + 1], l = i[s + 2], c = i[s + 3], u = n[r], d = n[r + 1], p = n[r + 2], f = n[r + 3]; + return t[e] = o * f + c * u + a * p - l * d, t[e + 1] = a * f + c * d + l * u - o * p, t[e + 2] = l * f + c * p + o * d - a * u, t[e + 3] = c * f - o * u - a * d - l * p, t; } get x() { return this._x; } - set x(e) { - this._x = e, this._onChangeCallback(); + set x(t) { + this._x = t, this._onChangeCallback(); } get y() { return this._y; } - set y(e) { - this._y = e, this._onChangeCallback(); + set y(t) { + this._y = t, this._onChangeCallback(); } get z() { return this._z; } - set z(e) { - this._z = e, this._onChangeCallback(); + set z(t) { + this._z = t, this._onChangeCallback(); } get w() { return this._w; } - set w(e) { - this._w = e, this._onChangeCallback(); + set w(t) { + this._w = t, this._onChangeCallback(); } - set(e, t, n, i) { - return this._x = e, this._y = t, this._z = n, this._w = i, this._onChangeCallback(), this; + set(t, e, i, s) { + return this._x = t, this._y = e, this._z = i, this._w = s, 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; + copy(t) { + return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this; } - setFromEuler(e, t) { - let n = e._x, i = e._y, r = e._z, a = e._order, o = Math.cos, c = Math.sin, l = o(n / 2), h = o(i / 2), u = o(r / 2), d = c(n / 2), f = c(i / 2), m = c(r / 2); - switch(a){ + setFromEuler(t, e = !0) { + let i = t._x, s = t._y, n = t._z, r = t._order, o = Math.cos, a = Math.sin, l = o(i / 2), c = o(s / 2), u = o(n / 2), d = a(i / 2), p = a(s / 2), f = a(n / 2); + switch(r){ case "XYZ": - this._x = d * h * u + l * f * m, this._y = l * f * u - d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u - d * f * m; + this._x = d * c * u + l * p * f, this._y = l * p * u - d * c * f, this._z = l * c * f + d * p * u, this._w = l * c * u - d * p * f; break; case "YXZ": - this._x = d * h * u + l * f * m, this._y = l * f * u - d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u + d * f * m; + this._x = d * c * u + l * p * f, this._y = l * p * u - d * c * f, this._z = l * c * f - d * p * u, this._w = l * c * u + d * p * f; break; case "ZXY": - this._x = d * h * u - l * f * m, this._y = l * f * u + d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u - d * f * m; + this._x = d * c * u - l * p * f, this._y = l * p * u + d * c * f, this._z = l * c * f + d * p * u, this._w = l * c * u - d * p * f; break; case "ZYX": - this._x = d * h * u - l * f * m, this._y = l * f * u + d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u + d * f * m; + this._x = d * c * u - l * p * f, this._y = l * p * u + d * c * f, this._z = l * c * f - d * p * u, this._w = l * c * u + d * p * f; break; case "YZX": - this._x = d * h * u + l * f * m, this._y = l * f * u + d * h * m, this._z = l * h * m - d * f * u, this._w = l * h * u - d * f * m; + this._x = d * c * u + l * p * f, this._y = l * p * u + d * c * f, this._z = l * c * f - d * p * u, this._w = l * c * u - d * p * f; break; case "XZY": - this._x = d * h * u - l * f * m, this._y = l * f * u - d * h * m, this._z = l * h * m + d * f * u, this._w = l * h * u + d * f * m; + this._x = d * c * u - l * p * f, this._y = l * p * u - d * c * f, this._z = l * c * f + d * p * u, this._w = l * c * u + d * p * f; break; default: - console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a); + console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + r); } - return t !== !1 && this._onChangeCallback(), this; + return e === !0 && this._onChangeCallback(), this; } - setFromAxisAngle(e, t) { - let 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; + setFromAxisAngle(t, e) { + let i = e / 2, s = Math.sin(i); + return this._x = t.x * s, this._y = t.y * s, this._z = t.z * s, this._w = Math.cos(i), this._onChangeCallback(), this; } - setFromRotationMatrix(e) { - let t = e.elements, n = t[0], i = t[4], r = t[8], a = t[1], o = t[5], c = t[9], l = t[2], h = t[6], u = t[10], d = n + o + u; + setFromRotationMatrix(t) { + let e = t.elements, i = e[0], s = e[4], n = e[8], r = e[1], o = e[5], a = e[9], l = e[2], c = e[6], u = e[10], d = i + o + u; if (d > 0) { - let f = .5 / Math.sqrt(d + 1); - this._w = .25 / f, this._x = (h - c) * f, this._y = (r - l) * f, this._z = (a - i) * f; - } else if (n > o && n > u) { - let f = 2 * Math.sqrt(1 + n - o - u); - this._w = (h - c) / f, this._x = .25 * f, this._y = (i + a) / f, this._z = (r + l) / f; + let p = .5 / Math.sqrt(d + 1); + this._w = .25 / p, this._x = (c - a) * p, this._y = (n - l) * p, this._z = (r - s) * p; + } else if (i > o && i > u) { + let p = 2 * Math.sqrt(1 + i - o - u); + this._w = (c - a) / p, this._x = .25 * p, this._y = (s + r) / p, this._z = (n + l) / p; } else if (o > u) { - let f = 2 * Math.sqrt(1 + o - n - u); - this._w = (r - l) / f, this._x = (i + a) / f, this._y = .25 * f, this._z = (c + h) / f; + let p = 2 * Math.sqrt(1 + o - i - u); + this._w = (n - l) / p, this._x = (s + r) / p, this._y = .25 * p, this._z = (a + c) / p; } else { - let f = 2 * Math.sqrt(1 + u - n - o); - this._w = (a - i) / f, this._x = (r + l) / f, this._y = (c + h) / f, this._z = .25 * f; + let p = 2 * Math.sqrt(1 + u - i - o); + this._w = (r - s) / p, this._x = (n + l) / p, this._y = (a + c) / p, this._z = .25 * p; } return this._onChangeCallback(), this; } - setFromUnitVectors(e, t) { - let n = e.dot(t) + 1; - return n < Number.EPSILON ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = n), this.normalize(); + setFromUnitVectors(t, e) { + let i = t.dot(e) + 1; + return i < Number.EPSILON ? (i = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = i) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = i)) : (this._x = t.y * e.z - t.z * e.y, this._y = t.z * e.x - t.x * e.z, this._z = t.x * e.y - t.y * e.x, this._w = i), this.normalize(); } - angleTo(e) { - return 2 * Math.acos(Math.abs(ct(this.dot(e), -1, 1))); + angleTo(t) { + return 2 * Math.acos(Math.abs(N(this.dot(t), -1, 1))); } - rotateTowards(e, t) { - let n = this.angleTo(e); - if (n === 0) return this; - let i = Math.min(1, t / n); - return this.slerp(e, i), this; + rotateTowards(t, e) { + let i = this.angleTo(t); + if (i === 0) return this; + let s = Math.min(1, e / i); + return this.slerp(t, s), this; } identity() { return this.set(0, 0, 0, 1); @@ -1438,8 +1501,8 @@ var je = class s1 { 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; + dot(t) { + return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w; } lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; @@ -1448,98 +1511,98 @@ var je = class s1 { 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; + let t = this.length(); + return t === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this._onChangeCallback(), this; } - multiply(e) { - return this.multiplyQuaternions(this, e); + multiply(t) { + return this.multiplyQuaternions(this, t); } - premultiply(e) { - return this.multiplyQuaternions(e, this); + premultiply(t) { + return this.multiplyQuaternions(t, this); } - multiplyQuaternions(e, t) { - let n = e._x, i = e._y, r = e._z, a = e._w, o = t._x, c = t._y, l = t._z, h = t._w; - return this._x = n * h + a * o + i * l - r * c, this._y = i * h + a * c + r * o - n * l, this._z = r * h + a * l + n * c - i * o, this._w = a * h - n * o - i * c - r * l, this._onChangeCallback(), this; + multiplyQuaternions(t, e) { + let i = t._x, s = t._y, n = t._z, r = t._w, o = e._x, a = e._y, l = e._z, c = e._w; + return this._x = i * c + r * o + s * l - n * a, this._y = s * c + r * a + n * o - i * l, this._z = n * c + r * l + i * a - s * o, this._w = r * c - i * o - s * a - n * l, this._onChangeCallback(), this; } - slerp(e, t) { - if (t === 0) return this; - if (t === 1) return this.copy(e); - let n = this._x, i = this._y, r = this._z, a = this._w, o = a * e._w + n * e._x + i * e._y + r * e._z; - if (o < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, o = -o) : this.copy(e), o >= 1) return this._w = a, this._x = n, this._y = i, this._z = r, this; - let c = 1 - o * o; - if (c <= Number.EPSILON) { - let f = 1 - t; - return this._w = f * a + t * this._w, this._x = f * n + t * this._x, this._y = f * i + t * this._y, this._z = f * r + t * this._z, this.normalize(), this._onChangeCallback(), this; + slerp(t, e) { + if (e === 0) return this; + if (e === 1) return this.copy(t); + let i = this._x, s = this._y, n = this._z, r = this._w, o = r * t._w + i * t._x + s * t._y + n * t._z; + if (o < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, o = -o) : this.copy(t), o >= 1) return this._w = r, this._x = i, this._y = s, this._z = n, this; + let a = 1 - o * o; + if (a <= Number.EPSILON) { + let p = 1 - e; + return this._w = p * r + e * this._w, this._x = p * i + e * this._x, this._y = p * s + e * this._y, this._z = p * n + e * this._z, this.normalize(), this; } - let l = Math.sqrt(c), h = Math.atan2(l, o), u = Math.sin((1 - t) * h) / l, d = Math.sin(t * h) / l; - return this._w = a * u + this._w * d, this._x = n * u + this._x * d, this._y = i * u + this._y * d, this._z = r * u + this._z * d, this._onChangeCallback(), this; + let l = Math.sqrt(a), c = Math.atan2(l, o), u = Math.sin((1 - e) * c) / l, d = Math.sin(e * c) / l; + return this._w = r * u + this._w * d, this._x = i * u + this._x * d, this._y = s * u + this._y * d, this._z = n * u + this._z * d, this._onChangeCallback(), this; } - slerpQuaternions(e, t, n) { - return this.copy(e).slerp(t, n); + slerpQuaternions(t, e, i) { + return this.copy(t).slerp(e, i); } random() { - let e = Math.random(), t = Math.sqrt(1 - e), n = Math.sqrt(e), i = 2 * Math.PI * Math.random(), r = 2 * Math.PI * Math.random(); - return this.set(t * Math.cos(i), n * Math.sin(r), n * Math.cos(r), t * Math.sin(i)); + let t = 2 * Math.PI * Math.random(), e = 2 * Math.PI * Math.random(), i = Math.random(), s = Math.sqrt(1 - i), n = Math.sqrt(i); + return this.set(s * Math.sin(t), s * Math.cos(t), n * Math.sin(e), n * Math.cos(e)); } - equals(e) { - return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w; + equals(t) { + return t._x === this._x && t._y === this._y && t._z === this._z && t._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; + fromArray(t, e = 0) { + return this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[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._w, e; + toArray(t = [], e = 0) { + return t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t; } - 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; + fromBufferAttribute(t, e) { + return this._x = t.getX(e), this._y = t.getY(e), this._z = t.getZ(e), this._w = t.getW(e), this._onChangeCallback(), this; } toJSON() { return this.toArray(); } - _onChange(e) { - return this._onChangeCallback = e, this; + _onChange(t) { + return this._onChangeCallback = t, this; } _onChangeCallback() {} *[Symbol.iterator]() { yield this._x, yield this._y, yield this._z, yield this._w; } -}, A = class s1 { - constructor(e = 0, t = 0, n = 0){ - s1.prototype.isVector3 = !0, this.x = e, this.y = t, this.z = n; +}, w = class h { + constructor(t = 0, e = 0, i = 0){ + h.prototype.isVector3 = !0, this.x = t, this.y = e, this.z = i; } - set(e, t, n) { - return n === void 0 && (n = this.z), this.x = e, this.y = t, this.z = n, this; + set(t, e, i) { + return i === void 0 && (i = this.z), this.x = t, this.y = e, this.z = i, this; } - setScalar(e) { - return this.x = e, this.y = e, this.z = e, this; + setScalar(t) { + return this.x = t, this.y = t, this.z = t, this; } - setX(e) { - return this.x = e, this; + setX(t) { + return this.x = t, this; } - setY(e) { - return this.y = e, this; + setY(t) { + return this.y = t, this; } - setZ(e) { - return this.z = e, this; + setZ(t) { + return this.z = t, this; } - setComponent(e, t) { - switch(e){ + setComponent(t, e) { + switch(t){ case 0: - this.x = t; + this.x = e; break; case 1: - this.y = t; + this.y = e; break; case 2: - this.z = t; + this.z = e; break; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } return this; } - getComponent(e) { - switch(e){ + getComponent(t) { + switch(t){ case 0: return this.x; case 1: @@ -1547,97 +1610,97 @@ var je = class s1 { case 2: return this.z; default: - throw new Error("index is out of range: " + e); + throw new Error("index is out of range: " + t); } } 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; + copy(t) { + return this.x = t.x, this.y = t.y, this.z = t.z, this; } - add(e) { - return this.x += e.x, this.y += e.y, this.z += e.z, this; + add(t) { + return this.x += t.x, this.y += t.y, this.z += t.z, this; } - addScalar(e) { - return this.x += e, this.y += e, this.z += e, this; + addScalar(t) { + return this.x += t, this.y += t, this.z += t, this; } - addVectors(e, t) { - return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this; + addVectors(t, e) { + return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this; } - addScaledVector(e, t) { - return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this; + addScaledVector(t, e) { + return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this; } - sub(e) { - return this.x -= e.x, this.y -= e.y, this.z -= e.z, this; + sub(t) { + return this.x -= t.x, this.y -= t.y, this.z -= t.z, this; } - subScalar(e) { - return this.x -= e, this.y -= e, this.z -= e, this; + subScalar(t) { + return this.x -= t, this.y -= t, this.z -= t, this; } - subVectors(e, t) { - return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this; + subVectors(t, e) { + return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this; } - multiply(e) { - return this.x *= e.x, this.y *= e.y, this.z *= e.z, this; + multiply(t) { + return this.x *= t.x, this.y *= t.y, this.z *= t.z, this; } - multiplyScalar(e) { - return this.x *= e, this.y *= e, this.z *= e, this; + multiplyScalar(t) { + return this.x *= t, this.y *= t, this.z *= t, this; } - multiplyVectors(e, t) { - return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this; + multiplyVectors(t, e) { + return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this; } - applyEuler(e) { - return this.applyQuaternion(Wl.setFromEuler(e)); + applyEuler(t) { + return this.applyQuaternion(ga.setFromEuler(t)); } - applyAxisAngle(e, t) { - return this.applyQuaternion(Wl.setFromAxisAngle(e, t)); + applyAxisAngle(t, e) { + return this.applyQuaternion(ga.setFromAxisAngle(t, e)); } - applyMatrix3(e) { - let t = this.x, n = this.y, i = this.z, r = e.elements; - return this.x = r[0] * t + r[3] * n + r[6] * i, this.y = r[1] * t + r[4] * n + r[7] * i, this.z = r[2] * t + r[5] * n + r[8] * i, this; + applyMatrix3(t) { + let e = this.x, i = this.y, s = this.z, n = t.elements; + return this.x = n[0] * e + n[3] * i + n[6] * s, this.y = n[1] * e + n[4] * i + n[7] * s, this.z = n[2] * e + n[5] * i + n[8] * s, this; } - applyNormalMatrix(e) { - return this.applyMatrix3(e).normalize(); + applyNormalMatrix(t) { + return this.applyMatrix3(t).normalize(); } - applyMatrix4(e) { - let t = this.x, n = this.y, i = this.z, r = e.elements, a = 1 / (r[3] * t + r[7] * n + r[11] * i + r[15]); - return this.x = (r[0] * t + r[4] * n + r[8] * i + r[12]) * a, this.y = (r[1] * t + r[5] * n + r[9] * i + r[13]) * a, this.z = (r[2] * t + r[6] * n + r[10] * i + r[14]) * a, this; + applyMatrix4(t) { + let e = this.x, i = this.y, s = this.z, n = t.elements, r = 1 / (n[3] * e + n[7] * i + n[11] * s + n[15]); + return this.x = (n[0] * e + n[4] * i + n[8] * s + n[12]) * r, this.y = (n[1] * e + n[5] * i + n[9] * s + n[13]) * r, this.z = (n[2] * e + n[6] * i + n[10] * s + n[14]) * r, this; } - applyQuaternion(e) { - let t = this.x, n = this.y, i = this.z, r = e.x, a = e.y, o = e.z, c = e.w, l = c * t + a * i - o * n, h = c * n + o * t - r * i, u = c * i + r * n - a * t, d = -r * t - a * n - o * i; - return this.x = l * c + d * -r + h * -o - u * -a, this.y = h * c + d * -a + u * -r - l * -o, this.z = u * c + d * -o + l * -a - h * -r, this; + applyQuaternion(t) { + let e = this.x, i = this.y, s = this.z, n = t.x, r = t.y, o = t.z, a = t.w, l = 2 * (r * s - o * i), c = 2 * (o * e - n * s), u = 2 * (n * i - r * e); + return this.x = e + a * l + r * u - o * c, this.y = i + a * c + o * l - n * u, this.z = s + a * u + n * c - r * l, this; } - project(e) { - return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix); + project(t) { + return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix); } - unproject(e) { - return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld); + unproject(t) { + return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld); } - transformDirection(e) { - let t = this.x, n = this.y, i = this.z, r = e.elements; - return this.x = r[0] * t + r[4] * n + r[8] * i, this.y = r[1] * t + r[5] * n + r[9] * i, this.z = r[2] * t + r[6] * n + r[10] * i, this.normalize(); + transformDirection(t) { + let e = this.x, i = this.y, s = this.z, n = t.elements; + return this.x = n[0] * e + n[4] * i + n[8] * s, this.y = n[1] * e + n[5] * i + n[9] * s, this.z = n[2] * e + n[6] * i + n[10] * s, this.normalize(); } - divide(e) { - return this.x /= e.x, this.y /= e.y, this.z /= e.z, this; + divide(t) { + return this.x /= t.x, this.y /= t.y, this.z /= t.z, this; } - divideScalar(e) { - return this.multiplyScalar(1 / e); + divideScalar(t) { + return this.multiplyScalar(1 / t); } - 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; + min(t) { + return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.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; + max(t) { + return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.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; + clamp(t, e) { + return this.x = N(this.x, t.x, e.x), this.y = N(this.y, t.y, e.y), this.z = N(this.z, t.z, e.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; + clampScalar(t, e) { + return this.x = N(this.x, t, e), this.y = N(this.y, t, e), this.z = N(this.z, t, e), this; } - clampLength(e, t) { - let n = this.length(); - return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))); + clampLength(t, e) { + let i = this.length(); + return this.divideScalar(i || 1).multiplyScalar(N(i, t, e)); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this; @@ -1654,8 +1717,8 @@ var je = class s1 { 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; + dot(t) { + return this.x * t.x + this.y * t.y + this.z * t.z; } lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; @@ -1669,139 +1732,139 @@ var je = class s1 { normalize() { return this.divideScalar(this.length() || 1); } - setLength(e) { - return this.normalize().multiplyScalar(e); + setLength(t) { + return this.normalize().multiplyScalar(t); } - 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; + lerp(t, e) { + return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, 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; + lerpVectors(t, e, i) { + return this.x = t.x + (e.x - t.x) * i, this.y = t.y + (e.y - t.y) * i, this.z = t.z + (e.z - t.z) * i, this; } - cross(e) { - return this.crossVectors(this, e); + cross(t) { + return this.crossVectors(this, t); } - crossVectors(e, t) { - let n = e.x, i = e.y, r = e.z, a = t.x, o = t.y, c = t.z; - return this.x = i * c - r * o, this.y = r * a - n * c, this.z = n * o - i * a, this; + crossVectors(t, e) { + let i = t.x, s = t.y, n = t.z, r = e.x, o = e.y, a = e.z; + return this.x = s * a - n * o, this.y = n * r - i * a, this.z = i * o - s * r, this; } - projectOnVector(e) { - let t = e.lengthSq(); - if (t === 0) return this.set(0, 0, 0); - let n = e.dot(this) / t; - return this.copy(e).multiplyScalar(n); + projectOnVector(t) { + let e = t.lengthSq(); + if (e === 0) return this.set(0, 0, 0); + let i = t.dot(this) / e; + return this.copy(t).multiplyScalar(i); } - projectOnPlane(e) { - return Oa.copy(this).projectOnVector(e), this.sub(Oa); + projectOnPlane(t) { + return Rn.copy(this).projectOnVector(t), this.sub(Rn); } - reflect(e) { - return this.sub(Oa.copy(e).multiplyScalar(2 * this.dot(e))); + reflect(t) { + return this.sub(Rn.copy(t).multiplyScalar(2 * this.dot(t))); } - angleTo(e) { - let t = Math.sqrt(this.lengthSq() * e.lengthSq()); - if (t === 0) return Math.PI / 2; - let n = this.dot(e) / t; - return Math.acos(ct(n, -1, 1)); + angleTo(t) { + let e = Math.sqrt(this.lengthSq() * t.lengthSq()); + if (e === 0) return Math.PI / 2; + let i = this.dot(t) / e; + return Math.acos(N(i, -1, 1)); } - distanceTo(e) { - return Math.sqrt(this.distanceToSquared(e)); + distanceTo(t) { + return Math.sqrt(this.distanceToSquared(t)); } - distanceToSquared(e) { - let t = this.x - e.x, n = this.y - e.y, i = this.z - e.z; - return t * t + n * n + i * i; + distanceToSquared(t) { + let e = this.x - t.x, i = this.y - t.y, s = this.z - t.z; + return e * e + i * i + s * s; } - manhattanDistanceTo(e) { - return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z); + manhattanDistanceTo(t) { + return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z); } - setFromSpherical(e) { - return this.setFromSphericalCoords(e.radius, e.phi, e.theta); + setFromSpherical(t) { + return this.setFromSphericalCoords(t.radius, t.phi, t.theta); } - setFromSphericalCoords(e, t, n) { - let 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; + setFromSphericalCoords(t, e, i) { + let s = Math.sin(e) * t; + return this.x = s * Math.sin(i), this.y = Math.cos(e) * t, this.z = s * Math.cos(i), this; } - setFromCylindrical(e) { - return this.setFromCylindricalCoords(e.radius, e.theta, e.y); + setFromCylindrical(t) { + return this.setFromCylindricalCoords(t.radius, t.theta, t.y); } - setFromCylindricalCoords(e, t, n) { - return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this; + setFromCylindricalCoords(t, e, i) { + return this.x = t * Math.sin(e), this.y = i, this.z = t * Math.cos(e), this; } - setFromMatrixPosition(e) { - let t = e.elements; - return this.x = t[12], this.y = t[13], this.z = t[14], this; + setFromMatrixPosition(t) { + let e = t.elements; + return this.x = e[12], this.y = e[13], this.z = e[14], this; } - setFromMatrixScale(e) { - let 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; + setFromMatrixScale(t) { + let e = this.setFromMatrixColumn(t, 0).length(), i = this.setFromMatrixColumn(t, 1).length(), s = this.setFromMatrixColumn(t, 2).length(); + return this.x = e, this.y = i, this.z = s, this; } - setFromMatrixColumn(e, t) { - return this.fromArray(e.elements, t * 4); + setFromMatrixColumn(t, e) { + return this.fromArray(t.elements, e * 4); } - setFromMatrix3Column(e, t) { - return this.fromArray(e.elements, t * 3); + setFromMatrix3Column(t, e) { + return this.fromArray(t.elements, e * 3); } - setFromEuler(e) { - return this.x = e._x, this.y = e._y, this.z = e._z, this; + setFromEuler(t) { + return this.x = t._x, this.y = t._y, this.z = t._z, this; } - setFromColor(e) { - return this.x = e.r, this.y = e.g, this.z = e.b, this; + setFromColor(t) { + return this.x = t.r, this.y = t.g, this.z = t.b, this; } - equals(e) { - return e.x === this.x && e.y === this.y && e.z === this.z; + equals(t) { + return t.x === this.x && t.y === this.y && t.z === this.z; } - fromArray(e, t = 0) { - return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this; + fromArray(t, e = 0) { + return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this; } - toArray(e = [], t = 0) { - return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e; + toArray(t = [], e = 0) { + return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t; } - fromBufferAttribute(e, t) { - return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this; + fromBufferAttribute(t, e) { + return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this; } randomDirection() { - let 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; + let t = Math.random() * Math.PI * 2, e = Math.random() * 2 - 1, i = Math.sqrt(1 - e * e); + return this.x = i * Math.cos(t), this.y = e, this.z = i * Math.sin(t), this; } *[Symbol.iterator]() { yield this.x, yield this.y, yield this.z; } -}, Oa = new A, Wl = new Ut, Qt = class { - constructor(e = new A(1 / 0, 1 / 0, 1 / 0), t = new A(-1 / 0, -1 / 0, -1 / 0)){ - this.isBox3 = !0, this.min = e, this.max = t; +}, Rn = new w, ga = new bt, ft = class { + constructor(t = new w(1 / 0, 1 / 0, 1 / 0), e = new w(-1 / 0, -1 / 0, -1 / 0)){ + this.isBox3 = !0, this.min = t, this.max = e; } - set(e, t) { - return this.min.copy(e), this.max.copy(t), this; + set(t, e) { + return this.min.copy(t), this.max.copy(e), this; } - setFromArray(e) { + setFromArray(t) { this.makeEmpty(); - for(let t = 0, n = e.length; t < n; t += 3)this.expandByPoint(cn.fromArray(e, t)); + for(let e = 0, i = t.length; e < i; e += 3)this.expandByPoint(Nt.fromArray(t, e)); return this; } - setFromBufferAttribute(e) { + setFromBufferAttribute(t) { this.makeEmpty(); - for(let t = 0, n = e.count; t < n; t++)this.expandByPoint(cn.fromBufferAttribute(e, t)); + for(let e = 0, i = t.count; e < i; e++)this.expandByPoint(Nt.fromBufferAttribute(t, e)); return this; } - setFromPoints(e) { + setFromPoints(t) { this.makeEmpty(); - for(let t = 0, n = e.length; t < n; t++)this.expandByPoint(e[t]); + for(let e = 0, i = t.length; e < i; e++)this.expandByPoint(t[e]); return this; } - setFromCenterAndSize(e, t) { - let n = cn.copy(t).multiplyScalar(.5); - return this.min.copy(e).sub(n), this.max.copy(e).add(n), this; + setFromCenterAndSize(t, e) { + let i = Nt.copy(e).multiplyScalar(.5); + return this.min.copy(t).sub(i), this.max.copy(t).add(i), this; } - setFromObject(e, t = !1) { - return this.makeEmpty(), this.expandByObject(e, t); + setFromObject(t, e = !1) { + return this.makeEmpty(), this.expandByObject(t, e); } clone() { return new this.constructor().copy(this); } - copy(e) { - return this.min.copy(e.min), this.max.copy(e.max), this; + copy(t) { + return this.min.copy(t.min), this.max.copy(t.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; @@ -1809,86 +1872,85 @@ var je = class s1 { 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); + getCenter(t) { + return this.isEmpty() ? t.set(0, 0, 0) : t.addVectors(this.min, this.max).multiplyScalar(.5); } - getSize(e) { - return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min); + getSize(t) { + return this.isEmpty() ? t.set(0, 0, 0) : t.subVectors(this.max, this.min); } - expandByPoint(e) { - return this.min.min(e), this.max.max(e), this; + expandByPoint(t) { + return this.min.min(t), this.max.max(t), this; } - expandByVector(e) { - return this.min.sub(e), this.max.add(e), this; + expandByVector(t) { + return this.min.sub(t), this.max.add(t), this; } - expandByScalar(e) { - return this.min.addScalar(-e), this.max.addScalar(e), this; + expandByScalar(t) { + return this.min.addScalar(-t), this.max.addScalar(t), this; } - expandByObject(e, t = !1) { - if (e.updateWorldMatrix(!1, !1), e.boundingBox !== void 0) e.boundingBox === null && e.computeBoundingBox(), _i.copy(e.boundingBox), _i.applyMatrix4(e.matrixWorld), this.union(_i); - else { - let i = e.geometry; - if (i !== void 0) if (t && i.attributes !== void 0 && i.attributes.position !== void 0) { - let r = i.attributes.position; - for(let a = 0, o = r.count; a < o; a++)cn.fromBufferAttribute(r, a).applyMatrix4(e.matrixWorld), this.expandByPoint(cn); - } else i.boundingBox === null && i.computeBoundingBox(), _i.copy(i.boundingBox), _i.applyMatrix4(e.matrixWorld), this.union(_i); - } - let n = e.children; - for(let i = 0, r = n.length; i < r; i++)this.expandByObject(n[i], t); + expandByObject(t, e = !1) { + t.updateWorldMatrix(!1, !1); + let i = t.geometry; + if (i !== void 0) { + let n = i.getAttribute("position"); + if (e === !0 && n !== void 0 && t.isInstancedMesh !== !0) for(let r = 0, o = n.count; r < o; r++)t.isMesh === !0 ? t.getVertexPosition(r, Nt) : Nt.fromBufferAttribute(n, r), Nt.applyMatrix4(t.matrixWorld), this.expandByPoint(Nt); + else t.boundingBox !== void 0 ? (t.boundingBox === null && t.computeBoundingBox(), ss.copy(t.boundingBox)) : (i.boundingBox === null && i.computeBoundingBox(), ss.copy(i.boundingBox)), ss.applyMatrix4(t.matrixWorld), this.union(ss); + } + let s = t.children; + for(let n = 0, r = s.length; n < r; n++)this.expandByObject(s[n], e); 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); + containsPoint(t) { + return t.x >= this.min.x && t.x <= this.max.x && t.y >= this.min.y && t.y <= this.max.y && t.z >= this.min.z && t.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; + containsBox(t) { + return this.min.x <= t.min.x && t.max.x <= this.max.x && this.min.y <= t.min.y && t.max.y <= this.max.y && this.min.z <= t.min.z && t.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)); + getParameter(t, e) { + return e.set((t.x - this.min.x) / (this.max.x - this.min.x), (t.y - this.min.y) / (this.max.y - this.min.y), (t.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); + intersectsBox(t) { + return t.max.x >= this.min.x && t.min.x <= this.max.x && t.max.y >= this.min.y && t.min.y <= this.max.y && t.max.z >= this.min.z && t.min.z <= this.max.z; } - intersectsSphere(e) { - return this.clampPoint(e.center, cn), cn.distanceToSquared(e.center) <= e.radius * e.radius; + intersectsSphere(t) { + return this.clampPoint(t.center, Nt), Nt.distanceToSquared(t.center) <= t.radius * t.radius; } - intersectsPlane(e) { - let t, n; - return e.normal.x > 0 ? (t = e.normal.x * this.min.x, n = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, n = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n >= -e.constant; + intersectsPlane(t) { + let e, i; + return t.normal.x > 0 ? (e = t.normal.x * this.min.x, i = t.normal.x * this.max.x) : (e = t.normal.x * this.max.x, i = t.normal.x * this.min.x), t.normal.y > 0 ? (e += t.normal.y * this.min.y, i += t.normal.y * this.max.y) : (e += t.normal.y * this.max.y, i += t.normal.y * this.min.y), t.normal.z > 0 ? (e += t.normal.z * this.min.z, i += t.normal.z * this.max.z) : (e += t.normal.z * this.max.z, i += t.normal.z * this.min.z), e <= -t.constant && i >= -t.constant; } - intersectsTriangle(e) { + intersectsTriangle(t) { if (this.isEmpty()) return !1; - this.getCenter(cs), Ws.subVectors(this.max, cs), xi.subVectors(e.a, cs), vi.subVectors(e.b, cs), yi.subVectors(e.c, cs), Tn.subVectors(vi, xi), wn.subVectors(yi, vi), Wn.subVectors(xi, yi); - let t = [ + this.getCenter(Ai), ns.subVectors(this.max, Ai), Xe.subVectors(t.a, Ai), Je.subVectors(t.b, Ai), Ze.subVectors(t.c, Ai), ue.subVectors(Je, Xe), de.subVectors(Ze, Je), Te.subVectors(Xe, Ze); + let e = [ 0, - -Tn.z, - Tn.y, + -ue.z, + ue.y, 0, - -wn.z, - wn.y, + -de.z, + de.y, 0, - -Wn.z, - Wn.y, - Tn.z, + -Te.z, + Te.y, + ue.z, 0, - -Tn.x, - wn.z, + -ue.x, + de.z, 0, - -wn.x, - Wn.z, + -de.x, + Te.z, 0, - -Wn.x, - -Tn.y, - Tn.x, + -Te.x, + -ue.y, + ue.x, 0, - -wn.y, - wn.x, + -de.y, + de.x, 0, - -Wn.y, - Wn.x, + -Te.y, + Te.x, 0 ]; - return !Fa(t, xi, vi, yi, Ws) || (t = [ + return !kn(e, Xe, Je, Ze, ns) || (e = [ 1, 0, 0, @@ -1898,70 +1960,70 @@ var je = class s1 { 0, 0, 1 - ], !Fa(t, xi, vi, yi, Ws)) ? !1 : (Xs.crossVectors(Tn, wn), t = [ - Xs.x, - Xs.y, - Xs.z - ], Fa(t, xi, vi, yi, Ws)); - } - clampPoint(e, t) { - return t.copy(e).clamp(this.min, this.max); - } - distanceToPoint(e) { - return this.clampPoint(e, cn).distanceTo(e); - } - getBoundingSphere(e) { - return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(cn).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 : (on[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), on[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), on[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), on[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), on[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), on[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), on[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), on[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(on), 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); - } -}, on = [ - new A, - new A, - new A, - new A, - new A, - new A, - new A, - new A -], cn = new A, _i = new Qt, xi = new A, vi = new A, yi = new A, Tn = new A, wn = new A, Wn = new A, cs = new A, Ws = new A, Xs = new A, Xn = new A; -function Fa(s1, e, t, n, i) { - for(let r = 0, a = s1.length - 3; r <= a; r += 3){ - Xn.fromArray(s1, r); - let o = i.x * Math.abs(Xn.x) + i.y * Math.abs(Xn.y) + i.z * Math.abs(Xn.z), c = e.dot(Xn), l = t.dot(Xn), h = n.dot(Xn); - if (Math.max(-Math.max(c, l, h), Math.min(c, l, h)) > o) return !1; + ], !kn(e, Xe, Je, Ze, ns)) ? !1 : (rs.crossVectors(ue, de), e = [ + rs.x, + rs.y, + rs.z + ], kn(e, Xe, Je, Ze, ns)); + } + clampPoint(t, e) { + return e.copy(t).clamp(this.min, this.max); + } + distanceToPoint(t) { + return this.clampPoint(t, Nt).distanceTo(t); + } + getBoundingSphere(t) { + return this.isEmpty() ? t.makeEmpty() : (this.getCenter(t.center), t.radius = this.getSize(Nt).length() * .5), t; + } + intersect(t) { + return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this; + } + union(t) { + return this.min.min(t.min), this.max.max(t.max), this; + } + applyMatrix4(t) { + return this.isEmpty() ? this : (jt[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), jt[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), jt[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), jt[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), jt[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), jt[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), jt[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), jt[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(jt), this); + } + translate(t) { + return this.min.add(t), this.max.add(t), this; + } + equals(t) { + return t.min.equals(this.min) && t.max.equals(this.max); + } +}, jt = [ + new w, + new w, + new w, + new w, + new w, + new w, + new w, + new w +], Nt = new w, ss = new ft, Xe = new w, Je = new w, Ze = new w, ue = new w, de = new w, Te = new w, Ai = new w, ns = new w, rs = new w, Ie = new w; +function kn(h, t, e, i, s) { + for(let n = 0, r = h.length - 3; n <= r; n += 3){ + Ie.fromArray(h, n); + let o = s.x * Math.abs(Ie.x) + s.y * Math.abs(Ie.y) + s.z * Math.abs(Ie.z), a = t.dot(Ie), l = e.dot(Ie), c = i.dot(Ie); + if (Math.max(-Math.max(a, l, c), Math.min(a, l, c)) > o) return !1; } return !0; } -var rp = new Qt, ls = new A, Ba = new A, Yt = class { - constructor(e = new A, t = -1){ - this.center = e, this.radius = t; +var mu = new ft, Si = new w, Pn = new w, ht = class { + constructor(t = new w, e = -1){ + this.isSphere = !0, this.center = t, this.radius = e; } - set(e, t) { - return this.center.copy(e), this.radius = t, this; + set(t, e) { + return this.center.copy(t), this.radius = e, this; } - setFromPoints(e, t) { - let n = this.center; - t !== void 0 ? n.copy(t) : rp.setFromPoints(e).getCenter(n); - let i = 0; - for(let r = 0, a = e.length; r < a; r++)i = Math.max(i, n.distanceToSquared(e[r])); - return this.radius = Math.sqrt(i), this; + setFromPoints(t, e) { + let i = this.center; + e !== void 0 ? i.copy(e) : mu.setFromPoints(t).getCenter(i); + let s = 0; + for(let n = 0, r = t.length; n < r; n++)s = Math.max(s, i.distanceToSquared(t[n])); + return this.radius = Math.sqrt(s), this; } - copy(e) { - return this.center.copy(e.center), this.radius = e.radius, this; + copy(t) { + return this.center.copy(t.center), this.radius = t.radius, this; } isEmpty() { return this.radius < 0; @@ -1969,156 +2031,156 @@ var rp = new Qt, ls = new A, Ba = new A, Yt = class { makeEmpty() { return this.center.set(0, 0, 0), this.radius = -1, this; } - containsPoint(e) { - return e.distanceToSquared(this.center) <= this.radius * this.radius; + containsPoint(t) { + return t.distanceToSquared(this.center) <= this.radius * this.radius; } - distanceToPoint(e) { - return e.distanceTo(this.center) - this.radius; + distanceToPoint(t) { + return t.distanceTo(this.center) - this.radius; } - intersectsSphere(e) { - let t = this.radius + e.radius; - return e.center.distanceToSquared(this.center) <= t * t; + intersectsSphere(t) { + let e = this.radius + t.radius; + return t.center.distanceToSquared(this.center) <= e * e; } - intersectsBox(e) { - return e.intersectsSphere(this); + intersectsBox(t) { + return t.intersectsSphere(this); } - intersectsPlane(e) { - return Math.abs(e.distanceToPoint(this.center)) <= this.radius; + intersectsPlane(t) { + return Math.abs(t.distanceToPoint(this.center)) <= this.radius; } - clampPoint(e, t) { - let 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; + clampPoint(t, e) { + let i = this.center.distanceToSquared(t); + return e.copy(t), i > this.radius * this.radius && (e.sub(this.center).normalize(), e.multiplyScalar(this.radius).add(this.center)), e; } - getBoundingBox(e) { - return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e); + getBoundingBox(t) { + return this.isEmpty() ? (t.makeEmpty(), t) : (t.set(this.center, this.center), t.expandByScalar(this.radius), t); } - applyMatrix4(e) { - return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this; + applyMatrix4(t) { + return this.center.applyMatrix4(t), this.radius = this.radius * t.getMaxScaleOnAxis(), this; } - translate(e) { - return this.center.add(e), this; + translate(t) { + return this.center.add(t), this; } - expandByPoint(e) { - if (this.isEmpty()) return this.center.copy(e), this.radius = 0, this; - ls.subVectors(e, this.center); - let t = ls.lengthSq(); - if (t > this.radius * this.radius) { - let n = Math.sqrt(t), i = (n - this.radius) * .5; - this.center.addScaledVector(ls, i / n), this.radius += i; + expandByPoint(t) { + if (this.isEmpty()) return this.center.copy(t), this.radius = 0, this; + Si.subVectors(t, this.center); + let e = Si.lengthSq(); + if (e > this.radius * this.radius) { + let i = Math.sqrt(e), s = (i - this.radius) * .5; + this.center.addScaledVector(Si, s / i), this.radius += s; } 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) : (Ba.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(ls.copy(e.center).add(Ba)), this.expandByPoint(ls.copy(e.center).sub(Ba))), this); + union(t) { + return t.isEmpty() ? this : this.isEmpty() ? (this.copy(t), this) : (this.center.equals(t.center) === !0 ? this.radius = Math.max(this.radius, t.radius) : (Pn.subVectors(t.center, this.center).setLength(t.radius), this.expandByPoint(Si.copy(t.center).add(Pn)), this.expandByPoint(Si.copy(t.center).sub(Pn))), this); } - equals(e) { - return e.center.equals(this.center) && e.radius === this.radius; + equals(t) { + return t.center.equals(this.center) && t.radius === this.radius; } clone() { return new this.constructor().copy(this); } -}, ln = new A, za = new A, qs = new A, An = new A, Va = new A, Ys = new A, ka = new A, hi = class { - constructor(e = new A, t = new A(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, ln)), this; - } - closestPointToPoint(e, t) { - t.subVectors(e, this.origin); - let 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) { - let t = ln.subVectors(e, this.origin).dot(this.direction); - return t < 0 ? this.origin.distanceToSquared(e) : (ln.copy(this.origin).addScaledVector(this.direction, t), ln.distanceToSquared(e)); - } - distanceSqToSegment(e, t, n, i) { - za.copy(e).add(t).multiplyScalar(.5), qs.copy(t).sub(e).normalize(), An.copy(this.origin).sub(za); - let r = e.distanceTo(t) * .5, a = -this.direction.dot(qs), o = An.dot(this.direction), c = -An.dot(qs), l = An.lengthSq(), h = Math.abs(1 - a * a), u, d, f, m; - if (h > 0) if (u = a * c - o, d = a * o - c, m = r * h, u >= 0) if (d >= -m) if (d <= m) { - let _ = 1 / h; - u *= _, d *= _, f = u * (u + a * d + 2 * o) + d * (a * u + d + 2 * c) + l; - } else d = r, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * c) + l; - else d = -r, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * c) + l; - else d <= -m ? (u = Math.max(0, -(-a * r + o)), d = u > 0 ? -r : Math.min(Math.max(-r, -c), r), f = -u * u + d * (d + 2 * c) + l) : d <= m ? (u = 0, d = Math.min(Math.max(-r, -c), r), f = d * (d + 2 * c) + l) : (u = Math.max(0, -(a * r + o)), d = u > 0 ? r : Math.min(Math.max(-r, -c), r), f = -u * u + d * (d + 2 * c) + l); - else d = a > 0 ? -r : r, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * c) + l; - return n && n.copy(this.origin).addScaledVector(this.direction, u), i && i.copy(za).addScaledVector(qs, d), f; - } - intersectSphere(e, t) { - ln.subVectors(e.center, this.origin); - let n = ln.dot(this.direction), i = ln.dot(ln) - n * n, r = e.radius * e.radius; - if (i > r) return null; - let a = Math.sqrt(r - i), o = n - a, c = n + a; - return c < 0 ? null : o < 0 ? this.at(c, t) : this.at(o, t); - } - intersectsSphere(e) { - return this.distanceSqToPoint(e.center) <= e.radius * e.radius; - } - distanceToPlane(e) { - let t = e.normal.dot(this.direction); - if (t === 0) return e.distanceToPoint(this.origin) === 0 ? 0 : null; - let n = -(this.origin.dot(e.normal) + e.constant) / t; - return n >= 0 ? n : null; - } - intersectPlane(e, t) { - let n = this.distanceToPlane(e); - return n === null ? null : this.at(n, t); - } - intersectsPlane(e) { - let t = e.distanceToPoint(this.origin); - return t === 0 || e.normal.dot(this.direction) * t < 0; - } - intersectBox(e, t) { - let n, i, r, a, o, c, l = 1 / this.direction.x, h = 1 / this.direction.y, u = 1 / this.direction.z, d = this.origin; - return l >= 0 ? (n = (e.min.x - d.x) * l, i = (e.max.x - d.x) * l) : (n = (e.max.x - d.x) * l, i = (e.min.x - d.x) * l), h >= 0 ? (r = (e.min.y - d.y) * h, a = (e.max.y - d.y) * h) : (r = (e.max.y - d.y) * h, a = (e.min.y - d.y) * h), n > a || r > i || ((r > n || isNaN(n)) && (n = r), (a < i || isNaN(i)) && (i = a), u >= 0 ? (o = (e.min.z - d.z) * u, c = (e.max.z - d.z) * u) : (o = (e.max.z - d.z) * u, c = (e.min.z - d.z) * u), n > c || o > i) || ((o > n || n !== n) && (n = o), (c < i || i !== i) && (i = c), i < 0) ? null : this.at(n >= 0 ? n : i, t); - } - intersectsBox(e) { - return this.intersectBox(e, ln) !== null; - } - intersectTriangle(e, t, n, i, r) { - Va.subVectors(t, e), Ys.subVectors(n, e), ka.crossVectors(Va, Ys); - let a = this.direction.dot(ka), o; - if (a > 0) { - if (i) return null; +}, Kt = new w, On = new w, os = new w, pe = new w, Nn = new w, as = new w, Vn = new w, Le = class { + constructor(t = new w, e = new w(0, 0, -1)){ + this.origin = t, this.direction = e; + } + set(t, e) { + return this.origin.copy(t), this.direction.copy(e), this; + } + copy(t) { + return this.origin.copy(t.origin), this.direction.copy(t.direction), this; + } + at(t, e) { + return e.copy(this.origin).addScaledVector(this.direction, t); + } + lookAt(t) { + return this.direction.copy(t).sub(this.origin).normalize(), this; + } + recast(t) { + return this.origin.copy(this.at(t, Kt)), this; + } + closestPointToPoint(t, e) { + e.subVectors(t, this.origin); + let i = e.dot(this.direction); + return i < 0 ? e.copy(this.origin) : e.copy(this.origin).addScaledVector(this.direction, i); + } + distanceToPoint(t) { + return Math.sqrt(this.distanceSqToPoint(t)); + } + distanceSqToPoint(t) { + let e = Kt.subVectors(t, this.origin).dot(this.direction); + return e < 0 ? this.origin.distanceToSquared(t) : (Kt.copy(this.origin).addScaledVector(this.direction, e), Kt.distanceToSquared(t)); + } + distanceSqToSegment(t, e, i, s) { + On.copy(t).add(e).multiplyScalar(.5), os.copy(e).sub(t).normalize(), pe.copy(this.origin).sub(On); + let n = t.distanceTo(e) * .5, r = -this.direction.dot(os), o = pe.dot(this.direction), a = -pe.dot(os), l = pe.lengthSq(), c = Math.abs(1 - r * r), u, d, p, f; + if (c > 0) if (u = r * a - o, d = r * o - a, f = n * c, u >= 0) if (d >= -f) if (d <= f) { + let m = 1 / c; + u *= m, d *= m, p = u * (u + r * d + 2 * o) + d * (r * u + d + 2 * a) + l; + } else d = n, u = Math.max(0, -(r * d + o)), p = -u * u + d * (d + 2 * a) + l; + else d = -n, u = Math.max(0, -(r * d + o)), p = -u * u + d * (d + 2 * a) + l; + else d <= -f ? (u = Math.max(0, -(-r * n + o)), d = u > 0 ? -n : Math.min(Math.max(-n, -a), n), p = -u * u + d * (d + 2 * a) + l) : d <= f ? (u = 0, d = Math.min(Math.max(-n, -a), n), p = d * (d + 2 * a) + l) : (u = Math.max(0, -(r * n + o)), d = u > 0 ? n : Math.min(Math.max(-n, -a), n), p = -u * u + d * (d + 2 * a) + l); + else d = r > 0 ? -n : n, u = Math.max(0, -(r * d + o)), p = -u * u + d * (d + 2 * a) + l; + return i && i.copy(this.origin).addScaledVector(this.direction, u), s && s.copy(On).addScaledVector(os, d), p; + } + intersectSphere(t, e) { + Kt.subVectors(t.center, this.origin); + let i = Kt.dot(this.direction), s = Kt.dot(Kt) - i * i, n = t.radius * t.radius; + if (s > n) return null; + let r = Math.sqrt(n - s), o = i - r, a = i + r; + return a < 0 ? null : o < 0 ? this.at(a, e) : this.at(o, e); + } + intersectsSphere(t) { + return this.distanceSqToPoint(t.center) <= t.radius * t.radius; + } + distanceToPlane(t) { + let e = t.normal.dot(this.direction); + if (e === 0) return t.distanceToPoint(this.origin) === 0 ? 0 : null; + let i = -(this.origin.dot(t.normal) + t.constant) / e; + return i >= 0 ? i : null; + } + intersectPlane(t, e) { + let i = this.distanceToPlane(t); + return i === null ? null : this.at(i, e); + } + intersectsPlane(t) { + let e = t.distanceToPoint(this.origin); + return e === 0 || t.normal.dot(this.direction) * e < 0; + } + intersectBox(t, e) { + let i, s, n, r, o, a, l = 1 / this.direction.x, c = 1 / this.direction.y, u = 1 / this.direction.z, d = this.origin; + return l >= 0 ? (i = (t.min.x - d.x) * l, s = (t.max.x - d.x) * l) : (i = (t.max.x - d.x) * l, s = (t.min.x - d.x) * l), c >= 0 ? (n = (t.min.y - d.y) * c, r = (t.max.y - d.y) * c) : (n = (t.max.y - d.y) * c, r = (t.min.y - d.y) * c), i > r || n > s || ((n > i || isNaN(i)) && (i = n), (r < s || isNaN(s)) && (s = r), u >= 0 ? (o = (t.min.z - d.z) * u, a = (t.max.z - d.z) * u) : (o = (t.max.z - d.z) * u, a = (t.min.z - d.z) * u), i > a || o > s) || ((o > i || i !== i) && (i = o), (a < s || s !== s) && (s = a), s < 0) ? null : this.at(i >= 0 ? i : s, e); + } + intersectsBox(t) { + return this.intersectBox(t, Kt) !== null; + } + intersectTriangle(t, e, i, s, n) { + Nn.subVectors(e, t), as.subVectors(i, t), Vn.crossVectors(Nn, as); + let r = this.direction.dot(Vn), o; + if (r > 0) { + if (s) return null; o = 1; - } else if (a < 0) o = -1, a = -a; + } else if (r < 0) o = -1, r = -r; else return null; - An.subVectors(this.origin, e); - let c = o * this.direction.dot(Ys.crossVectors(An, Ys)); - if (c < 0) return null; - let l = o * this.direction.dot(Va.cross(An)); - if (l < 0 || c + l > a) return null; - let h = -o * An.dot(ka); - return h < 0 ? null : this.at(h / a, r); + pe.subVectors(this.origin, t); + let a = o * this.direction.dot(as.crossVectors(pe, as)); + if (a < 0) return null; + let l = o * this.direction.dot(Nn.cross(pe)); + if (l < 0 || a + l > r) return null; + let c = -o * pe.dot(Vn); + return c < 0 ? null : this.at(c / r, n); } - applyMatrix4(e) { - return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this; + applyMatrix4(t) { + return this.origin.applyMatrix4(t), this.direction.transformDirection(t), this; } - equals(e) { - return e.origin.equals(this.origin) && e.direction.equals(this.direction); + equals(t) { + return t.origin.equals(this.origin) && t.direction.equals(this.direction); } clone() { return new this.constructor().copy(this); } -}, ze = class s1 { - constructor(e, t, n, i, r, a, o, c, l, h, u, d, f, m, _, g){ - s1.prototype.isMatrix4 = !0, this.elements = [ +}, D = class h { + constructor(t, e, i, s, n, r, o, a, l, c, u, d, p, f, m, y1){ + h.prototype.isMatrix4 = !0, this.elements = [ 1, 0, 0, @@ -2135,494 +2197,493 @@ var rp = new Qt, ls = new A, Ba = new A, Yt = class { 0, 0, 1 - ], e !== void 0 && this.set(e, t, n, i, r, a, o, c, l, h, u, d, f, m, _, g); + ], t !== void 0 && this.set(t, e, i, s, n, r, o, a, l, c, u, d, p, f, m, y1); } - set(e, t, n, i, r, a, o, c, l, h, u, d, f, m, _, g) { - let p = this.elements; - return p[0] = e, p[4] = t, p[8] = n, p[12] = i, p[1] = r, p[5] = a, p[9] = o, p[13] = c, p[2] = l, p[6] = h, p[10] = u, p[14] = d, p[3] = f, p[7] = m, p[11] = _, p[15] = g, this; + set(t, e, i, s, n, r, o, a, l, c, u, d, p, f, m, y1) { + let g = this.elements; + return g[0] = t, g[4] = e, g[8] = i, g[12] = s, g[1] = n, g[5] = r, g[9] = o, g[13] = a, g[2] = l, g[6] = c, g[10] = u, g[14] = d, g[3] = p, g[7] = f, g[11] = m, g[15] = y1, 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 s1().fromArray(this.elements); - } - copy(e) { - let 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) { - let t = this.elements, n = e.elements; - return t[12] = n[12], t[13] = n[13], t[14] = n[14], this; - } - setFromMatrix3(e) { - let 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) { - let t = this.elements, n = e.elements, i = 1 / Mi.setFromMatrixColumn(e, 0).length(), r = 1 / Mi.setFromMatrixColumn(e, 1).length(), a = 1 / Mi.setFromMatrixColumn(e, 2).length(); - return t[0] = n[0] * i, t[1] = n[1] * i, t[2] = n[2] * i, t[3] = 0, t[4] = n[4] * r, t[5] = n[5] * r, t[6] = n[6] * r, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; - } - makeRotationFromEuler(e) { - let t = this.elements, n = e.x, i = e.y, r = e.z, a = Math.cos(n), o = Math.sin(n), c = Math.cos(i), l = Math.sin(i), h = Math.cos(r), u = Math.sin(r); - if (e.order === "XYZ") { - let d = a * h, f = a * u, m = o * h, _ = o * u; - t[0] = c * h, t[4] = -c * u, t[8] = l, t[1] = f + m * l, t[5] = d - _ * l, t[9] = -o * c, t[2] = _ - d * l, t[6] = m + f * l, t[10] = a * c; - } else if (e.order === "YXZ") { - let d = c * h, f = c * u, m = l * h, _ = l * u; - t[0] = d + _ * o, t[4] = m * o - f, t[8] = a * l, t[1] = a * u, t[5] = a * h, t[9] = -o, t[2] = f * o - m, t[6] = _ + d * o, t[10] = a * c; - } else if (e.order === "ZXY") { - let d = c * h, f = c * u, m = l * h, _ = l * u; - t[0] = d - _ * o, t[4] = -a * u, t[8] = m + f * o, t[1] = f + m * o, t[5] = a * h, t[9] = _ - d * o, t[2] = -a * l, t[6] = o, t[10] = a * c; - } else if (e.order === "ZYX") { - let d = a * h, f = a * u, m = o * h, _ = o * u; - t[0] = c * h, t[4] = m * l - f, t[8] = d * l + _, t[1] = c * u, t[5] = _ * l + d, t[9] = f * l - m, t[2] = -l, t[6] = o * c, t[10] = a * c; - } else if (e.order === "YZX") { - let d = a * c, f = a * l, m = o * c, _ = o * l; - t[0] = c * h, t[4] = _ - d * u, t[8] = m * u + f, t[1] = u, t[5] = a * h, t[9] = -o * h, t[2] = -l * h, t[6] = f * u + m, t[10] = d - _ * u; - } else if (e.order === "XZY") { - let d = a * c, f = a * l, m = o * c, _ = o * l; - t[0] = c * h, t[4] = -u, t[8] = l * h, t[1] = d * u + _, t[5] = a * h, t[9] = f * u - m, t[2] = m * u - f, t[6] = o * h, t[10] = _ * u + d; - } - return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; - } - makeRotationFromQuaternion(e) { - return this.compose(ap, e, op); - } - lookAt(e, t, n) { - let i = this.elements; - return zt.subVectors(e, t), zt.lengthSq() === 0 && (zt.z = 1), zt.normalize(), Rn.crossVectors(n, zt), Rn.lengthSq() === 0 && (Math.abs(n.z) === 1 ? zt.x += 1e-4 : zt.z += 1e-4, zt.normalize(), Rn.crossVectors(n, zt)), Rn.normalize(), Zs.crossVectors(zt, Rn), i[0] = Rn.x, i[4] = Zs.x, i[8] = zt.x, i[1] = Rn.y, i[5] = Zs.y, i[9] = zt.y, i[2] = Rn.z, i[6] = Zs.z, i[10] = zt.z, this; - } - multiply(e) { - return this.multiplyMatrices(this, e); - } - premultiply(e) { - return this.multiplyMatrices(e, this); - } - multiplyMatrices(e, t) { - let n = e.elements, i = t.elements, r = this.elements, a = n[0], o = n[4], c = n[8], l = n[12], h = n[1], u = n[5], d = n[9], f = n[13], m = n[2], _ = n[6], g = n[10], p = n[14], v = n[3], x1 = n[7], y1 = n[11], b = n[15], w = i[0], R = i[4], I = i[8], M = i[12], T = i[1], O = i[5], Y = i[9], $ = i[13], U = i[2], z = i[6], q = i[10], H = i[14], ne = i[3], W = i[7], K = i[11], D = i[15]; - return r[0] = a * w + o * T + c * U + l * ne, r[4] = a * R + o * O + c * z + l * W, r[8] = a * I + o * Y + c * q + l * K, r[12] = a * M + o * $ + c * H + l * D, r[1] = h * w + u * T + d * U + f * ne, r[5] = h * R + u * O + d * z + f * W, r[9] = h * I + u * Y + d * q + f * K, r[13] = h * M + u * $ + d * H + f * D, r[2] = m * w + _ * T + g * U + p * ne, r[6] = m * R + _ * O + g * z + p * W, r[10] = m * I + _ * Y + g * q + p * K, r[14] = m * M + _ * $ + g * H + p * D, r[3] = v * w + x1 * T + y1 * U + b * ne, r[7] = v * R + x1 * O + y1 * z + b * W, r[11] = v * I + x1 * Y + y1 * q + b * K, r[15] = v * M + x1 * $ + y1 * H + b * D, this; - } - multiplyScalar(e) { - let 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; + return new h().fromArray(this.elements); + } + copy(t) { + let e = this.elements, i = t.elements; + return e[0] = i[0], e[1] = i[1], e[2] = i[2], e[3] = i[3], e[4] = i[4], e[5] = i[5], e[6] = i[6], e[7] = i[7], e[8] = i[8], e[9] = i[9], e[10] = i[10], e[11] = i[11], e[12] = i[12], e[13] = i[13], e[14] = i[14], e[15] = i[15], this; + } + copyPosition(t) { + let e = this.elements, i = t.elements; + return e[12] = i[12], e[13] = i[13], e[14] = i[14], this; + } + setFromMatrix3(t) { + let e = t.elements; + return this.set(e[0], e[3], e[6], 0, e[1], e[4], e[7], 0, e[2], e[5], e[8], 0, 0, 0, 0, 1), this; + } + extractBasis(t, e, i) { + return t.setFromMatrixColumn(this, 0), e.setFromMatrixColumn(this, 1), i.setFromMatrixColumn(this, 2), this; + } + makeBasis(t, e, i) { + return this.set(t.x, e.x, i.x, 0, t.y, e.y, i.y, 0, t.z, e.z, i.z, 0, 0, 0, 0, 1), this; + } + extractRotation(t) { + let e = this.elements, i = t.elements, s = 1 / Ye.setFromMatrixColumn(t, 0).length(), n = 1 / Ye.setFromMatrixColumn(t, 1).length(), r = 1 / Ye.setFromMatrixColumn(t, 2).length(); + return e[0] = i[0] * s, e[1] = i[1] * s, e[2] = i[2] * s, e[3] = 0, e[4] = i[4] * n, e[5] = i[5] * n, e[6] = i[6] * n, e[7] = 0, e[8] = i[8] * r, e[9] = i[9] * r, e[10] = i[10] * r, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this; + } + makeRotationFromEuler(t) { + let e = this.elements, i = t.x, s = t.y, n = t.z, r = Math.cos(i), o = Math.sin(i), a = Math.cos(s), l = Math.sin(s), c = Math.cos(n), u = Math.sin(n); + if (t.order === "XYZ") { + let d = r * c, p = r * u, f = o * c, m = o * u; + e[0] = a * c, e[4] = -a * u, e[8] = l, e[1] = p + f * l, e[5] = d - m * l, e[9] = -o * a, e[2] = m - d * l, e[6] = f + p * l, e[10] = r * a; + } else if (t.order === "YXZ") { + let d = a * c, p = a * u, f = l * c, m = l * u; + e[0] = d + m * o, e[4] = f * o - p, e[8] = r * l, e[1] = r * u, e[5] = r * c, e[9] = -o, e[2] = p * o - f, e[6] = m + d * o, e[10] = r * a; + } else if (t.order === "ZXY") { + let d = a * c, p = a * u, f = l * c, m = l * u; + e[0] = d - m * o, e[4] = -r * u, e[8] = f + p * o, e[1] = p + f * o, e[5] = r * c, e[9] = m - d * o, e[2] = -r * l, e[6] = o, e[10] = r * a; + } else if (t.order === "ZYX") { + let d = r * c, p = r * u, f = o * c, m = o * u; + e[0] = a * c, e[4] = f * l - p, e[8] = d * l + m, e[1] = a * u, e[5] = m * l + d, e[9] = p * l - f, e[2] = -l, e[6] = o * a, e[10] = r * a; + } else if (t.order === "YZX") { + let d = r * a, p = r * l, f = o * a, m = o * l; + e[0] = a * c, e[4] = m - d * u, e[8] = f * u + p, e[1] = u, e[5] = r * c, e[9] = -o * c, e[2] = -l * c, e[6] = p * u + f, e[10] = d - m * u; + } else if (t.order === "XZY") { + let d = r * a, p = r * l, f = o * a, m = o * l; + e[0] = a * c, e[4] = -u, e[8] = l * c, e[1] = d * u + m, e[5] = r * c, e[9] = p * u - f, e[2] = f * u - p, e[6] = o * c, e[10] = m * u + d; + } + return e[3] = 0, e[7] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this; + } + makeRotationFromQuaternion(t) { + return this.compose(yu, t, gu); + } + lookAt(t, e, i) { + let s = this.elements; + return At.subVectors(t, e), At.lengthSq() === 0 && (At.z = 1), At.normalize(), fe.crossVectors(i, At), fe.lengthSq() === 0 && (Math.abs(i.z) === 1 ? At.x += 1e-4 : At.z += 1e-4, At.normalize(), fe.crossVectors(i, At)), fe.normalize(), hs.crossVectors(At, fe), s[0] = fe.x, s[4] = hs.x, s[8] = At.x, s[1] = fe.y, s[5] = hs.y, s[9] = At.y, s[2] = fe.z, s[6] = hs.z, s[10] = At.z, this; + } + multiply(t) { + return this.multiplyMatrices(this, t); + } + premultiply(t) { + return this.multiplyMatrices(t, this); + } + multiplyMatrices(t, e) { + let i = t.elements, s = e.elements, n = this.elements, r = i[0], o = i[4], a = i[8], l = i[12], c = i[1], u = i[5], d = i[9], p = i[13], f = i[2], m = i[6], y1 = i[10], g = i[14], x1 = i[3], b = i[7], M = i[11], _ = i[15], v = s[0], S = s[4], A = s[8], I = s[12], C = s[1], k = s[5], U = s[9], W = s[13], H = s[2], Y = s[6], Q = s[10], zt = s[14], Pt = s[3], j = s[7], st = s[11], K = s[15]; + return n[0] = r * v + o * C + a * H + l * Pt, n[4] = r * S + o * k + a * Y + l * j, n[8] = r * A + o * U + a * Q + l * st, n[12] = r * I + o * W + a * zt + l * K, n[1] = c * v + u * C + d * H + p * Pt, n[5] = c * S + u * k + d * Y + p * j, n[9] = c * A + u * U + d * Q + p * st, n[13] = c * I + u * W + d * zt + p * K, n[2] = f * v + m * C + y1 * H + g * Pt, n[6] = f * S + m * k + y1 * Y + g * j, n[10] = f * A + m * U + y1 * Q + g * st, n[14] = f * I + m * W + y1 * zt + g * K, n[3] = x1 * v + b * C + M * H + _ * Pt, n[7] = x1 * S + b * k + M * Y + _ * j, n[11] = x1 * A + b * U + M * Q + _ * st, n[15] = x1 * I + b * W + M * zt + _ * K, this; + } + multiplyScalar(t) { + let e = this.elements; + return e[0] *= t, e[4] *= t, e[8] *= t, e[12] *= t, e[1] *= t, e[5] *= t, e[9] *= t, e[13] *= t, e[2] *= t, e[6] *= t, e[10] *= t, e[14] *= t, e[3] *= t, e[7] *= t, e[11] *= t, e[15] *= t, this; } determinant() { - let e = this.elements, t = e[0], n = e[4], i = e[8], r = e[12], a = e[1], o = e[5], c = e[9], l = e[13], h = e[2], u = e[6], d = e[10], f = e[14], m = e[3], _ = e[7], g = e[11], p = e[15]; - return m * (+r * c * u - i * l * u - r * o * d + n * l * d + i * o * f - n * c * f) + _ * (+t * c * f - t * l * d + r * a * d - i * a * f + i * l * h - r * c * h) + g * (+t * l * u - t * o * f - r * a * u + n * a * f + r * o * h - n * l * h) + p * (-i * o * h - t * c * u + t * o * d + i * a * u - n * a * d + n * c * h); + let t = this.elements, e = t[0], i = t[4], s = t[8], n = t[12], r = t[1], o = t[5], a = t[9], l = t[13], c = t[2], u = t[6], d = t[10], p = t[14], f = t[3], m = t[7], y1 = t[11], g = t[15]; + return f * (+n * a * u - s * l * u - n * o * d + i * l * d + s * o * p - i * a * p) + m * (+e * a * p - e * l * d + n * r * d - s * r * p + s * l * c - n * a * c) + y1 * (+e * l * u - e * o * p - n * r * u + i * r * p + n * o * c - i * l * c) + g * (-s * o * c - e * a * u + e * o * d + s * r * u - i * r * d + i * a * c); } transpose() { - let e = this.elements, 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; + let t = this.elements, e; + return e = t[1], t[1] = t[4], t[4] = e, e = t[2], t[2] = t[8], t[8] = e, e = t[6], t[6] = t[9], t[9] = e, e = t[3], t[3] = t[12], t[12] = e, e = t[7], t[7] = t[13], t[13] = e, e = t[11], t[11] = t[14], t[14] = e, this; } - setPosition(e, t, n) { - let 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; + setPosition(t, e, i) { + let s = this.elements; + return t.isVector3 ? (s[12] = t.x, s[13] = t.y, s[14] = t.z) : (s[12] = t, s[13] = e, s[14] = i), this; } invert() { - let e = this.elements, t = e[0], n = e[1], i = e[2], r = e[3], a = e[4], o = e[5], c = e[6], l = e[7], h = e[8], u = e[9], d = e[10], f = e[11], m = e[12], _ = e[13], g = e[14], p = e[15], v = u * g * l - _ * d * l + _ * c * f - o * g * f - u * c * p + o * d * p, x1 = m * d * l - h * g * l - m * c * f + a * g * f + h * c * p - a * d * p, y1 = h * _ * l - m * u * l + m * o * f - a * _ * f - h * o * p + a * u * p, b = m * u * c - h * _ * c - m * o * d + a * _ * d + h * o * g - a * u * g, w = t * v + n * x1 + i * y1 + r * b; - if (w === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - let R = 1 / w; - return e[0] = v * R, e[1] = (_ * d * r - u * g * r - _ * i * f + n * g * f + u * i * p - n * d * p) * R, e[2] = (o * g * r - _ * c * r + _ * i * l - n * g * l - o * i * p + n * c * p) * R, e[3] = (u * c * r - o * d * r - u * i * l + n * d * l + o * i * f - n * c * f) * R, e[4] = x1 * R, e[5] = (h * g * r - m * d * r + m * i * f - t * g * f - h * i * p + t * d * p) * R, e[6] = (m * c * r - a * g * r - m * i * l + t * g * l + a * i * p - t * c * p) * R, e[7] = (a * d * r - h * c * r + h * i * l - t * d * l - a * i * f + t * c * f) * R, e[8] = y1 * R, e[9] = (m * u * r - h * _ * r - m * n * f + t * _ * f + h * n * p - t * u * p) * R, e[10] = (a * _ * r - m * o * r + m * n * l - t * _ * l - a * n * p + t * o * p) * R, e[11] = (h * o * r - a * u * r - h * n * l + t * u * l + a * n * f - t * o * f) * R, e[12] = b * R, e[13] = (h * _ * i - m * u * i + m * n * d - t * _ * d - h * n * g + t * u * g) * R, e[14] = (m * o * i - a * _ * i - m * n * c + t * _ * c + a * n * g - t * o * g) * R, e[15] = (a * u * i - h * o * i + h * n * c - t * u * c - a * n * d + t * o * d) * R, this; + let t = this.elements, e = t[0], i = t[1], s = t[2], n = t[3], r = t[4], o = t[5], a = t[6], l = t[7], c = t[8], u = t[9], d = t[10], p = t[11], f = t[12], m = t[13], y1 = t[14], g = t[15], x1 = u * y1 * l - m * d * l + m * a * p - o * y1 * p - u * a * g + o * d * g, b = f * d * l - c * y1 * l - f * a * p + r * y1 * p + c * a * g - r * d * g, M = c * m * l - f * u * l + f * o * p - r * m * p - c * o * g + r * u * g, _ = f * u * a - c * m * a - f * o * d + r * m * d + c * o * y1 - r * u * y1, v = e * x1 + i * b + s * M + n * _; + if (v === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let S = 1 / v; + return t[0] = x1 * S, t[1] = (m * d * n - u * y1 * n - m * s * p + i * y1 * p + u * s * g - i * d * g) * S, t[2] = (o * y1 * n - m * a * n + m * s * l - i * y1 * l - o * s * g + i * a * g) * S, t[3] = (u * a * n - o * d * n - u * s * l + i * d * l + o * s * p - i * a * p) * S, t[4] = b * S, t[5] = (c * y1 * n - f * d * n + f * s * p - e * y1 * p - c * s * g + e * d * g) * S, t[6] = (f * a * n - r * y1 * n - f * s * l + e * y1 * l + r * s * g - e * a * g) * S, t[7] = (r * d * n - c * a * n + c * s * l - e * d * l - r * s * p + e * a * p) * S, t[8] = M * S, t[9] = (f * u * n - c * m * n - f * i * p + e * m * p + c * i * g - e * u * g) * S, t[10] = (r * m * n - f * o * n + f * i * l - e * m * l - r * i * g + e * o * g) * S, t[11] = (c * o * n - r * u * n - c * i * l + e * u * l + r * i * p - e * o * p) * S, t[12] = _ * S, t[13] = (c * m * s - f * u * s + f * i * d - e * m * d - c * i * y1 + e * u * y1) * S, t[14] = (f * o * s - r * m * s - f * i * a + e * m * a + r * i * y1 - e * o * y1) * S, t[15] = (r * u * s - c * o * s + c * i * a - e * u * a - r * i * d + e * o * d) * S, this; } - scale(e) { - let t = this.elements, n = e.x, i = e.y, r = e.z; - return t[0] *= n, t[4] *= i, t[8] *= r, t[1] *= n, t[5] *= i, t[9] *= r, t[2] *= n, t[6] *= i, t[10] *= r, t[3] *= n, t[7] *= i, t[11] *= r, this; + scale(t) { + let e = this.elements, i = t.x, s = t.y, n = t.z; + return e[0] *= i, e[4] *= s, e[8] *= n, e[1] *= i, e[5] *= s, e[9] *= n, e[2] *= i, e[6] *= s, e[10] *= n, e[3] *= i, e[7] *= s, e[11] *= n, this; } getMaxScaleOnAxis() { - let 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)); + let t = this.elements, e = t[0] * t[0] + t[1] * t[1] + t[2] * t[2], i = t[4] * t[4] + t[5] * t[5] + t[6] * t[6], s = t[8] * t[8] + t[9] * t[9] + t[10] * t[10]; + return Math.sqrt(Math.max(e, i, s)); } - makeTranslation(e, t, n) { - return e.isVector3 ? this.set(1, 0, 0, e.x, 0, 1, 0, e.y, 0, 0, 1, e.z, 0, 0, 0, 1) : this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this; + makeTranslation(t, e, i) { + return t.isVector3 ? this.set(1, 0, 0, t.x, 0, 1, 0, t.y, 0, 0, 1, t.z, 0, 0, 0, 1) : this.set(1, 0, 0, t, 0, 1, 0, e, 0, 0, 1, i, 0, 0, 0, 1), this; } - makeRotationX(e) { - let 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; + makeRotationX(t) { + let e = Math.cos(t), i = Math.sin(t); + return this.set(1, 0, 0, 0, 0, e, -i, 0, 0, i, e, 0, 0, 0, 0, 1), this; } - makeRotationY(e) { - let 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; + makeRotationY(t) { + let e = Math.cos(t), i = Math.sin(t); + return this.set(e, 0, i, 0, 0, 1, 0, 0, -i, 0, e, 0, 0, 0, 0, 1), this; } - makeRotationZ(e) { - let 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; + makeRotationZ(t) { + let e = Math.cos(t), i = Math.sin(t); + return this.set(e, -i, 0, 0, i, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this; } - makeRotationAxis(e, t) { - let n = Math.cos(t), i = Math.sin(t), r = 1 - n, a = e.x, o = e.y, c = e.z, l = r * a, h = r * o; - return this.set(l * a + n, l * o - i * c, l * c + i * o, 0, l * o + i * c, h * o + n, h * c - i * a, 0, l * c - i * o, h * c + i * a, r * c * c + n, 0, 0, 0, 0, 1), this; + makeRotationAxis(t, e) { + let i = Math.cos(e), s = Math.sin(e), n = 1 - i, r = t.x, o = t.y, a = t.z, l = n * r, c = n * o; + return this.set(l * r + i, l * o - s * a, l * a + s * o, 0, l * o + s * a, c * o + i, c * a - s * r, 0, l * a - s * o, c * a + s * r, n * a * a + i, 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; + makeScale(t, e, i) { + return this.set(t, 0, 0, 0, 0, e, 0, 0, 0, 0, i, 0, 0, 0, 0, 1), this; } - makeShear(e, t, n, i, r, a) { - return this.set(1, n, r, 0, e, 1, a, 0, t, i, 1, 0, 0, 0, 0, 1), this; + makeShear(t, e, i, s, n, r) { + return this.set(1, i, n, 0, t, 1, r, 0, e, s, 1, 0, 0, 0, 0, 1), this; } - compose(e, t, n) { - let i = this.elements, r = t._x, a = t._y, o = t._z, c = t._w, l = r + r, h = a + a, u = o + o, d = r * l, f = r * h, m = r * u, _ = a * h, g = a * u, p = o * u, v = c * l, x1 = c * h, y1 = c * u, b = n.x, w = n.y, R = n.z; - return i[0] = (1 - (_ + p)) * b, i[1] = (f + y1) * b, i[2] = (m - x1) * b, i[3] = 0, i[4] = (f - y1) * w, i[5] = (1 - (d + p)) * w, i[6] = (g + v) * w, i[7] = 0, i[8] = (m + x1) * R, i[9] = (g - v) * R, i[10] = (1 - (d + _)) * R, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, this; + compose(t, e, i) { + let s = this.elements, n = e._x, r = e._y, o = e._z, a = e._w, l = n + n, c = r + r, u = o + o, d = n * l, p = n * c, f = n * u, m = r * c, y1 = r * u, g = o * u, x1 = a * l, b = a * c, M = a * u, _ = i.x, v = i.y, S = i.z; + return s[0] = (1 - (m + g)) * _, s[1] = (p + M) * _, s[2] = (f - b) * _, s[3] = 0, s[4] = (p - M) * v, s[5] = (1 - (d + g)) * v, s[6] = (y1 + x1) * v, s[7] = 0, s[8] = (f + b) * S, s[9] = (y1 - x1) * S, s[10] = (1 - (d + m)) * S, s[11] = 0, s[12] = t.x, s[13] = t.y, s[14] = t.z, s[15] = 1, this; } - decompose(e, t, n) { - let i = this.elements, r = Mi.set(i[0], i[1], i[2]).length(), a = Mi.set(i[4], i[5], i[6]).length(), o = Mi.set(i[8], i[9], i[10]).length(); - this.determinant() < 0 && (r = -r), e.x = i[12], e.y = i[13], e.z = i[14], $t.copy(this); - let l = 1 / r, h = 1 / a, u = 1 / o; - return $t.elements[0] *= l, $t.elements[1] *= l, $t.elements[2] *= l, $t.elements[4] *= h, $t.elements[5] *= h, $t.elements[6] *= h, $t.elements[8] *= u, $t.elements[9] *= u, $t.elements[10] *= u, t.setFromRotationMatrix($t), n.x = r, n.y = a, n.z = o, this; + decompose(t, e, i) { + let s = this.elements, n = Ye.set(s[0], s[1], s[2]).length(), r = Ye.set(s[4], s[5], s[6]).length(), o = Ye.set(s[8], s[9], s[10]).length(); + this.determinant() < 0 && (n = -n), t.x = s[12], t.y = s[13], t.z = s[14], Vt.copy(this); + let l = 1 / n, c = 1 / r, u = 1 / o; + return Vt.elements[0] *= l, Vt.elements[1] *= l, Vt.elements[2] *= l, Vt.elements[4] *= c, Vt.elements[5] *= c, Vt.elements[6] *= c, Vt.elements[8] *= u, Vt.elements[9] *= u, Vt.elements[10] *= u, e.setFromRotationMatrix(Vt), i.x = n, i.y = r, i.z = o, this; } - makePerspective(e, t, n, i, r, a, o = vn) { - let c = this.elements, l = 2 * r / (t - e), h = 2 * r / (n - i), u = (t + e) / (t - e), d = (n + i) / (n - i), f, m; - if (o === vn) f = -(a + r) / (a - r), m = -2 * a * r / (a - r); - else if (o === Gr) f = -a / (a - r), m = -a * r / (a - r); + makePerspective(t, e, i, s, n, r, o = oe) { + let a = this.elements, l = 2 * n / (e - t), c = 2 * n / (i - s), u = (e + t) / (e - t), d = (i + s) / (i - s), p, f; + if (o === oe) p = -(r + n) / (r - n), f = -2 * r * n / (r - n); + else if (o === Zs) p = -r / (r - n), f = -r * n / (r - n); else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + o); - return c[0] = l, c[4] = 0, c[8] = u, c[12] = 0, c[1] = 0, c[5] = h, c[9] = d, c[13] = 0, c[2] = 0, c[6] = 0, c[10] = f, c[14] = m, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this; + return a[0] = l, a[4] = 0, a[8] = u, a[12] = 0, a[1] = 0, a[5] = c, a[9] = d, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = p, a[14] = f, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this; } - makeOrthographic(e, t, n, i, r, a, o = vn) { - let c = this.elements, l = 1 / (t - e), h = 1 / (n - i), u = 1 / (a - r), d = (t + e) * l, f = (n + i) * h, m, _; - if (o === vn) m = (a + r) * u, _ = -2 * u; - else if (o === Gr) m = r * u, _ = -1 * u; + makeOrthographic(t, e, i, s, n, r, o = oe) { + let a = this.elements, l = 1 / (e - t), c = 1 / (i - s), u = 1 / (r - n), d = (e + t) * l, p = (i + s) * c, f, m; + if (o === oe) f = (r + n) * u, m = -2 * u; + else if (o === Zs) f = n * u, m = -1 * u; else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + o); - return c[0] = 2 * l, c[4] = 0, c[8] = 0, c[12] = -d, c[1] = 0, c[5] = 2 * h, c[9] = 0, c[13] = -f, c[2] = 0, c[6] = 0, c[10] = _, c[14] = -m, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this; + return a[0] = 2 * l, a[4] = 0, a[8] = 0, a[12] = -d, a[1] = 0, a[5] = 2 * c, a[9] = 0, a[13] = -p, a[2] = 0, a[6] = 0, a[10] = m, a[14] = -f, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this; } - equals(e) { - let t = this.elements, n = e.elements; - for(let i = 0; i < 16; i++)if (t[i] !== n[i]) return !1; + equals(t) { + let e = this.elements, i = t.elements; + for(let s = 0; s < 16; s++)if (e[s] !== i[s]) return !1; return !0; } - fromArray(e, t = 0) { - for(let n = 0; n < 16; n++)this.elements[n] = e[n + t]; + fromArray(t, e = 0) { + for(let i = 0; i < 16; i++)this.elements[i] = t[i + e]; return this; } - toArray(e = [], t = 0) { - let 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; + toArray(t = [], e = 0) { + let i = this.elements; + return t[e] = i[0], t[e + 1] = i[1], t[e + 2] = i[2], t[e + 3] = i[3], t[e + 4] = i[4], t[e + 5] = i[5], t[e + 6] = i[6], t[e + 7] = i[7], t[e + 8] = i[8], t[e + 9] = i[9], t[e + 10] = i[10], t[e + 11] = i[11], t[e + 12] = i[12], t[e + 13] = i[13], t[e + 14] = i[14], t[e + 15] = i[15], t; } -}, Mi = new A, $t = new ze, ap = new A(0, 0, 0), op = new A(1, 1, 1), Rn = new A, Zs = new A, zt = new A, Xl = new ze, ql = new Ut, Yr = class s1 { - constructor(e = 0, t = 0, n = 0, i = s1.DEFAULT_ORDER){ - this.isEuler = !0, this._x = e, this._y = t, this._z = n, this._order = i; +}, Ye = new w, Vt = new D, yu = new w(0, 0, 0), gu = new w(1, 1, 1), fe = new w, hs = new w, At = new w, xa = new D, ba = new bt, Xt = class h { + constructor(t = 0, e = 0, i = 0, s = h.DEFAULT_ORDER){ + this.isEuler = !0, this._x = t, this._y = e, this._z = i, this._order = s; } get x() { return this._x; } - set x(e) { - this._x = e, this._onChangeCallback(); + set x(t) { + this._x = t, this._onChangeCallback(); } get y() { return this._y; } - set y(e) { - this._y = e, this._onChangeCallback(); + set y(t) { + this._y = t, this._onChangeCallback(); } get z() { return this._z; } - set z(e) { - this._z = e, this._onChangeCallback(); + set z(t) { + this._z = t, this._onChangeCallback(); } get order() { return this._order; } - set order(e) { - this._order = e, this._onChangeCallback(); + set order(t) { + this._order = t, 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; + set(t, e, i, s = this._order) { + return this._x = t, this._y = e, this._z = i, this._order = s, 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; + copy(t) { + return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this._onChangeCallback(), this; } - setFromRotationMatrix(e, t = this._order, n = !0) { - let i = e.elements, r = i[0], a = i[4], o = i[8], c = i[1], l = i[5], h = i[9], u = i[2], d = i[6], f = i[10]; - switch(t){ + setFromRotationMatrix(t, e = this._order, i = !0) { + let s = t.elements, n = s[0], r = s[4], o = s[8], a = s[1], l = s[5], c = s[9], u = s[2], d = s[6], p = s[10]; + switch(e){ case "XYZ": - this._y = Math.asin(ct(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-h, f), this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(d, l), this._z = 0); + this._y = Math.asin(N(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-c, p), this._z = Math.atan2(-r, n)) : (this._x = Math.atan2(d, l), this._z = 0); break; case "YXZ": - this._x = Math.asin(-ct(h, -1, 1)), Math.abs(h) < .9999999 ? (this._y = Math.atan2(o, f), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-u, r), this._z = 0); + this._x = Math.asin(-N(c, -1, 1)), Math.abs(c) < .9999999 ? (this._y = Math.atan2(o, p), this._z = Math.atan2(a, l)) : (this._y = Math.atan2(-u, n), this._z = 0); break; case "ZXY": - this._x = Math.asin(ct(d, -1, 1)), Math.abs(d) < .9999999 ? (this._y = Math.atan2(-u, f), this._z = Math.atan2(-a, l)) : (this._y = 0, this._z = Math.atan2(c, r)); + this._x = Math.asin(N(d, -1, 1)), Math.abs(d) < .9999999 ? (this._y = Math.atan2(-u, p), this._z = Math.atan2(-r, l)) : (this._y = 0, this._z = Math.atan2(a, n)); break; case "ZYX": - this._y = Math.asin(-ct(u, -1, 1)), Math.abs(u) < .9999999 ? (this._x = Math.atan2(d, f), this._z = Math.atan2(c, r)) : (this._x = 0, this._z = Math.atan2(-a, l)); + this._y = Math.asin(-N(u, -1, 1)), Math.abs(u) < .9999999 ? (this._x = Math.atan2(d, p), this._z = Math.atan2(a, n)) : (this._x = 0, this._z = Math.atan2(-r, l)); break; case "YZX": - this._z = Math.asin(ct(c, -1, 1)), Math.abs(c) < .9999999 ? (this._x = Math.atan2(-h, l), this._y = Math.atan2(-u, r)) : (this._x = 0, this._y = Math.atan2(o, f)); + this._z = Math.asin(N(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(-c, l), this._y = Math.atan2(-u, n)) : (this._x = 0, this._y = Math.atan2(o, p)); break; case "XZY": - this._z = Math.asin(-ct(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(d, l), this._y = Math.atan2(o, r)) : (this._x = Math.atan2(-h, f), this._y = 0); + this._z = Math.asin(-N(r, -1, 1)), Math.abs(r) < .9999999 ? (this._x = Math.atan2(d, l), this._y = Math.atan2(o, n)) : (this._x = Math.atan2(-c, p), this._y = 0); break; default: - console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t); + console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + e); } - return this._order = t, n === !0 && this._onChangeCallback(), this; + return this._order = e, i === !0 && this._onChangeCallback(), this; } - setFromQuaternion(e, t, n) { - return Xl.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Xl, t, n); + setFromQuaternion(t, e, i) { + return xa.makeRotationFromQuaternion(t), this.setFromRotationMatrix(xa, e, i); } - setFromVector3(e, t = this._order) { - return this.set(e.x, e.y, e.z, t); + setFromVector3(t, e = this._order) { + return this.set(t.x, t.y, t.z, e); } - reorder(e) { - return ql.setFromEuler(this), this.setFromQuaternion(ql, e); + reorder(t) { + return ba.setFromEuler(this), this.setFromQuaternion(ba, t); } - equals(e) { - return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order; + equals(t) { + return t._x === this._x && t._y === this._y && t._z === this._z && t._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; + fromArray(t) { + return this._x = t[0], this._y = t[1], this._z = t[2], t[3] !== void 0 && (this._order = 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._order, e; + toArray(t = [], e = 0) { + return t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._order, t; } - _onChange(e) { - return this._onChangeCallback = e, this; + _onChange(t) { + return this._onChangeCallback = t, this; } _onChangeCallback() {} *[Symbol.iterator]() { yield this._x, yield this._y, yield this._z, yield this._order; } }; -Yr.DEFAULT_ORDER = "XYZ"; -var Rs = class { +Xt.DEFAULT_ORDER = "XYZ"; +var js = class { constructor(){ this.mask = 1; } - set(e) { - this.mask = (1 << e | 0) >>> 0; + set(t) { + this.mask = (1 << t | 0) >>> 0; } - enable(e) { - this.mask |= 1 << e | 0; + enable(t) { + this.mask |= 1 << t | 0; } enableAll() { this.mask = -1; } - toggle(e) { - this.mask ^= 1 << e | 0; + toggle(t) { + this.mask ^= 1 << t | 0; } - disable(e) { - this.mask &= ~(1 << e | 0); + disable(t) { + this.mask &= ~(1 << t | 0); } disableAll() { this.mask = 0; } - test(e) { - return (this.mask & e.mask) !== 0; + test(t) { + return (this.mask & t.mask) !== 0; } - isEnabled(e) { - return (this.mask & (1 << e | 0)) !== 0; + isEnabled(t) { + return (this.mask & (1 << t | 0)) !== 0; } -}, cp = 0, Yl = new A, Si = new Ut, hn = new ze, Js = new A, hs = new A, lp = new A, hp = new Ut, Zl = new A(1, 0, 0), Jl = new A(0, 1, 0), $l = new A(0, 0, 1), up = { +}, xu = 0, wa = new w, $e = new bt, te = new D, ls = new w, Ti = new w, bu = new w, wu = new bt, Ma = new w(1, 0, 0), _a = new w(0, 1, 0), va = new w(0, 0, 1), Aa = { type: "added" -}, dp = { +}, Mu = { type: "removed" -}, Je = class s1 extends sn { +}, Qe = { + type: "childadded", + child: null +}, Dn = { + type: "childremoved", + child: null +}, G = class h extends qt { constructor(){ super(), this.isObject3D = !0, Object.defineProperty(this, "id", { - value: cp++ - }), this.uuid = kt(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = s1.DEFAULT_UP.clone(); - let e = new A, t = new Yr, n = new Ut, i = new A(1, 1, 1); - function r() { - n.setFromEuler(t, !1); + value: xu++ + }), this.uuid = It(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = h.DEFAULT_UP.clone(); + let t = new w, e = new Xt, i = new bt, s = new w(1, 1, 1); + function n() { + i.setFromEuler(e, !1); } - function a() { - t.setFromQuaternion(n, void 0, !1); + function r() { + e.setFromQuaternion(i, void 0, !1); } - t._onChange(r), n._onChange(a), Object.defineProperties(this, { + e._onChange(n), i._onChange(r), Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, - value: e + value: t }, rotation: { configurable: !0, enumerable: !0, - value: t + value: e }, quaternion: { configurable: !0, enumerable: !0, - value: n + value: i }, scale: { configurable: !0, enumerable: !0, - value: i + value: s }, modelViewMatrix: { - value: new ze + value: new D }, normalMatrix: { - value: new He + value: new Gt } - }), this.matrix = new ze, this.matrixWorld = new ze, this.matrixAutoUpdate = s1.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.matrixWorldAutoUpdate = s1.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.layers = new Rs, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {}; + }), this.matrix = new D, this.matrixWorld = new D, this.matrixAutoUpdate = h.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = h.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new js, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {}; } + onBeforeShadow() {} + onAfterShadow() {} onBeforeRender() {} onAfterRender() {} - applyMatrix4(e) { - this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale); + applyMatrix4(t) { + this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(t), this.matrix.decompose(this.position, this.quaternion, this.scale); } - applyQuaternion(e) { - return this.quaternion.premultiply(e), this; + applyQuaternion(t) { + return this.quaternion.premultiply(t), this; } - setRotationFromAxisAngle(e, t) { - this.quaternion.setFromAxisAngle(e, t); + setRotationFromAxisAngle(t, e) { + this.quaternion.setFromAxisAngle(t, e); } - setRotationFromEuler(e) { - this.quaternion.setFromEuler(e, !0); + setRotationFromEuler(t) { + this.quaternion.setFromEuler(t, !0); } - setRotationFromMatrix(e) { - this.quaternion.setFromRotationMatrix(e); + setRotationFromMatrix(t) { + this.quaternion.setFromRotationMatrix(t); } - setRotationFromQuaternion(e) { - this.quaternion.copy(e); + setRotationFromQuaternion(t) { + this.quaternion.copy(t); } - rotateOnAxis(e, t) { - return Si.setFromAxisAngle(e, t), this.quaternion.multiply(Si), this; + rotateOnAxis(t, e) { + return $e.setFromAxisAngle(t, e), this.quaternion.multiply($e), this; } - rotateOnWorldAxis(e, t) { - return Si.setFromAxisAngle(e, t), this.quaternion.premultiply(Si), this; + rotateOnWorldAxis(t, e) { + return $e.setFromAxisAngle(t, e), this.quaternion.premultiply($e), this; } - rotateX(e) { - return this.rotateOnAxis(Zl, e); + rotateX(t) { + return this.rotateOnAxis(Ma, t); } - rotateY(e) { - return this.rotateOnAxis(Jl, e); + rotateY(t) { + return this.rotateOnAxis(_a, t); } - rotateZ(e) { - return this.rotateOnAxis($l, e); + rotateZ(t) { + return this.rotateOnAxis(va, t); } - translateOnAxis(e, t) { - return Yl.copy(e).applyQuaternion(this.quaternion), this.position.add(Yl.multiplyScalar(t)), this; + translateOnAxis(t, e) { + return wa.copy(t).applyQuaternion(this.quaternion), this.position.add(wa.multiplyScalar(e)), this; } - translateX(e) { - return this.translateOnAxis(Zl, e); + translateX(t) { + return this.translateOnAxis(Ma, t); } - translateY(e) { - return this.translateOnAxis(Jl, e); + translateY(t) { + return this.translateOnAxis(_a, t); } - translateZ(e) { - return this.translateOnAxis($l, e); + translateZ(t) { + return this.translateOnAxis(va, t); } - localToWorld(e) { - return this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld); + localToWorld(t) { + return this.updateWorldMatrix(!0, !1), t.applyMatrix4(this.matrixWorld); } - worldToLocal(e) { - return this.updateWorldMatrix(!0, !1), e.applyMatrix4(hn.copy(this.matrixWorld).invert()); + worldToLocal(t) { + return this.updateWorldMatrix(!0, !1), t.applyMatrix4(te.copy(this.matrixWorld).invert()); } - lookAt(e, t, n) { - e.isVector3 ? Js.copy(e) : Js.set(e, t, n); - let i = this.parent; - this.updateWorldMatrix(!0, !1), hs.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? hn.lookAt(hs, Js, this.up) : hn.lookAt(Js, hs, this.up), this.quaternion.setFromRotationMatrix(hn), i && (hn.extractRotation(i.matrixWorld), Si.setFromRotationMatrix(hn), this.quaternion.premultiply(Si.invert())); + lookAt(t, e, i) { + t.isVector3 ? ls.copy(t) : ls.set(t, e, i); + let s = this.parent; + this.updateWorldMatrix(!0, !1), Ti.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? te.lookAt(Ti, ls, this.up) : te.lookAt(ls, Ti, this.up), this.quaternion.setFromRotationMatrix(te), s && (te.extractRotation(s.matrixWorld), $e.setFromRotationMatrix(te), this.quaternion.premultiply($e.invert())); } - add(e) { + add(t) { if (arguments.length > 1) { - for(let t = 0; t < arguments.length; t++)this.add(arguments[t]); + for(let e = 0; e < arguments.length; e++)this.add(arguments[e]); 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(up)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this); + return t === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", t), this) : (t && t.isObject3D ? (t.removeFromParent(), t.parent = this, this.children.push(t), t.dispatchEvent(Aa), Qe.child = t, this.dispatchEvent(Qe), Qe.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", t), this); } - remove(e) { + remove(t) { if (arguments.length > 1) { - for(let n = 0; n < arguments.length; n++)this.remove(arguments[n]); + for(let i = 0; i < arguments.length; i++)this.remove(arguments[i]); return this; } - let t = this.children.indexOf(e); - return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(dp)), this; + let e = this.children.indexOf(t); + return e !== -1 && (t.parent = null, this.children.splice(e, 1), t.dispatchEvent(Mu), Dn.child = t, this.dispatchEvent(Dn), Dn.child = null), this; } removeFromParent() { - let e = this.parent; - return e !== null && e.remove(this), this; + let t = this.parent; + return t !== null && t.remove(this), this; } clear() { return this.remove(...this.children); } - attach(e) { - return this.updateWorldMatrix(!0, !1), hn.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), hn.multiply(e.parent.matrixWorld)), e.applyMatrix4(hn), this.add(e), e.updateWorldMatrix(!1, !0), this; + attach(t) { + return this.updateWorldMatrix(!0, !1), te.copy(this.matrixWorld).invert(), t.parent !== null && (t.parent.updateWorldMatrix(!0, !1), te.multiply(t.parent.matrixWorld)), t.applyMatrix4(te), t.removeFromParent(), t.parent = this, this.children.push(t), t.updateWorldMatrix(!1, !0), t.dispatchEvent(Aa), Qe.child = t, this.dispatchEvent(Qe), Qe.child = null, this; } - getObjectById(e) { - return this.getObjectByProperty("id", e); + getObjectById(t) { + return this.getObjectByProperty("id", t); } - getObjectByName(e) { - return this.getObjectByProperty("name", e); + getObjectByName(t) { + return this.getObjectByProperty("name", t); } - getObjectByProperty(e, t) { - if (this[e] === t) return this; - for(let n = 0, i = this.children.length; n < i; n++){ - let a = this.children[n].getObjectByProperty(e, t); - if (a !== void 0) return a; + getObjectByProperty(t, e) { + if (this[t] === e) return this; + for(let i = 0, s = this.children.length; i < s; i++){ + let r = this.children[i].getObjectByProperty(t, e); + if (r !== void 0) return r; } } - getObjectsByProperty(e, t) { - let n = []; - this[e] === t && n.push(this); - for(let i = 0, r = this.children.length; i < r; i++){ - let a = this.children[i].getObjectsByProperty(e, t); - a.length > 0 && (n = n.concat(a)); - } - return n; + getObjectsByProperty(t, e, i = []) { + this[t] === e && i.push(this); + let s = this.children; + for(let n = 0, r = s.length; n < r; n++)s[n].getObjectsByProperty(t, e, i); + return i; } - getWorldPosition(e) { - return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld); + getWorldPosition(t) { + return this.updateWorldMatrix(!0, !1), t.setFromMatrixPosition(this.matrixWorld); } - getWorldQuaternion(e) { - return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(hs, e, lp), e; + getWorldQuaternion(t) { + return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Ti, t, bu), t; } - getWorldScale(e) { - return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(hs, hp, e), e; + getWorldScale(t) { + return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Ti, wu, t), t; } - getWorldDirection(e) { + getWorldDirection(t) { this.updateWorldMatrix(!0, !1); - let t = this.matrixWorld.elements; - return e.set(t[8], t[9], t[10]).normalize(); + let e = this.matrixWorld.elements; + return t.set(e[8], e[9], e[10]).normalize(); } raycast() {} - traverse(e) { - e(this); - let t = this.children; - for(let n = 0, i = t.length; n < i; n++)t[n].traverse(e); + traverse(t) { + t(this); + let e = this.children; + for(let i = 0, s = e.length; i < s; i++)e[i].traverse(t); } - traverseVisible(e) { + traverseVisible(t) { if (this.visible === !1) return; - e(this); - let t = this.children; - for(let n = 0, i = t.length; n < i; n++)t[n].traverseVisible(e); + t(this); + let e = this.children; + for(let i = 0, s = e.length; i < s; i++)e[i].traverseVisible(t); } - traverseAncestors(e) { - let t = this.parent; - t !== null && (e(t), t.traverseAncestors(e)); + traverseAncestors(t) { + let e = this.parent; + e !== null && (t(e), e.traverseAncestors(t)); } updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0; } - updateMatrixWorld(e) { - this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, e = !0); - let t = this.children; - for(let n = 0, i = t.length; n < i; n++){ - let r = t[n]; - (r.matrixWorldAutoUpdate === !0 || e === !0) && r.updateMatrixWorld(e); - } + updateMatrixWorld(t) { + this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || t) && (this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, t = !0); + let e = this.children; + for(let i = 0, s = e.length; i < s; i++)e[i].updateMatrixWorld(t); } - updateWorldMatrix(e, t) { - let 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) { - let i = this.children; - for(let r = 0, a = i.length; r < a; r++){ - let o = i[r]; - o.matrixWorldAutoUpdate === !0 && o.updateWorldMatrix(!1, !0); - } + updateWorldMatrix(t, e) { + let i = this.parent; + if (t === !0 && i !== null && i.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), e === !0) { + let s = this.children; + for(let n = 0, r = s.length; n < r; n++)s[n].updateWorldMatrix(!1, !0); } } - toJSON(e) { - let t = e === void 0 || typeof e == "string", n = {}; - t && (e = { + toJSON(t) { + let e = t === void 0 || typeof t == "string", i = {}; + e && (t = { geometries: {}, materials: {}, textures: {}, @@ -2631,252 +2692,180 @@ var Rs = class { skeletons: {}, animations: {}, nodes: {} - }, n.metadata = { + }, i.metadata = { version: 4.6, type: "Object", generator: "Object3D.toJSON" }); - let 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 r(o, c) { - return o[c.uuid] === void 0 && (o[c.uuid] = c.toJSON(e)), c.uuid; + let s = {}; + s.uuid = this.uuid, s.type = this.type, this.name !== "" && (s.name = this.name), this.castShadow === !0 && (s.castShadow = !0), this.receiveShadow === !0 && (s.receiveShadow = !0), this.visible === !1 && (s.visible = !1), this.frustumCulled === !1 && (s.frustumCulled = !1), this.renderOrder !== 0 && (s.renderOrder = this.renderOrder), Object.keys(this.userData).length > 0 && (s.userData = this.userData), s.layers = this.layers.mask, s.matrix = this.matrix.toArray(), s.up = this.up.toArray(), this.matrixAutoUpdate === !1 && (s.matrixAutoUpdate = !1), this.isInstancedMesh && (s.type = "InstancedMesh", s.count = this.count, s.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (s.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (s.type = "BatchedMesh", s.perObjectFrustumCulled = this.perObjectFrustumCulled, s.sortObjects = this.sortObjects, s.drawRanges = this._drawRanges, s.reservedRanges = this._reservedRanges, s.visibility = this._visibility, s.active = this._active, s.bounds = this._bounds.map((o)=>({ + boxInitialized: o.boxInitialized, + boxMin: o.box.min.toArray(), + boxMax: o.box.max.toArray(), + sphereInitialized: o.sphereInitialized, + sphereRadius: o.sphere.radius, + sphereCenter: o.sphere.center.toArray() + })), s.maxInstanceCount = this._maxInstanceCount, s.maxVertexCount = this._maxVertexCount, s.maxIndexCount = this._maxIndexCount, s.geometryInitialized = this._geometryInitialized, s.geometryCount = this._geometryCount, s.matricesTexture = this._matricesTexture.toJSON(t), this._colorsTexture !== null && (s.colorsTexture = this._colorsTexture.toJSON(t)), this.boundingSphere !== null && (s.boundingSphere = { + center: s.boundingSphere.center.toArray(), + radius: s.boundingSphere.radius + }), this.boundingBox !== null && (s.boundingBox = { + min: s.boundingBox.min.toArray(), + max: s.boundingBox.max.toArray() + })); + function n(o, a) { + return o[a.uuid] === void 0 && (o[a.uuid] = a.toJSON(t)), a.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); + if (this.isScene) this.background && (this.background.isColor ? s.background = this.background.toJSON() : this.background.isTexture && (s.background = this.background.toJSON(t).uuid)), this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== !0 && (s.environment = this.environment.toJSON(t).uuid); else if (this.isMesh || this.isLine || this.isPoints) { - i.geometry = r(e.geometries, this.geometry); + s.geometry = n(t.geometries, this.geometry); let o = this.geometry.parameters; if (o !== void 0 && o.shapes !== void 0) { - let c = o.shapes; - if (Array.isArray(c)) for(let l = 0, h = c.length; l < h; l++){ - let u = c[l]; - r(e.shapes, u); + let a = o.shapes; + if (Array.isArray(a)) for(let l = 0, c = a.length; l < c; l++){ + let u = a[l]; + n(t.shapes, u); } - else r(e.shapes, c); + else n(t.shapes, a); } } - if (this.isSkinnedMesh && (i.bindMode = this.bindMode, i.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (r(e.skeletons, this.skeleton), i.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) { + if (this.isSkinnedMesh && (s.bindMode = this.bindMode, s.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (n(t.skeletons, this.skeleton), s.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) { let o = []; - for(let c = 0, l = this.material.length; c < l; c++)o.push(r(e.materials, this.material[c])); - i.material = o; - } else i.material = r(e.materials, this.material); + for(let a = 0, l = this.material.length; a < l; a++)o.push(n(t.materials, this.material[a])); + s.material = o; + } else s.material = n(t.materials, this.material); if (this.children.length > 0) { - i.children = []; - for(let o = 0; o < this.children.length; o++)i.children.push(this.children[o].toJSON(e).object); + s.children = []; + for(let o = 0; o < this.children.length; o++)s.children.push(this.children[o].toJSON(t).object); } if (this.animations.length > 0) { - i.animations = []; + s.animations = []; for(let o = 0; o < this.animations.length; o++){ - let c = this.animations[o]; - i.animations.push(r(e.animations, c)); + let a = this.animations[o]; + s.animations.push(n(t.animations, a)); } } - if (t) { - let o = a(e.geometries), c = a(e.materials), l = a(e.textures), h = a(e.images), u = a(e.shapes), d = a(e.skeletons), f = a(e.animations), m = a(e.nodes); - o.length > 0 && (n.geometries = o), c.length > 0 && (n.materials = c), l.length > 0 && (n.textures = l), h.length > 0 && (n.images = h), u.length > 0 && (n.shapes = u), d.length > 0 && (n.skeletons = d), f.length > 0 && (n.animations = f), m.length > 0 && (n.nodes = m); + if (e) { + let o = r(t.geometries), a = r(t.materials), l = r(t.textures), c = r(t.images), u = r(t.shapes), d = r(t.skeletons), p = r(t.animations), f = r(t.nodes); + o.length > 0 && (i.geometries = o), a.length > 0 && (i.materials = a), l.length > 0 && (i.textures = l), c.length > 0 && (i.images = c), u.length > 0 && (i.shapes = u), d.length > 0 && (i.skeletons = d), p.length > 0 && (i.animations = p), f.length > 0 && (i.nodes = f); } - return n.object = i, n; - function a(o) { - let c = []; + return i.object = s, i; + function r(o) { + let a = []; for(let l in o){ - let h = o[l]; - delete h.metadata, c.push(h); + let c = o[l]; + delete c.metadata, a.push(c); } - return c; + return a; } } - clone(e) { - return new this.constructor().copy(this, e); + clone(t) { + return new this.constructor().copy(this, t); } - copy(e, t = !0) { - if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.matrixWorldAutoUpdate = e.matrixWorldAutoUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.animations = e.animations.slice(), this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0) for(let n = 0; n < e.children.length; n++){ - let i = e.children[n]; - this.add(i.clone()); + copy(t, e = !0) { + if (this.name = t.name, this.up.copy(t.up), this.position.copy(t.position), this.rotation.order = t.rotation.order, this.quaternion.copy(t.quaternion), this.scale.copy(t.scale), this.matrix.copy(t.matrix), this.matrixWorld.copy(t.matrixWorld), this.matrixAutoUpdate = t.matrixAutoUpdate, this.matrixWorldAutoUpdate = t.matrixWorldAutoUpdate, this.matrixWorldNeedsUpdate = t.matrixWorldNeedsUpdate, this.layers.mask = t.layers.mask, this.visible = t.visible, this.castShadow = t.castShadow, this.receiveShadow = t.receiveShadow, this.frustumCulled = t.frustumCulled, this.renderOrder = t.renderOrder, this.animations = t.animations.slice(), this.userData = JSON.parse(JSON.stringify(t.userData)), e === !0) for(let i = 0; i < t.children.length; i++){ + let s = t.children[i]; + this.add(s.clone()); } return this; } }; -Je.DEFAULT_UP = new A(0, 1, 0); -Je.DEFAULT_MATRIX_AUTO_UPDATE = !0; -Je.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0; -var Kt = new A, un = new A, Ha = new A, dn = new A, bi = new A, Ei = new A, Kl = new A, Ga = new A, Wa = new A, Xa = new A, $s = !1, Un = class s1 { - constructor(e = new A, t = new A, n = new A){ - this.a = e, this.b = t, this.c = n; +G.DEFAULT_UP = new w(0, 1, 0); +G.DEFAULT_MATRIX_AUTO_UPDATE = !0; +G.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0; +var Dt = new w, ee = new w, Ln = new w, ie = new w, je = new w, Ke = new w, Sa = new w, Un = new w, Wn = new w, Hn = new w, qn = new ot, Gn = new ot, Xn = new ot, ne = class h { + constructor(t = new w, e = new w, i = new w){ + this.a = t, this.b = e, this.c = i; } - static getNormal(e, t, n, i) { - i.subVectors(n, t), Kt.subVectors(e, t), i.cross(Kt); - let r = i.lengthSq(); - return r > 0 ? i.multiplyScalar(1 / Math.sqrt(r)) : i.set(0, 0, 0); + static getNormal(t, e, i, s) { + s.subVectors(i, e), Dt.subVectors(t, e), s.cross(Dt); + let n = s.lengthSq(); + return n > 0 ? s.multiplyScalar(1 / Math.sqrt(n)) : s.set(0, 0, 0); } - static getBarycoord(e, t, n, i, r) { - Kt.subVectors(i, t), un.subVectors(n, t), Ha.subVectors(e, t); - let a = Kt.dot(Kt), o = Kt.dot(un), c = Kt.dot(Ha), l = un.dot(un), h = un.dot(Ha), u = a * l - o * o; - if (u === 0) return r.set(-2, -1, -1); - let d = 1 / u, f = (l * c - o * h) * d, m = (a * h - o * c) * d; - return r.set(1 - f - m, m, f); + static getBarycoord(t, e, i, s, n) { + Dt.subVectors(s, e), ee.subVectors(i, e), Ln.subVectors(t, e); + let r = Dt.dot(Dt), o = Dt.dot(ee), a = Dt.dot(Ln), l = ee.dot(ee), c = ee.dot(Ln), u = r * l - o * o; + if (u === 0) return n.set(0, 0, 0), null; + let d = 1 / u, p = (l * a - o * c) * d, f = (r * c - o * a) * d; + return n.set(1 - p - f, f, p); } - static containsPoint(e, t, n, i) { - return this.getBarycoord(e, t, n, i, dn), dn.x >= 0 && dn.y >= 0 && dn.x + dn.y <= 1; + static containsPoint(t, e, i, s) { + return this.getBarycoord(t, e, i, s, ie) === null ? !1 : ie.x >= 0 && ie.y >= 0 && ie.x + ie.y <= 1; } - static getUV(e, t, n, i, r, a, o, c) { - return $s === !1 && (console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."), $s = !0), this.getInterpolation(e, t, n, i, r, a, o, c); + static getInterpolation(t, e, i, s, n, r, o, a) { + return this.getBarycoord(t, e, i, s, ie) === null ? (a.x = 0, a.y = 0, "z" in a && (a.z = 0), "w" in a && (a.w = 0), null) : (a.setScalar(0), a.addScaledVector(n, ie.x), a.addScaledVector(r, ie.y), a.addScaledVector(o, ie.z), a); } - static getInterpolation(e, t, n, i, r, a, o, c) { - return this.getBarycoord(e, t, n, i, dn), c.setScalar(0), c.addScaledVector(r, dn.x), c.addScaledVector(a, dn.y), c.addScaledVector(o, dn.z), c; + static getInterpolatedAttribute(t, e, i, s, n, r) { + return qn.setScalar(0), Gn.setScalar(0), Xn.setScalar(0), qn.fromBufferAttribute(t, e), Gn.fromBufferAttribute(t, i), Xn.fromBufferAttribute(t, s), r.setScalar(0), r.addScaledVector(qn, n.x), r.addScaledVector(Gn, n.y), r.addScaledVector(Xn, n.z), r; } - static isFrontFacing(e, t, n, i) { - return Kt.subVectors(n, t), un.subVectors(e, t), Kt.cross(un).dot(i) < 0; + static isFrontFacing(t, e, i, s) { + return Dt.subVectors(i, e), ee.subVectors(t, e), Dt.cross(ee).dot(s) < 0; } - set(e, t, n) { - return this.a.copy(e), this.b.copy(t), this.c.copy(n), this; + set(t, e, i) { + return this.a.copy(t), this.b.copy(e), this.c.copy(i), this; } - setFromPointsAndIndices(e, t, n, i) { - return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[i]), this; + setFromPointsAndIndices(t, e, i, s) { + return this.a.copy(t[e]), this.b.copy(t[i]), this.c.copy(t[s]), this; } - setFromAttributeAndIndices(e, t, n, i) { - return this.a.fromBufferAttribute(e, t), this.b.fromBufferAttribute(e, n), this.c.fromBufferAttribute(e, i), this; + setFromAttributeAndIndices(t, e, i, s) { + return this.a.fromBufferAttribute(t, e), this.b.fromBufferAttribute(t, i), this.c.fromBufferAttribute(t, s), 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; + copy(t) { + return this.a.copy(t.a), this.b.copy(t.b), this.c.copy(t.c), this; } getArea() { - return Kt.subVectors(this.c, this.b), un.subVectors(this.a, this.b), Kt.cross(un).length() * .5; - } - getMidpoint(e) { - return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); - } - getNormal(e) { - return s1.getNormal(this.a, this.b, this.c, e); - } - getPlane(e) { - return e.setFromCoplanarPoints(this.a, this.b, this.c); - } - getBarycoord(e, t) { - return s1.getBarycoord(e, this.a, this.b, this.c, t); - } - getUV(e, t, n, i, r) { - return $s === !1 && (console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."), $s = !0), s1.getInterpolation(e, this.a, this.b, this.c, t, n, i, r); - } - getInterpolation(e, t, n, i, r) { - return s1.getInterpolation(e, this.a, this.b, this.c, t, n, i, r); - } - containsPoint(e) { - return s1.containsPoint(e, this.a, this.b, this.c); - } - isFrontFacing(e) { - return s1.isFrontFacing(this.a, this.b, this.c, e); - } - intersectsBox(e) { - return e.intersectsTriangle(this); - } - closestPointToPoint(e, t) { - let n = this.a, i = this.b, r = this.c, a, o; - bi.subVectors(i, n), Ei.subVectors(r, n), Ga.subVectors(e, n); - let c = bi.dot(Ga), l = Ei.dot(Ga); - if (c <= 0 && l <= 0) return t.copy(n); - Wa.subVectors(e, i); - let h = bi.dot(Wa), u = Ei.dot(Wa); - if (h >= 0 && u <= h) return t.copy(i); - let d = c * u - h * l; - if (d <= 0 && c >= 0 && h <= 0) return a = c / (c - h), t.copy(n).addScaledVector(bi, a); - Xa.subVectors(e, r); - let f = bi.dot(Xa), m = Ei.dot(Xa); - if (m >= 0 && f <= m) return t.copy(r); - let _ = f * l - c * m; - if (_ <= 0 && l >= 0 && m <= 0) return o = l / (l - m), t.copy(n).addScaledVector(Ei, o); - let g = h * m - f * u; - if (g <= 0 && u - h >= 0 && f - m >= 0) return Kl.subVectors(r, i), o = (u - h) / (u - h + (f - m)), t.copy(i).addScaledVector(Kl, o); - let p = 1 / (g + _ + d); - return a = _ * p, o = d * p, t.copy(n).addScaledVector(bi, a).addScaledVector(Ei, o); - } - equals(e) { - return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c); - } -}, fp = 0, bt = class extends sn { - constructor(){ - super(), this.isMaterial = !0, Object.defineProperty(this, "id", { - value: fp++ - }), this.uuid = kt(), this.name = "", this.type = "Material", this.blending = Wi, this.side = Bn, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = ld, this.blendDst = hd, this.blendEquation = Bi, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = uo, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = If, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = Ia, this.stencilZFail = Ia, this.stencilZPass = Ia, 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(let t in e){ - let n = e[t]; - if (n === void 0) { - console.warn(`THREE.Material: parameter '${t}' has value of undefined.`); - continue; - } - let 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) { - let t = e === void 0 || typeof e == "string"; - t && (e = { - textures: {}, - images: {} - }); - let n = { - metadata: { - version: 4.6, - type: "Material", - generator: "Material.toJSON" - } - }; - n.uuid = this.uuid, n.type = this.type, this.name !== "" && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), this.roughness !== void 0 && (n.roughness = this.roughness), this.metalness !== void 0 && (n.metalness = this.metalness), this.sheen !== void 0 && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity && this.emissiveIntensity !== 1 && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (n.shininess = this.shininess), this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.iridescence !== void 0 && (n.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (n.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (n.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (n.combine = this.combine)), this.envMapIntensity !== void 0 && (n.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (n.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (n.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (n.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (n.size = this.size), this.shadowSide !== null && (n.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== Wi && (n.blending = this.blending), this.side !== Bn && (n.side = this.side), this.vertexColors === !0 && (n.vertexColors = !0), this.opacity < 1 && (n.opacity = this.opacity), this.transparent === !0 && (n.transparent = !0), 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.alphaHash === !0 && (n.alphaHash = !0), this.alphaToCoverage === !0 && (n.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (n.premultipliedAlpha = !0), this.forceSinglePass === !0 && (n.forceSinglePass = !0), this.wireframe === !0 && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (n.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (n.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (n.flatShading = !0), this.visible === !1 && (n.visible = !1), this.toneMapped === !1 && (n.toneMapped = !1), this.fog === !1 && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData); - function i(r) { - let a = []; - for(let o in r){ - let c = r[o]; - delete c.metadata, a.push(c); - } - return a; - } - if (t) { - let r = i(e.textures), a = i(e.images); - r.length > 0 && (n.textures = r), a.length > 0 && (n.images = a); - } - return n; - } - clone() { - return new this.constructor().copy(this); - } - copy(e) { - this.name = e.name, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.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; - let t = e.clippingPlanes, n = null; - if (t !== null) { - let i = t.length; - n = new Array(i); - for(let r = 0; r !== i; ++r)n[r] = t[r].clone(); - } - return this.clippingPlanes = n, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaHash = e.alphaHash, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.forceSinglePass = e.forceSinglePass, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this; - } - dispose() { - this.dispatchEvent({ - type: "dispose" - }); - } - set needsUpdate(e) { - e === !0 && this.version++; - } -}, Sd = { + return Dt.subVectors(this.c, this.b), ee.subVectors(this.a, this.b), Dt.cross(ee).length() * .5; + } + getMidpoint(t) { + return t.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); + } + getNormal(t) { + return h.getNormal(this.a, this.b, this.c, t); + } + getPlane(t) { + return t.setFromCoplanarPoints(this.a, this.b, this.c); + } + getBarycoord(t, e) { + return h.getBarycoord(t, this.a, this.b, this.c, e); + } + getInterpolation(t, e, i, s, n) { + return h.getInterpolation(t, this.a, this.b, this.c, e, i, s, n); + } + containsPoint(t) { + return h.containsPoint(t, this.a, this.b, this.c); + } + isFrontFacing(t) { + return h.isFrontFacing(this.a, this.b, this.c, t); + } + intersectsBox(t) { + return t.intersectsTriangle(this); + } + closestPointToPoint(t, e) { + let i = this.a, s = this.b, n = this.c, r, o; + je.subVectors(s, i), Ke.subVectors(n, i), Un.subVectors(t, i); + let a = je.dot(Un), l = Ke.dot(Un); + if (a <= 0 && l <= 0) return e.copy(i); + Wn.subVectors(t, s); + let c = je.dot(Wn), u = Ke.dot(Wn); + if (c >= 0 && u <= c) return e.copy(s); + let d = a * u - c * l; + if (d <= 0 && a >= 0 && c <= 0) return r = a / (a - c), e.copy(i).addScaledVector(je, r); + Hn.subVectors(t, n); + let p = je.dot(Hn), f = Ke.dot(Hn); + if (f >= 0 && p <= f) return e.copy(n); + let m = p * l - a * f; + if (m <= 0 && l >= 0 && f <= 0) return o = l / (l - f), e.copy(i).addScaledVector(Ke, o); + let y1 = c * f - p * u; + if (y1 <= 0 && u - c >= 0 && p - f >= 0) return Sa.subVectors(n, s), o = (u - c) / (u - c + (p - f)), e.copy(s).addScaledVector(Sa, o); + let g = 1 / (y1 + m + d); + return r = m * g, o = d * g, e.copy(i).addScaledVector(je, r).addScaledVector(Ke, o); + } + equals(t) { + return t.a.equals(this.a) && t.b.equals(this.b) && t.c.equals(this.c); + } +}, Fl = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, @@ -3025,89 +3014,89 @@ var Kt = new A, un = new A, Ha = new A, dn = new A, bi = new A, Ei = new A, Kl = whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 -}, Cn = { +}, me = { h: 0, s: 0, l: 0 -}, Ks = { +}, cs = { h: 0, s: 0, l: 0 }; -function qa(s1, e, t) { - return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? s1 + (e - s1) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? s1 + (e - s1) * 6 * (2 / 3 - t) : s1; -} -var pe = class { - constructor(e, t, n){ - return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, t, n); - } - set(e, t, n) { - if (t === void 0 && n === void 0) { - let i = e; - i && i.isColor ? this.copy(i) : typeof i == "number" ? this.setHex(i) : typeof i == "string" && this.setStyle(i); - } else this.setRGB(e, t, n); +function Jn(h, t, e) { + return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? h + (t - h) * 6 * e : e < 1 / 2 ? t : e < 2 / 3 ? h + (t - h) * 6 * (2 / 3 - e) : h; +} +var P = class { + constructor(t, e, i){ + return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(t, e, i); + } + set(t, e, i) { + if (e === void 0 && i === void 0) { + let s = t; + s && s.isColor ? this.copy(s) : typeof s == "number" ? this.setHex(s) : typeof s == "string" && this.setStyle(s); + } else this.setRGB(t, e, i); return this; } - setScalar(e) { - return this.r = e, this.g = e, this.b = e, this; + setScalar(t) { + return this.r = t, this.g = t, this.b = t, this; } - setHex(e, t = vt) { - return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, Qe.toWorkingColorSpace(this, t), this; + setHex(t, e = Bt) { + return t = Math.floor(t), this.r = (t >> 16 & 255) / 255, this.g = (t >> 8 & 255) / 255, this.b = (t & 255) / 255, Tt.toWorkingColorSpace(this, e), this; } - setRGB(e, t, n, i = Qe.workingColorSpace) { - return this.r = e, this.g = t, this.b = n, Qe.toWorkingColorSpace(this, i), this; + setRGB(t, e, i, s = Tt.workingColorSpace) { + return this.r = t, this.g = e, this.b = i, Tt.toWorkingColorSpace(this, s), this; } - setHSL(e, t, n, i = Qe.workingColorSpace) { - if (e = Yc(e, 1), t = ct(t, 0, 1), n = ct(n, 0, 1), t === 0) this.r = this.g = this.b = n; + setHSL(t, e, i, s = Tt.workingColorSpace) { + if (t = qo(t, 1), e = N(e, 0, 1), i = N(i, 0, 1), e === 0) this.r = this.g = this.b = i; else { - let r = n <= .5 ? n * (1 + t) : n + t - n * t, a = 2 * n - r; - this.r = qa(a, r, e + 1 / 3), this.g = qa(a, r, e), this.b = qa(a, r, e - 1 / 3); + let n = i <= .5 ? i * (1 + e) : i + e - i * e, r = 2 * i - n; + this.r = Jn(r, n, t + 1 / 3), this.g = Jn(r, n, t), this.b = Jn(r, n, t - 1 / 3); } - return Qe.toWorkingColorSpace(this, i), this; + return Tt.toWorkingColorSpace(this, s), this; } - setStyle(e, t = vt) { - function n(r) { - r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored."); + setStyle(t, e = Bt) { + function i(n) { + n !== void 0 && parseFloat(n) < 1 && console.warn("THREE.Color: Alpha component of " + t + " will be ignored."); } - let i; - if (i = /^(\w+)\(([^\)]*)\)/.exec(e)) { - let r, a = i[1], o = i[2]; - switch(a){ + let s; + if (s = /^(\w+)\(([^\)]*)\)/.exec(t)) { + let n, r = s[1], o = s[2]; + switch(r){ case "rgb": case "rgba": - if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(r[4]), this.setRGB(Math.min(255, parseInt(r[1], 10)) / 255, Math.min(255, parseInt(r[2], 10)) / 255, Math.min(255, parseInt(r[3], 10)) / 255, t); - if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(r[4]), this.setRGB(Math.min(100, parseInt(r[1], 10)) / 100, Math.min(100, parseInt(r[2], 10)) / 100, Math.min(100, parseInt(r[3], 10)) / 100, t); + if (n = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return i(n[4]), this.setRGB(Math.min(255, parseInt(n[1], 10)) / 255, Math.min(255, parseInt(n[2], 10)) / 255, Math.min(255, parseInt(n[3], 10)) / 255, e); + if (n = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return i(n[4]), this.setRGB(Math.min(100, parseInt(n[1], 10)) / 100, Math.min(100, parseInt(n[2], 10)) / 100, Math.min(100, parseInt(n[3], 10)) / 100, e); break; case "hsl": case "hsla": - if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(r[4]), this.setHSL(parseFloat(r[1]) / 360, parseFloat(r[2]) / 100, parseFloat(r[3]) / 100, t); + if (n = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return i(n[4]), this.setHSL(parseFloat(n[1]) / 360, parseFloat(n[2]) / 100, parseFloat(n[3]) / 100, e); break; default: - console.warn("THREE.Color: Unknown color model " + e); - } - } else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) { - let r = i[1], a = r.length; - if (a === 3) return this.setRGB(parseInt(r.charAt(0), 16) / 15, parseInt(r.charAt(1), 16) / 15, parseInt(r.charAt(2), 16) / 15, t); - if (a === 6) return this.setHex(parseInt(r, 16), t); - console.warn("THREE.Color: Invalid hex color " + e); - } else if (e && e.length > 0) return this.setColorName(e, t); + console.warn("THREE.Color: Unknown color model " + t); + } + } else if (s = /^\#([A-Fa-f\d]+)$/.exec(t)) { + let n = s[1], r = n.length; + if (r === 3) return this.setRGB(parseInt(n.charAt(0), 16) / 15, parseInt(n.charAt(1), 16) / 15, parseInt(n.charAt(2), 16) / 15, e); + if (r === 6) return this.setHex(parseInt(n, 16), e); + console.warn("THREE.Color: Invalid hex color " + t); + } else if (t && t.length > 0) return this.setColorName(t, e); return this; } - setColorName(e, t = vt) { - let n = Sd[e.toLowerCase()]; - return n !== void 0 ? this.setHex(n, t) : console.warn("THREE.Color: Unknown color " + e), this; + setColorName(t, e = Bt) { + let i = Fl[t.toLowerCase()]; + return i !== void 0 ? this.setHex(i, e) : console.warn("THREE.Color: Unknown color " + t), 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; + copy(t) { + return this.r = t.r, this.g = t.g, this.b = t.b, this; } - copySRGBToLinear(e) { - return this.r = Xi(e.r), this.g = Xi(e.g), this.b = Xi(e.b), this; + copySRGBToLinear(t) { + return this.r = ae(t.r), this.g = ae(t.g), this.b = ae(t.b), this; } - copyLinearToSRGB(e) { - return this.r = Da(e.r), this.g = Da(e.g), this.b = Da(e.b), this; + copyLinearToSRGB(t) { + return this.r = di(t.r), this.g = di(t.g), this.b = di(t.b), this; } convertSRGBToLinear() { return this.copySRGBToLinear(this), this; @@ -3115,91 +3104,91 @@ var pe = class { convertLinearToSRGB() { return this.copyLinearToSRGB(this), this; } - getHex(e = vt) { - return Qe.fromWorkingColorSpace(Tt.copy(this), e), Math.round(ct(Tt.r * 255, 0, 255)) * 65536 + Math.round(ct(Tt.g * 255, 0, 255)) * 256 + Math.round(ct(Tt.b * 255, 0, 255)); + getHex(t = Bt) { + return Tt.fromWorkingColorSpace(dt.copy(this), t), Math.round(N(dt.r * 255, 0, 255)) * 65536 + Math.round(N(dt.g * 255, 0, 255)) * 256 + Math.round(N(dt.b * 255, 0, 255)); } - getHexString(e = vt) { - return ("000000" + this.getHex(e).toString(16)).slice(-6); + getHexString(t = Bt) { + return ("000000" + this.getHex(t).toString(16)).slice(-6); } - getHSL(e, t = Qe.workingColorSpace) { - Qe.fromWorkingColorSpace(Tt.copy(this), t); - let n = Tt.r, i = Tt.g, r = Tt.b, a = Math.max(n, i, r), o = Math.min(n, i, r), c, l, h = (o + a) / 2; - if (o === a) c = 0, l = 0; + getHSL(t, e = Tt.workingColorSpace) { + Tt.fromWorkingColorSpace(dt.copy(this), e); + let i = dt.r, s = dt.g, n = dt.b, r = Math.max(i, s, n), o = Math.min(i, s, n), a, l, c = (o + r) / 2; + if (o === r) a = 0, l = 0; else { - let u = a - o; - switch(l = h <= .5 ? u / (a + o) : u / (2 - a - o), a){ - case n: - c = (i - r) / u + (i < r ? 6 : 0); - break; + let u = r - o; + switch(l = c <= .5 ? u / (r + o) : u / (2 - r - o), r){ case i: - c = (r - n) / u + 2; + a = (s - n) / u + (s < n ? 6 : 0); break; - case r: - c = (n - i) / u + 4; + case s: + a = (n - i) / u + 2; + break; + case n: + a = (i - s) / u + 4; break; } - c /= 6; + a /= 6; } - return e.h = c, e.s = l, e.l = h, e; + return t.h = a, t.s = l, t.l = c, t; } - getRGB(e, t = Qe.workingColorSpace) { - return Qe.fromWorkingColorSpace(Tt.copy(this), t), e.r = Tt.r, e.g = Tt.g, e.b = Tt.b, e; + getRGB(t, e = Tt.workingColorSpace) { + return Tt.fromWorkingColorSpace(dt.copy(this), e), t.r = dt.r, t.g = dt.g, t.b = dt.b, t; } - getStyle(e = vt) { - Qe.fromWorkingColorSpace(Tt.copy(this), e); - let t = Tt.r, n = Tt.g, i = Tt.b; - return e !== vt ? `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})` : `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(i * 255)})`; + getStyle(t = Bt) { + Tt.fromWorkingColorSpace(dt.copy(this), t); + let e = dt.r, i = dt.g, s = dt.b; + return t !== Bt ? `color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})` : `rgb(${Math.round(e * 255)},${Math.round(i * 255)},${Math.round(s * 255)})`; } - offsetHSL(e, t, n) { - return this.getHSL(Cn), this.setHSL(Cn.h + e, Cn.s + t, Cn.l + n); + offsetHSL(t, e, i) { + return this.getHSL(me), this.setHSL(me.h + t, me.s + e, me.l + i); } - add(e) { - return this.r += e.r, this.g += e.g, this.b += e.b, this; + add(t) { + return this.r += t.r, this.g += t.g, this.b += t.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; + addColors(t, e) { + return this.r = t.r + e.r, this.g = t.g + e.g, this.b = t.b + e.b, this; } - addScalar(e) { - return this.r += e, this.g += e, this.b += e, this; + addScalar(t) { + return this.r += t, this.g += t, this.b += t, 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; + sub(t) { + return this.r = Math.max(0, this.r - t.r), this.g = Math.max(0, this.g - t.g), this.b = Math.max(0, this.b - t.b), this; } - multiply(e) { - return this.r *= e.r, this.g *= e.g, this.b *= e.b, this; + multiply(t) { + return this.r *= t.r, this.g *= t.g, this.b *= t.b, this; } - multiplyScalar(e) { - return this.r *= e, this.g *= e, this.b *= e, this; + multiplyScalar(t) { + return this.r *= t, this.g *= t, this.b *= t, 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; + lerp(t, e) { + return this.r += (t.r - this.r) * e, this.g += (t.g - this.g) * e, this.b += (t.b - this.b) * e, 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; + lerpColors(t, e, i) { + return this.r = t.r + (e.r - t.r) * i, this.g = t.g + (e.g - t.g) * i, this.b = t.b + (e.b - t.b) * i, this; } - lerpHSL(e, t) { - this.getHSL(Cn), e.getHSL(Ks); - let n = ys(Cn.h, Ks.h, t), i = ys(Cn.s, Ks.s, t), r = ys(Cn.l, Ks.l, t); - return this.setHSL(n, i, r), this; + lerpHSL(t, e) { + this.getHSL(me), t.getHSL(cs); + let i = Ni(me.h, cs.h, e), s = Ni(me.s, cs.s, e), n = Ni(me.l, cs.l, e); + return this.setHSL(i, s, n), this; } - setFromVector3(e) { - return this.r = e.x, this.g = e.y, this.b = e.z, this; + setFromVector3(t) { + return this.r = t.x, this.g = t.y, this.b = t.z, this; } - applyMatrix3(e) { - let t = this.r, n = this.g, i = this.b, r = e.elements; - return this.r = r[0] * t + r[3] * n + r[6] * i, this.g = r[1] * t + r[4] * n + r[7] * i, this.b = r[2] * t + r[5] * n + r[8] * i, this; + applyMatrix3(t) { + let e = this.r, i = this.g, s = this.b, n = t.elements; + return this.r = n[0] * e + n[3] * i + n[6] * s, this.g = n[1] * e + n[4] * i + n[7] * s, this.b = n[2] * e + n[5] * i + n[8] * s, this; } - equals(e) { - return e.r === this.r && e.g === this.g && e.b === this.b; + equals(t) { + return t.r === this.r && t.g === this.g && t.b === this.b; } - fromArray(e, t = 0) { - return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this; + fromArray(t, e = 0) { + return this.r = t[e], this.g = t[e + 1], this.b = t[e + 2], this; } - toArray(e = [], t = 0) { - return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e; + toArray(t = [], e = 0) { + return t[e] = this.r, t[e + 1] = this.g, t[e + 2] = this.b, t; } - fromBufferAttribute(e, t) { - return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), this; + fromBufferAttribute(t, e) { + return this.r = t.getX(e), this.g = t.getY(e), this.b = t.getZ(e), this; } toJSON() { return this.getHex(); @@ -3207,243 +3196,331 @@ var pe = class { *[Symbol.iterator]() { yield this.r, yield this.g, yield this.b; } -}, Tt = new pe; -pe.NAMES = Sd; -var Sn = class extends bt { - constructor(e){ - super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new pe(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 = xa, 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; - } -}, _n = pp(); -function pp() { - let s1 = new ArrayBuffer(4), e = new Float32Array(s1), t = new Uint32Array(s1), n = new Uint32Array(512), i = new Uint32Array(512); - for(let c = 0; c < 256; ++c){ - let l = c - 127; - l < -27 ? (n[c] = 0, n[c | 256] = 32768, i[c] = 24, i[c | 256] = 24) : l < -14 ? (n[c] = 1024 >> -l - 14, n[c | 256] = 1024 >> -l - 14 | 32768, i[c] = -l - 1, i[c | 256] = -l - 1) : l <= 15 ? (n[c] = l + 15 << 10, n[c | 256] = l + 15 << 10 | 32768, i[c] = 13, i[c | 256] = 13) : l < 128 ? (n[c] = 31744, n[c | 256] = 64512, i[c] = 24, i[c | 256] = 24) : (n[c] = 31744, n[c | 256] = 64512, i[c] = 13, i[c | 256] = 13); - } - let r = new Uint32Array(2048), a = new Uint32Array(64), o = new Uint32Array(64); - for(let c = 1; c < 1024; ++c){ - let l = c << 13, h = 0; - for(; !(l & 8388608);)l <<= 1, h -= 8388608; - l &= -8388609, h += 947912704, r[c] = l | h; - } - for(let c = 1024; c < 2048; ++c)r[c] = 939524096 + (c - 1024 << 13); - for(let c = 1; c < 31; ++c)a[c] = c << 23; - a[31] = 1199570944, a[32] = 2147483648; - for(let c = 33; c < 63; ++c)a[c] = 2147483648 + (c - 32 << 23); - a[63] = 3347054592; - for(let c = 1; c < 64; ++c)c !== 32 && (o[c] = 1024); +}, dt = new P; +P.NAMES = Fl; +var _u = 0, ct = class extends qt { + constructor(){ + super(), this.isMaterial = !0, Object.defineProperty(this, "id", { + value: _u++ + }), this.uuid = It(), this.name = "", this.type = "Material", this.blending = ea, this.side = dr, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = sa, this.blendDst = na, this.blendEquation = ia, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new P(0, 0, 0), this.blendAlpha = 0, this.depthFunc = ra, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = ca, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = qe, this.stencilZFail = qe, this.stencilZPass = qe, 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(t) { + this._alphaTest > 0 != t > 0 && this.version++, this._alphaTest = t; + } + onBeforeRender() {} + onBeforeCompile() {} + customProgramCacheKey() { + return this.onBeforeCompile.toString(); + } + setValues(t) { + if (t !== void 0) for(let e in t){ + let i = t[e]; + if (i === void 0) { + console.warn(`THREE.Material: parameter '${e}' has value of undefined.`); + continue; + } + let s = this[e]; + if (s === void 0) { + console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`); + continue; + } + s && s.isColor ? s.set(i) : s && s.isVector3 && i && i.isVector3 ? s.copy(i) : this[e] = i; + } + } + toJSON(t) { + let e = t === void 0 || typeof t == "string"; + e && (t = { + textures: {}, + images: {} + }); + let i = { + metadata: { + version: 4.6, + type: "Material", + generator: "Material.toJSON" + } + }; + i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen !== void 0 && (i.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (i.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (i.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (i.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (i.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(t).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(t).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(t).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.dispersion !== void 0 && (i.dispersion = this.dispersion), this.iridescence !== void 0 && (i.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (i.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (i.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (i.iridescenceMap = this.iridescenceMap.toJSON(t).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (i.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(t).uuid), this.anisotropy !== void 0 && (i.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (i.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (i.anisotropyMap = this.anisotropyMap.toJSON(t).uuid), this.map && this.map.isTexture && (i.map = this.map.toJSON(t).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(t).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(t).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(t).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(t).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(t).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(t).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(t).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(t).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(t).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(t).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(t).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (i.specularIntensityMap = this.specularIntensityMap.toJSON(t).uuid), this.specularColorMap && this.specularColorMap.isTexture && (i.specularColorMap = this.specularColorMap.toJSON(t).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(t).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapRotation !== void 0 && (i.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(t).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(t).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(t).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== 1 / 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== ea && (i.blending = this.blending), this.side !== dr && (i.side = this.side), this.vertexColors === !0 && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = !0), this.blendSrc !== sa && (i.blendSrc = this.blendSrc), this.blendDst !== na && (i.blendDst = this.blendDst), this.blendEquation !== ia && (i.blendEquation = this.blendEquation), this.blendSrcAlpha !== null && (i.blendSrcAlpha = this.blendSrcAlpha), this.blendDstAlpha !== null && (i.blendDstAlpha = this.blendDstAlpha), this.blendEquationAlpha !== null && (i.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (i.blendColor = this.blendColor.getHex()), this.blendAlpha !== 0 && (i.blendAlpha = this.blendAlpha), this.depthFunc !== ra && (i.depthFunc = this.depthFunc), this.depthTest === !1 && (i.depthTest = this.depthTest), this.depthWrite === !1 && (i.depthWrite = this.depthWrite), this.colorWrite === !1 && (i.colorWrite = this.colorWrite), this.stencilWriteMask !== 255 && (i.stencilWriteMask = this.stencilWriteMask), this.stencilFunc !== ca && (i.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (i.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (i.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== qe && (i.stencilFail = this.stencilFail), this.stencilZFail !== qe && (i.stencilZFail = this.stencilZFail), this.stencilZPass !== qe && (i.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (i.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaHash === !0 && (i.alphaHash = !0), this.alphaToCoverage === !0 && (i.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = !0), this.forceSinglePass === !0 && (i.forceSinglePass = !0), this.wireframe === !0 && (i.wireframe = !0), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (i.flatShading = !0), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), this.fog === !1 && (i.fog = !1), Object.keys(this.userData).length > 0 && (i.userData = this.userData); + function s(n) { + let r = []; + for(let o in n){ + let a = n[o]; + delete a.metadata, r.push(a); + } + return r; + } + if (e) { + let n = s(t.textures), r = s(t.images); + n.length > 0 && (i.textures = n), r.length > 0 && (i.images = r); + } + return i; + } + clone() { + return new this.constructor().copy(this); + } + copy(t) { + this.name = t.name, this.blending = t.blending, this.side = t.side, this.vertexColors = t.vertexColors, this.opacity = t.opacity, this.transparent = t.transparent, this.blendSrc = t.blendSrc, this.blendDst = t.blendDst, this.blendEquation = t.blendEquation, this.blendSrcAlpha = t.blendSrcAlpha, this.blendDstAlpha = t.blendDstAlpha, this.blendEquationAlpha = t.blendEquationAlpha, this.blendColor.copy(t.blendColor), this.blendAlpha = t.blendAlpha, this.depthFunc = t.depthFunc, this.depthTest = t.depthTest, this.depthWrite = t.depthWrite, this.stencilWriteMask = t.stencilWriteMask, this.stencilFunc = t.stencilFunc, this.stencilRef = t.stencilRef, this.stencilFuncMask = t.stencilFuncMask, this.stencilFail = t.stencilFail, this.stencilZFail = t.stencilZFail, this.stencilZPass = t.stencilZPass, this.stencilWrite = t.stencilWrite; + let e = t.clippingPlanes, i = null; + if (e !== null) { + let s = e.length; + i = new Array(s); + for(let n = 0; n !== s; ++n)i[n] = e[n].clone(); + } + return this.clippingPlanes = i, this.clipIntersection = t.clipIntersection, this.clipShadows = t.clipShadows, this.shadowSide = t.shadowSide, this.colorWrite = t.colorWrite, this.precision = t.precision, this.polygonOffset = t.polygonOffset, this.polygonOffsetFactor = t.polygonOffsetFactor, this.polygonOffsetUnits = t.polygonOffsetUnits, this.dithering = t.dithering, this.alphaTest = t.alphaTest, this.alphaHash = t.alphaHash, this.alphaToCoverage = t.alphaToCoverage, this.premultipliedAlpha = t.premultipliedAlpha, this.forceSinglePass = t.forceSinglePass, this.visible = t.visible, this.toneMapped = t.toneMapped, this.userData = JSON.parse(JSON.stringify(t.userData)), this; + } + dispose() { + this.dispatchEvent({ + type: "dispose" + }); + } + set needsUpdate(t) { + t === !0 && this.version++; + } + onBuild() { + console.warn("Material: onBuild() has been removed."); + } +}, _e = class extends ct { + constructor(t){ + super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new P(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Xt, this.combine = Do, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapRotation.copy(t.envMapRotation), this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.fog = t.fog, this; + } +}, re = vu(); +function vu() { + let h = new ArrayBuffer(4), t = new Float32Array(h), e = new Uint32Array(h), i = new Uint32Array(512), s = new Uint32Array(512); + for(let a = 0; a < 256; ++a){ + let l = a - 127; + l < -27 ? (i[a] = 0, i[a | 256] = 32768, s[a] = 24, s[a | 256] = 24) : l < -14 ? (i[a] = 1024 >> -l - 14, i[a | 256] = 1024 >> -l - 14 | 32768, s[a] = -l - 1, s[a | 256] = -l - 1) : l <= 15 ? (i[a] = l + 15 << 10, i[a | 256] = l + 15 << 10 | 32768, s[a] = 13, s[a | 256] = 13) : l < 128 ? (i[a] = 31744, i[a | 256] = 64512, s[a] = 24, s[a | 256] = 24) : (i[a] = 31744, i[a | 256] = 64512, s[a] = 13, s[a | 256] = 13); + } + let n = new Uint32Array(2048), r = new Uint32Array(64), o = new Uint32Array(64); + for(let a = 1; a < 1024; ++a){ + let l = a << 13, c = 0; + for(; !(l & 8388608);)l <<= 1, c -= 8388608; + l &= -8388609, c += 947912704, n[a] = l | c; + } + for(let a = 1024; a < 2048; ++a)n[a] = 939524096 + (a - 1024 << 13); + for(let a = 1; a < 31; ++a)r[a] = a << 23; + r[31] = 1199570944, r[32] = 2147483648; + for(let a = 33; a < 63; ++a)r[a] = 2147483648 + (a - 32 << 23); + r[63] = 3347054592; + for(let a = 1; a < 64; ++a)a !== 32 && (o[a] = 1024); return { - floatView: e, - uint32View: t, - baseTable: n, - shiftTable: i, - mantissaTable: r, - exponentTable: a, + floatView: t, + uint32View: e, + baseTable: i, + shiftTable: s, + mantissaTable: n, + exponentTable: r, offsetTable: o }; } -function Nt(s1) { - Math.abs(s1) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), s1 = ct(s1, -65504, 65504), _n.floatView[0] = s1; - let e = _n.uint32View[0], t = e >> 23 & 511; - return _n.baseTable[t] + ((e & 8388607) >> _n.shiftTable[t]); -} -function xs(s1) { - let e = s1 >> 10; - return _n.uint32View[0] = _n.mantissaTable[_n.offsetTable[e] + (s1 & 1023)] + _n.exponentTable[e], _n.floatView[0]; -} -var Mv = { - toHalfFloat: Nt, - fromHalfFloat: xs -}, ft = new A, Qs = new Z, et = class { - 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 = Hr, this.updateRange = { - offset: 0, - count: -1 - }, this.gpuType = xn, this.version = 0; +function _t(h) { + Math.abs(h) > 65504 && console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."), h = N(h, -65504, 65504), re.floatView[0] = h; + let t = re.uint32View[0], e = t >> 23 & 511; + return re.baseTable[e] + ((t & 8388607) >> re.shiftTable[e]); +} +function Oi(h) { + let t = h >> 10; + return re.uint32View[0] = re.mantissaTable[re.offsetTable[t] + (h & 1023)] + re.exponentTable[t], re.floatView[0]; +} +var Ef = { + toHalfFloat: _t, + fromHalfFloat: Oi +}, nt = new w, us = new T, Au = 0, Z = class { + constructor(t, e, i = !1){ + if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); + this.isBufferAttribute = !0, Object.defineProperty(this, "id", { + value: Au++ + }), this.name = "", this.array = t, this.itemSize = e, this.count = t !== void 0 ? t.length / e : 0, this.normalized = i, this.usage = Js, this.updateRanges = [], this.gpuType = pi, this.version = 0; } onUploadCallback() {} - set needsUpdate(e) { - e === !0 && this.version++; + set needsUpdate(t) { + t === !0 && this.version++; + } + setUsage(t) { + return this.usage = t, this; } - setUsage(e) { - return this.usage = e, this; + addUpdateRange(t, e) { + this.updateRanges.push({ + start: t, + count: e + }); + } + clearUpdateRanges() { + this.updateRanges.length = 0; } - copy(e) { - return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this.gpuType = e.gpuType, this; + copy(t) { + return this.name = t.name, this.array = new t.array.constructor(t.array), this.itemSize = t.itemSize, this.count = t.count, this.normalized = t.normalized, this.usage = t.usage, this.gpuType = t.gpuType, this; } - copyAt(e, t, n) { - e *= this.itemSize, n *= t.itemSize; - for(let i = 0, r = this.itemSize; i < r; i++)this.array[e + i] = t.array[n + i]; + copyAt(t, e, i) { + t *= this.itemSize, i *= e.itemSize; + for(let s = 0, n = this.itemSize; s < n; s++)this.array[t + s] = e.array[i + s]; return this; } - copyArray(e) { - return this.array.set(e), this; + copyArray(t) { + return this.array.set(t), this; } - applyMatrix3(e) { - if (this.itemSize === 2) for(let t = 0, n = this.count; t < n; t++)Qs.fromBufferAttribute(this, t), Qs.applyMatrix3(e), this.setXY(t, Qs.x, Qs.y); - else if (this.itemSize === 3) for(let t = 0, n = this.count; t < n; t++)ft.fromBufferAttribute(this, t), ft.applyMatrix3(e), this.setXYZ(t, ft.x, ft.y, ft.z); + applyMatrix3(t) { + if (this.itemSize === 2) for(let e = 0, i = this.count; e < i; e++)us.fromBufferAttribute(this, e), us.applyMatrix3(t), this.setXY(e, us.x, us.y); + else if (this.itemSize === 3) for(let e = 0, i = this.count; e < i; e++)nt.fromBufferAttribute(this, e), nt.applyMatrix3(t), this.setXYZ(e, nt.x, nt.y, nt.z); return this; } - applyMatrix4(e) { - for(let t = 0, n = this.count; t < n; t++)ft.fromBufferAttribute(this, t), ft.applyMatrix4(e), this.setXYZ(t, ft.x, ft.y, ft.z); + applyMatrix4(t) { + for(let e = 0, i = this.count; e < i; e++)nt.fromBufferAttribute(this, e), nt.applyMatrix4(t), this.setXYZ(e, nt.x, nt.y, nt.z); return this; } - applyNormalMatrix(e) { - for(let t = 0, n = this.count; t < n; t++)ft.fromBufferAttribute(this, t), ft.applyNormalMatrix(e), this.setXYZ(t, ft.x, ft.y, ft.z); + applyNormalMatrix(t) { + for(let e = 0, i = this.count; e < i; e++)nt.fromBufferAttribute(this, e), nt.applyNormalMatrix(t), this.setXYZ(e, nt.x, nt.y, nt.z); return this; } - transformDirection(e) { - for(let t = 0, n = this.count; t < n; t++)ft.fromBufferAttribute(this, t), ft.transformDirection(e), this.setXYZ(t, ft.x, ft.y, ft.z); + transformDirection(t) { + for(let e = 0, i = this.count; e < i; e++)nt.fromBufferAttribute(this, e), nt.transformDirection(t), this.setXYZ(e, nt.x, nt.y, nt.z); return this; } - set(e, t = 0) { - return this.array.set(e, t), this; + set(t, e = 0) { + return this.array.set(t, e), this; } - getComponent(e, t) { - let n = this.array[e * this.itemSize + t]; - return this.normalized && (n = Ot(n, this.array)), n; + getComponent(t, e) { + let i = this.array[t * this.itemSize + e]; + return this.normalized && (i = xt(i, this.array)), i; } - setComponent(e, t, n) { - return this.normalized && (n = Be(n, this.array)), this.array[e * this.itemSize + t] = n, this; + setComponent(t, e, i) { + return this.normalized && (i = V(i, this.array)), this.array[t * this.itemSize + e] = i, this; } - getX(e) { - let t = this.array[e * this.itemSize]; - return this.normalized && (t = Ot(t, this.array)), t; + getX(t) { + let e = this.array[t * this.itemSize]; + return this.normalized && (e = xt(e, this.array)), e; } - setX(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize] = t, this; + setX(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize] = e, this; } - getY(e) { - let t = this.array[e * this.itemSize + 1]; - return this.normalized && (t = Ot(t, this.array)), t; + getY(t) { + let e = this.array[t * this.itemSize + 1]; + return this.normalized && (e = xt(e, this.array)), e; } - setY(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 1] = t, this; + setY(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 1] = e, this; } - getZ(e) { - let t = this.array[e * this.itemSize + 2]; - return this.normalized && (t = Ot(t, this.array)), t; + getZ(t) { + let e = this.array[t * this.itemSize + 2]; + return this.normalized && (e = xt(e, this.array)), e; } - setZ(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 2] = t, this; + setZ(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 2] = e, this; } - getW(e) { - let t = this.array[e * this.itemSize + 3]; - return this.normalized && (t = Ot(t, this.array)), t; + getW(t) { + let e = this.array[t * this.itemSize + 3]; + return this.normalized && (e = xt(e, this.array)), e; } - setW(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 3] = t, this; + setW(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 3] = e, this; } - setXY(e, t, n) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this; + setXY(t, e, i) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array)), this.array[t + 0] = e, this.array[t + 1] = i, this; } - setXYZ(e, t, n, i) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this; + setXYZ(t, e, i, s) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array)), this.array[t + 0] = e, this.array[t + 1] = i, this.array[t + 2] = s, this; } - setXYZW(e, t, n, i, r) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array), r = Be(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this.array[e + 3] = r, this; + setXYZW(t, e, i, s, n) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array), n = V(n, this.array)), this.array[t + 0] = e, this.array[t + 1] = i, this.array[t + 2] = s, this.array[t + 3] = n, this; } - onUpload(e) { - return this.onUploadCallback = e, this; + onUpload(t) { + return this.onUploadCallback = t, this; } clone() { return new this.constructor(this.array, this.itemSize).copy(this); } toJSON() { - let e = { + let t = { 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 !== Hr && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e; + return this.name !== "" && (t.name = this.name), this.usage !== Js && (t.usage = this.usage), t; } -}, Ql = class extends et { - constructor(e, t, n){ - super(new Int8Array(e), t, n); +}, Ta = class extends Z { + constructor(t, e, i){ + super(new Int8Array(t), e, i); } -}, jl = class extends et { - constructor(e, t, n){ - super(new Uint8Array(e), t, n); +}, Ia = class extends Z { + constructor(t, e, i){ + super(new Uint8Array(t), e, i); } -}, eh = class extends et { - constructor(e, t, n){ - super(new Uint8ClampedArray(e), t, n); +}, Ca = class extends Z { + constructor(t, e, i){ + super(new Uint8ClampedArray(t), e, i); } -}, th = class extends et { - constructor(e, t, n){ - super(new Int16Array(e), t, n); +}, za = class extends Z { + constructor(t, e, i){ + super(new Int16Array(t), e, i); } -}, Zr = class extends et { - constructor(e, t, n){ - super(new Uint16Array(e), t, n); +}, gr = class extends Z { + constructor(t, e, i){ + super(new Uint16Array(t), e, i); } -}, nh = class extends et { - constructor(e, t, n){ - super(new Int32Array(e), t, n); +}, Fa = class extends Z { + constructor(t, e, i){ + super(new Int32Array(t), e, i); } -}, Jr = class extends et { - constructor(e, t, n){ - super(new Uint32Array(e), t, n); +}, xr = class extends Z { + constructor(t, e, i){ + super(new Uint32Array(t), e, i); } -}, ih = class extends et { - constructor(e, t, n){ - super(new Uint16Array(e), t, n), this.isFloat16BufferAttribute = !0; +}, Ba = class extends Z { + constructor(t, e, i){ + super(new Uint16Array(t), e, i), this.isFloat16BufferAttribute = !0; } - getX(e) { - let t = xs(this.array[e * this.itemSize]); - return this.normalized && (t = Ot(t, this.array)), t; + getX(t) { + let e = Oi(this.array[t * this.itemSize]); + return this.normalized && (e = xt(e, this.array)), e; } - setX(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize] = Nt(t), this; + setX(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize] = _t(e), this; } - getY(e) { - let t = xs(this.array[e * this.itemSize + 1]); - return this.normalized && (t = Ot(t, this.array)), t; + getY(t) { + let e = Oi(this.array[t * this.itemSize + 1]); + return this.normalized && (e = xt(e, this.array)), e; } - setY(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 1] = Nt(t), this; + setY(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 1] = _t(e), this; } - getZ(e) { - let t = xs(this.array[e * this.itemSize + 2]); - return this.normalized && (t = Ot(t, this.array)), t; + getZ(t) { + let e = Oi(this.array[t * this.itemSize + 2]); + return this.normalized && (e = xt(e, this.array)), e; } - setZ(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 2] = Nt(t), this; + setZ(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 2] = _t(e), this; } - getW(e) { - let t = xs(this.array[e * this.itemSize + 3]); - return this.normalized && (t = Ot(t, this.array)), t; + getW(t) { + let e = Oi(this.array[t * this.itemSize + 3]); + return this.normalized && (e = xt(e, this.array)), e; } - setW(e, t) { - return this.normalized && (t = Be(t, this.array)), this.array[e * this.itemSize + 3] = Nt(t), this; + setW(t, e) { + return this.normalized && (e = V(e, this.array)), this.array[t * this.itemSize + 3] = _t(e), this; } - setXY(e, t, n) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array)), this.array[e + 0] = Nt(t), this.array[e + 1] = Nt(n), this; + setXY(t, e, i) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array)), this.array[t + 0] = _t(e), this.array[t + 1] = _t(i), this; } - setXYZ(e, t, n, i) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array)), this.array[e + 0] = Nt(t), this.array[e + 1] = Nt(n), this.array[e + 2] = Nt(i), this; + setXYZ(t, e, i, s) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array)), this.array[t + 0] = _t(e), this.array[t + 1] = _t(i), this.array[t + 2] = _t(s), this; } - setXYZW(e, t, n, i, r) { - return e *= this.itemSize, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array), r = Be(r, this.array)), this.array[e + 0] = Nt(t), this.array[e + 1] = Nt(n), this.array[e + 2] = Nt(i), this.array[e + 3] = Nt(r), this; + setXYZW(t, e, i, s, n) { + return t *= this.itemSize, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array), n = V(n, this.array)), this.array[t + 0] = _t(e), this.array[t + 1] = _t(i), this.array[t + 2] = _t(s), this.array[t + 3] = _t(n), this; } -}, ve = class extends et { - constructor(e, t, n){ - super(new Float32Array(e), t, n); +}, E = class extends Z { + constructor(t, e, i){ + super(new Float32Array(t), e, i); } -}, sh = class extends et { - constructor(e, t, n){ - super(new Float64Array(e), t, n); - } -}, mp = 0, Gt = new ze, Ya = new Je, Ti = new A, Vt = new Qt, us = new Qt, xt = new A, Ge = class s1 extends sn { +}, Su = 0, Ft = new D, Zn = new G, ti = new w, St = new ft, Ii = new ft, rt = new w, L = class h extends qt { constructor(){ super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { - value: mp++ - }), this.uuid = kt(), 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 = { + value: Su++ + }), this.uuid = It(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {}; @@ -3451,461 +3528,478 @@ var Mv = { getIndex() { return this.index; } - setIndex(e) { - return Array.isArray(e) ? this.index = new (Md(e) ? Jr : Zr)(e, 1) : this.index = e, this; + setIndex(t) { + return Array.isArray(t) ? this.index = new (cu(t) ? xr : gr)(t, 1) : this.index = t, this; + } + setIndirect(t) { + return this.indirect = t, this; } - getAttribute(e) { - return this.attributes[e]; + getIndirect() { + return this.indirect; } - setAttribute(e, t) { - return this.attributes[e] = t, this; + getAttribute(t) { + return this.attributes[t]; } - deleteAttribute(e) { - return delete this.attributes[e], this; + setAttribute(t, e) { + return this.attributes[t] = e, this; } - hasAttribute(e) { - return this.attributes[e] !== void 0; + deleteAttribute(t) { + return delete this.attributes[t], this; } - addGroup(e, t, n = 0) { + hasAttribute(t) { + return this.attributes[t] !== void 0; + } + addGroup(t, e, i = 0) { this.groups.push({ - start: e, - count: t, - materialIndex: n + start: t, + count: e, + materialIndex: i }); } clearGroups() { this.groups = []; } - setDrawRange(e, t) { - this.drawRange.start = e, this.drawRange.count = t; + setDrawRange(t, e) { + this.drawRange.start = t, this.drawRange.count = e; } - applyMatrix4(e) { - let t = this.attributes.position; - t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0); - let n = this.attributes.normal; - if (n !== void 0) { - let r = new He().getNormalMatrix(e); - n.applyNormalMatrix(r), n.needsUpdate = !0; + applyMatrix4(t) { + let e = this.attributes.position; + e !== void 0 && (e.applyMatrix4(t), e.needsUpdate = !0); + let i = this.attributes.normal; + if (i !== void 0) { + let n = new Gt().getNormalMatrix(t); + i.applyNormalMatrix(n), i.needsUpdate = !0; } - let 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; + let s = this.attributes.tangent; + return s !== void 0 && (s.transformDirection(t), s.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } - applyQuaternion(e) { - return Gt.makeRotationFromQuaternion(e), this.applyMatrix4(Gt), this; + applyQuaternion(t) { + return Ft.makeRotationFromQuaternion(t), this.applyMatrix4(Ft), this; } - rotateX(e) { - return Gt.makeRotationX(e), this.applyMatrix4(Gt), this; + rotateX(t) { + return Ft.makeRotationX(t), this.applyMatrix4(Ft), this; } - rotateY(e) { - return Gt.makeRotationY(e), this.applyMatrix4(Gt), this; + rotateY(t) { + return Ft.makeRotationY(t), this.applyMatrix4(Ft), this; } - rotateZ(e) { - return Gt.makeRotationZ(e), this.applyMatrix4(Gt), this; + rotateZ(t) { + return Ft.makeRotationZ(t), this.applyMatrix4(Ft), this; } - translate(e, t, n) { - return Gt.makeTranslation(e, t, n), this.applyMatrix4(Gt), this; + translate(t, e, i) { + return Ft.makeTranslation(t, e, i), this.applyMatrix4(Ft), this; } - scale(e, t, n) { - return Gt.makeScale(e, t, n), this.applyMatrix4(Gt), this; + scale(t, e, i) { + return Ft.makeScale(t, e, i), this.applyMatrix4(Ft), this; } - lookAt(e) { - return Ya.lookAt(e), Ya.updateMatrix(), this.applyMatrix4(Ya.matrix), this; + lookAt(t) { + return Zn.lookAt(t), Zn.updateMatrix(), this.applyMatrix4(Zn.matrix), this; } center() { - return this.computeBoundingBox(), this.boundingBox.getCenter(Ti).negate(), this.translate(Ti.x, Ti.y, Ti.z), this; + return this.computeBoundingBox(), this.boundingBox.getCenter(ti).negate(), this.translate(ti.x, ti.y, ti.z), this; } - setFromPoints(e) { - let t = []; - for(let n = 0, i = e.length; n < i; n++){ - let r = e[n]; - t.push(r.x, r.y, r.z || 0); + setFromPoints(t) { + let e = this.getAttribute("position"); + if (e === void 0) { + let i = []; + for(let s = 0, n = t.length; s < n; s++){ + let r = t[s]; + i.push(r.x, r.y, r.z || 0); + } + this.setAttribute("position", new E(i, 3)); + } else { + let i = Math.min(t.length, e.count); + for(let s = 0; s < i; s++){ + let n = t[s]; + e.setXYZ(s, n.x, n.y, n.z || 0); + } + t.length > e.count && console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."), e.needsUpdate = !0; } - return this.setAttribute("position", new ve(t, 3)), this; + return this; } computeBoundingBox() { - this.boundingBox === null && (this.boundingBox = new Qt); - let e = this.attributes.position, t = this.morphAttributes.position; - if (e && e.isGLBufferAttribute) { - console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingBox.set(new A(-1 / 0, -1 / 0, -1 / 0), new A(1 / 0, 1 / 0, 1 / 0)); + this.boundingBox === null && (this.boundingBox = new ft); + let t = this.attributes.position, e = this.morphAttributes.position; + if (t && t.isGLBufferAttribute) { + console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.", this), this.boundingBox.set(new w(-1 / 0, -1 / 0, -1 / 0), new w(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++){ - let r = t[n]; - Vt.setFromBufferAttribute(r), this.morphTargetsRelative ? (xt.addVectors(this.boundingBox.min, Vt.min), this.boundingBox.expandByPoint(xt), xt.addVectors(this.boundingBox.max, Vt.max), this.boundingBox.expandByPoint(xt)) : (this.boundingBox.expandByPoint(Vt.min), this.boundingBox.expandByPoint(Vt.max)); + if (t !== void 0) { + if (this.boundingBox.setFromBufferAttribute(t), e) for(let i = 0, s = e.length; i < s; i++){ + let n = e[i]; + St.setFromBufferAttribute(n), this.morphTargetsRelative ? (rt.addVectors(this.boundingBox.min, St.min), this.boundingBox.expandByPoint(rt), rt.addVectors(this.boundingBox.max, St.max), this.boundingBox.expandByPoint(rt)) : (this.boundingBox.expandByPoint(St.min), this.boundingBox.expandByPoint(St.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 Yt); - let e = this.attributes.position, t = this.morphAttributes.position; - if (e && e.isGLBufferAttribute) { - console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingSphere.set(new A, 1 / 0); + this.boundingSphere === null && (this.boundingSphere = new ht); + let t = this.attributes.position, e = this.morphAttributes.position; + if (t && t.isGLBufferAttribute) { + console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this), this.boundingSphere.set(new w, 1 / 0); return; } - if (e) { - let n = this.boundingSphere.center; - if (Vt.setFromBufferAttribute(e), t) for(let r = 0, a = t.length; r < a; r++){ - let o = t[r]; - us.setFromBufferAttribute(o), this.morphTargetsRelative ? (xt.addVectors(Vt.min, us.min), Vt.expandByPoint(xt), xt.addVectors(Vt.max, us.max), Vt.expandByPoint(xt)) : (Vt.expandByPoint(us.min), Vt.expandByPoint(us.max)); + if (t) { + let i = this.boundingSphere.center; + if (St.setFromBufferAttribute(t), e) for(let n = 0, r = e.length; n < r; n++){ + let o = e[n]; + Ii.setFromBufferAttribute(o), this.morphTargetsRelative ? (rt.addVectors(St.min, Ii.min), St.expandByPoint(rt), rt.addVectors(St.max, Ii.max), St.expandByPoint(rt)) : (St.expandByPoint(Ii.min), St.expandByPoint(Ii.max)); } - Vt.getCenter(n); - let i = 0; - for(let r = 0, a = e.count; r < a; r++)xt.fromBufferAttribute(e, r), i = Math.max(i, n.distanceToSquared(xt)); - if (t) for(let r = 0, a = t.length; r < a; r++){ - let o = t[r], c = this.morphTargetsRelative; - for(let l = 0, h = o.count; l < h; l++)xt.fromBufferAttribute(o, l), c && (Ti.fromBufferAttribute(e, l), xt.add(Ti)), i = Math.max(i, n.distanceToSquared(xt)); + St.getCenter(i); + let s = 0; + for(let n = 0, r = t.count; n < r; n++)rt.fromBufferAttribute(t, n), s = Math.max(s, i.distanceToSquared(rt)); + if (e) for(let n = 0, r = e.length; n < r; n++){ + let o = e[n], a = this.morphTargetsRelative; + for(let l = 0, c = o.count; l < c; l++)rt.fromBufferAttribute(o, l), a && (ti.fromBufferAttribute(t, l), rt.add(ti)), s = Math.max(s, i.distanceToSquared(rt)); } - 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); + this.boundingSphere.radius = Math.sqrt(s), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); } } computeTangents() { - let e = this.index, t = this.attributes; - if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) { + let t = this.index, e = this.attributes; + if (t === null || e.position === void 0 || e.normal === void 0 || e.uv === void 0) { console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)"); return; } - let n = e.array, i = t.position.array, r = t.normal.array, a = t.uv.array, o = i.length / 3; - this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new et(new Float32Array(4 * o), 4)); - let c = this.getAttribute("tangent").array, l = [], h = []; - for(let T = 0; T < o; T++)l[T] = new A, h[T] = new A; - let u = new A, d = new A, f = new A, m = new Z, _ = new Z, g = new Z, p = new A, v = new A; - function x1(T, O, Y) { - u.fromArray(i, T * 3), d.fromArray(i, O * 3), f.fromArray(i, Y * 3), m.fromArray(a, T * 2), _.fromArray(a, O * 2), g.fromArray(a, Y * 2), d.sub(u), f.sub(u), _.sub(m), g.sub(m); - let $ = 1 / (_.x * g.y - g.x * _.y); - isFinite($) && (p.copy(d).multiplyScalar(g.y).addScaledVector(f, -_.y).multiplyScalar($), v.copy(f).multiplyScalar(_.x).addScaledVector(d, -g.x).multiplyScalar($), l[T].add(p), l[O].add(p), l[Y].add(p), h[T].add(v), h[O].add(v), h[Y].add(v)); - } - let y1 = this.groups; - y1.length === 0 && (y1 = [ + let i = e.position, s = e.normal, n = e.uv; + this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new Z(new Float32Array(4 * i.count), 4)); + let r = this.getAttribute("tangent"), o = [], a = []; + for(let A = 0; A < i.count; A++)o[A] = new w, a[A] = new w; + let l = new w, c = new w, u = new w, d = new T, p = new T, f = new T, m = new w, y1 = new w; + function g(A, I, C) { + l.fromBufferAttribute(i, A), c.fromBufferAttribute(i, I), u.fromBufferAttribute(i, C), d.fromBufferAttribute(n, A), p.fromBufferAttribute(n, I), f.fromBufferAttribute(n, C), c.sub(l), u.sub(l), p.sub(d), f.sub(d); + let k = 1 / (p.x * f.y - f.x * p.y); + isFinite(k) && (m.copy(c).multiplyScalar(f.y).addScaledVector(u, -p.y).multiplyScalar(k), y1.copy(u).multiplyScalar(p.x).addScaledVector(c, -f.x).multiplyScalar(k), o[A].add(m), o[I].add(m), o[C].add(m), a[A].add(y1), a[I].add(y1), a[C].add(y1)); + } + let x1 = this.groups; + x1.length === 0 && (x1 = [ { start: 0, - count: n.length + count: t.count } ]); - for(let T = 0, O = y1.length; T < O; ++T){ - let Y = y1[T], $ = Y.start, U = Y.count; - for(let z = $, q = $ + U; z < q; z += 3)x1(n[z + 0], n[z + 1], n[z + 2]); + for(let A = 0, I = x1.length; A < I; ++A){ + let C = x1[A], k = C.start, U = C.count; + for(let W = k, H = k + U; W < H; W += 3)g(t.getX(W + 0), t.getX(W + 1), t.getX(W + 2)); } - let b = new A, w = new A, R = new A, I = new A; - function M(T) { - R.fromArray(r, T * 3), I.copy(R); - let O = l[T]; - b.copy(O), b.sub(R.multiplyScalar(R.dot(O))).normalize(), w.crossVectors(I, O); - let $ = w.dot(h[T]) < 0 ? -1 : 1; - c[T * 4] = b.x, c[T * 4 + 1] = b.y, c[T * 4 + 2] = b.z, c[T * 4 + 3] = $; + let b = new w, M = new w, _ = new w, v = new w; + function S(A) { + _.fromBufferAttribute(s, A), v.copy(_); + let I = o[A]; + b.copy(I), b.sub(_.multiplyScalar(_.dot(I))).normalize(), M.crossVectors(v, I); + let k = M.dot(a[A]) < 0 ? -1 : 1; + r.setXYZW(A, b.x, b.y, b.z, k); } - for(let T = 0, O = y1.length; T < O; ++T){ - let Y = y1[T], $ = Y.start, U = Y.count; - for(let z = $, q = $ + U; z < q; z += 3)M(n[z + 0]), M(n[z + 1]), M(n[z + 2]); + for(let A = 0, I = x1.length; A < I; ++A){ + let C = x1[A], k = C.start, U = C.count; + for(let W = k, H = k + U; W < H; W += 3)S(t.getX(W + 0)), S(t.getX(W + 1)), S(t.getX(W + 2)); } } computeVertexNormals() { - let e = this.index, t = this.getAttribute("position"); - if (t !== void 0) { - let n = this.getAttribute("normal"); - if (n === void 0) n = new et(new Float32Array(t.count * 3), 3), this.setAttribute("normal", n); - else for(let d = 0, f = n.count; d < f; d++)n.setXYZ(d, 0, 0, 0); - let i = new A, r = new A, a = new A, o = new A, c = new A, l = new A, h = new A, u = new A; - if (e) for(let d = 0, f = e.count; d < f; d += 3){ - let m = e.getX(d + 0), _ = e.getX(d + 1), g = e.getX(d + 2); - i.fromBufferAttribute(t, m), r.fromBufferAttribute(t, _), a.fromBufferAttribute(t, g), h.subVectors(a, r), u.subVectors(i, r), h.cross(u), o.fromBufferAttribute(n, m), c.fromBufferAttribute(n, _), l.fromBufferAttribute(n, g), o.add(h), c.add(h), l.add(h), n.setXYZ(m, o.x, o.y, o.z), n.setXYZ(_, c.x, c.y, c.z), n.setXYZ(g, l.x, l.y, l.z); + let t = this.index, e = this.getAttribute("position"); + if (e !== void 0) { + let i = this.getAttribute("normal"); + if (i === void 0) i = new Z(new Float32Array(e.count * 3), 3), this.setAttribute("normal", i); + else for(let d = 0, p = i.count; d < p; d++)i.setXYZ(d, 0, 0, 0); + let s = new w, n = new w, r = new w, o = new w, a = new w, l = new w, c = new w, u = new w; + if (t) for(let d = 0, p = t.count; d < p; d += 3){ + let f = t.getX(d + 0), m = t.getX(d + 1), y1 = t.getX(d + 2); + s.fromBufferAttribute(e, f), n.fromBufferAttribute(e, m), r.fromBufferAttribute(e, y1), c.subVectors(r, n), u.subVectors(s, n), c.cross(u), o.fromBufferAttribute(i, f), a.fromBufferAttribute(i, m), l.fromBufferAttribute(i, y1), o.add(c), a.add(c), l.add(c), i.setXYZ(f, o.x, o.y, o.z), i.setXYZ(m, a.x, a.y, a.z), i.setXYZ(y1, l.x, l.y, l.z); } - else for(let d = 0, f = t.count; d < f; d += 3)i.fromBufferAttribute(t, d + 0), r.fromBufferAttribute(t, d + 1), a.fromBufferAttribute(t, d + 2), h.subVectors(a, r), u.subVectors(i, r), h.cross(u), n.setXYZ(d + 0, h.x, h.y, h.z), n.setXYZ(d + 1, h.x, h.y, h.z), n.setXYZ(d + 2, h.x, h.y, h.z); - this.normalizeNormals(), n.needsUpdate = !0; + else for(let d = 0, p = e.count; d < p; d += 3)s.fromBufferAttribute(e, d + 0), n.fromBufferAttribute(e, d + 1), r.fromBufferAttribute(e, d + 2), c.subVectors(r, n), u.subVectors(s, n), c.cross(u), i.setXYZ(d + 0, c.x, c.y, c.z), i.setXYZ(d + 1, c.x, c.y, c.z), i.setXYZ(d + 2, c.x, c.y, c.z); + this.normalizeNormals(), i.needsUpdate = !0; } } normalizeNormals() { - let e = this.attributes.normal; - for(let t = 0, n = e.count; t < n; t++)xt.fromBufferAttribute(e, t), xt.normalize(), e.setXYZ(t, xt.x, xt.y, xt.z); + let t = this.attributes.normal; + for(let e = 0, i = t.count; e < i; e++)rt.fromBufferAttribute(t, e), rt.normalize(), t.setXYZ(e, rt.x, rt.y, rt.z); } toNonIndexed() { - function e(o, c) { - let l = o.array, h = o.itemSize, u = o.normalized, d = new l.constructor(c.length * h), f = 0, m = 0; - for(let _ = 0, g = c.length; _ < g; _++){ - o.isInterleavedBufferAttribute ? f = c[_] * o.data.stride + o.offset : f = c[_] * h; - for(let p = 0; p < h; p++)d[m++] = l[f++]; + function t(o, a) { + let l = o.array, c = o.itemSize, u = o.normalized, d = new l.constructor(a.length * c), p = 0, f = 0; + for(let m = 0, y1 = a.length; m < y1; m++){ + o.isInterleavedBufferAttribute ? p = a[m] * o.data.stride + o.offset : p = a[m] * c; + for(let g = 0; g < c; g++)d[f++] = l[p++]; } - return new et(d, h, u); + return new Z(d, c, u); } if (this.index === null) return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this; - let t = new s1, n = this.index.array, i = this.attributes; - for(let o in i){ - let c = i[o], l = e(c, n); - t.setAttribute(o, l); - } - let r = this.morphAttributes; - for(let o in r){ - let c = [], l = r[o]; - for(let h = 0, u = l.length; h < u; h++){ - let d = l[h], f = e(d, n); - c.push(f); - } - t.morphAttributes[o] = c; - } - t.morphTargetsRelative = this.morphTargetsRelative; - let a = this.groups; - for(let o = 0, c = a.length; o < c; o++){ - let l = a[o]; - t.addGroup(l.start, l.count, l.materialIndex); + let e = new h, i = this.index.array, s = this.attributes; + for(let o in s){ + let a = s[o], l = t(a, i); + e.setAttribute(o, l); + } + let n = this.morphAttributes; + for(let o in n){ + let a = [], l = n[o]; + for(let c = 0, u = l.length; c < u; c++){ + let d = l[c], p = t(d, i); + a.push(p); + } + e.morphAttributes[o] = a; + } + e.morphTargetsRelative = this.morphTargetsRelative; + let r = this.groups; + for(let o = 0, a = r.length; o < a; o++){ + let l = r[o]; + e.addGroup(l.start, l.count, l.materialIndex); } - return t; + return e; } toJSON() { - let e = { + let t = { metadata: { version: 4.6, type: "BufferGeometry", generator: "BufferGeometry.toJSON" } }; - if (e.uuid = this.uuid, e.type = this.type, this.name !== "" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0) { - let c = this.parameters; - for(let l in c)c[l] !== void 0 && (e[l] = c[l]); - return e; + if (t.uuid = this.uuid, t.type = this.type, this.name !== "" && (t.name = this.name), Object.keys(this.userData).length > 0 && (t.userData = this.userData), this.parameters !== void 0) { + let a = this.parameters; + for(let l in a)a[l] !== void 0 && (t[l] = a[l]); + return t; } - e.data = { + t.data = { attributes: {} }; - let t = this.index; - t !== null && (e.data.index = { - type: t.array.constructor.name, - array: Array.prototype.slice.call(t.array) + let e = this.index; + e !== null && (t.data.index = { + type: e.array.constructor.name, + array: Array.prototype.slice.call(e.array) }); - let n = this.attributes; - for(let c in n){ - let l = n[c]; - e.data.attributes[c] = l.toJSON(e.data); - } - let i = {}, r = !1; - for(let c in this.morphAttributes){ - let l = this.morphAttributes[c], h = []; + let i = this.attributes; + for(let a in i){ + let l = i[a]; + t.data.attributes[a] = l.toJSON(t.data); + } + let s = {}, n = !1; + for(let a in this.morphAttributes){ + let l = this.morphAttributes[a], c = []; for(let u = 0, d = l.length; u < d; u++){ - let f = l[u]; - h.push(f.toJSON(e.data)); + let p = l[u]; + c.push(p.toJSON(t.data)); } - h.length > 0 && (i[c] = h, r = !0); + c.length > 0 && (s[a] = c, n = !0); } - r && (e.data.morphAttributes = i, e.data.morphTargetsRelative = this.morphTargetsRelative); - let a = this.groups; - a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a))); + n && (t.data.morphAttributes = s, t.data.morphTargetsRelative = this.morphTargetsRelative); + let r = this.groups; + r.length > 0 && (t.data.groups = JSON.parse(JSON.stringify(r))); let o = this.boundingSphere; - return o !== null && (e.data.boundingSphere = { + return o !== null && (t.data.boundingSphere = { center: o.center.toArray(), radius: o.radius - }), e; + }), t; } clone() { return new this.constructor().copy(this); } - copy(e) { + copy(t) { this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null; - let t = {}; - this.name = e.name; - let n = e.index; - n !== null && this.setIndex(n.clone(t)); - let i = e.attributes; - for(let l in i){ - let h = i[l]; - this.setAttribute(l, h.clone(t)); - } - let r = e.morphAttributes; - for(let l in r){ - let h = [], u = r[l]; - for(let d = 0, f = u.length; d < f; d++)h.push(u[d].clone(t)); - this.morphAttributes[l] = h; - } - this.morphTargetsRelative = e.morphTargetsRelative; - let a = e.groups; - for(let l = 0, h = a.length; l < h; l++){ - let u = a[l]; + let e = {}; + this.name = t.name; + let i = t.index; + i !== null && this.setIndex(i.clone(e)); + let s = t.attributes; + for(let l in s){ + let c = s[l]; + this.setAttribute(l, c.clone(e)); + } + let n = t.morphAttributes; + for(let l in n){ + let c = [], u = n[l]; + for(let d = 0, p = u.length; d < p; d++)c.push(u[d].clone(e)); + this.morphAttributes[l] = c; + } + this.morphTargetsRelative = t.morphTargetsRelative; + let r = t.groups; + for(let l = 0, c = r.length; l < c; l++){ + let u = r[l]; this.addGroup(u.start, u.count, u.materialIndex); } - let o = e.boundingBox; + let o = t.boundingBox; o !== null && (this.boundingBox = o.clone()); - let c = e.boundingSphere; - return c !== null && (this.boundingSphere = c.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this; + let a = t.boundingSphere; + return a !== null && (this.boundingSphere = a.clone()), this.drawRange.start = t.drawRange.start, this.drawRange.count = t.drawRange.count, this.userData = t.userData, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } -}, rh = new ze, qn = new hi, js = new Yt, ah = new A, wi = new A, Ai = new A, Ri = new A, Za = new A, er = new A, tr = new Z, nr = new Z, ir = new Z, oh = new A, ch = new A, lh = new A, sr = new A, rr = new A, Mt = class extends Je { - constructor(e = new Ge, t = new Sn){ - super(), this.isMesh = !0, this.type = "Mesh", this.geometry = e, this.material = t, this.updateMorphTargets(); +}, Ea = new D, Ce = new Le, ds = new ht, Ra = new w, ps = new w, fs = new w, ms = new w, Yn = new w, ys = new w, ka = new w, gs = new w, Ct = class extends G { + constructor(t = new L, e = new _e){ + super(), this.isMesh = !0, this.type = "Mesh", this.geometry = t, this.material = e, this.updateMorphTargets(); } - copy(e, t) { - return super.copy(e, t), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this; + copy(t, e) { + return super.copy(t, e), t.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = t.morphTargetInfluences.slice()), t.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, t.morphTargetDictionary)), this.material = Array.isArray(t.material) ? t.material.slice() : t.material, this.geometry = t.geometry, this; } updateMorphTargets() { - let t = this.geometry.morphAttributes, n = Object.keys(t); - if (n.length > 0) { - let i = t[n[0]]; - if (i !== void 0) { + let e = this.geometry.morphAttributes, i = Object.keys(e); + if (i.length > 0) { + let s = e[i[0]]; + if (s !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; - for(let r = 0, a = i.length; r < a; r++){ - let o = i[r].name || String(r); - this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r; + for(let n = 0, r = s.length; n < r; n++){ + let o = s[n].name || String(n); + this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = n; } } } } - getVertexPosition(e, t) { - let n = this.geometry, i = n.attributes.position, r = n.morphAttributes.position, a = n.morphTargetsRelative; - t.fromBufferAttribute(i, e); + getVertexPosition(t, e) { + let i = this.geometry, s = i.attributes.position, n = i.morphAttributes.position, r = i.morphTargetsRelative; + e.fromBufferAttribute(s, t); let o = this.morphTargetInfluences; - if (r && o) { - er.set(0, 0, 0); - for(let c = 0, l = r.length; c < l; c++){ - let h = o[c], u = r[c]; - h !== 0 && (Za.fromBufferAttribute(u, e), a ? er.addScaledVector(Za, h) : er.addScaledVector(Za.sub(t), h)); + if (n && o) { + ys.set(0, 0, 0); + for(let a = 0, l = n.length; a < l; a++){ + let c = o[a], u = n[a]; + c !== 0 && (Yn.fromBufferAttribute(u, t), r ? ys.addScaledVector(Yn, c) : ys.addScaledVector(Yn.sub(e), c)); } - t.add(er); + e.add(ys); } - return t; + return e; } - raycast(e, t) { - let n = this.geometry, i = this.material, r = this.matrixWorld; - i !== void 0 && (n.boundingSphere === null && n.computeBoundingSphere(), js.copy(n.boundingSphere), js.applyMatrix4(r), qn.copy(e.ray).recast(e.near), !(js.containsPoint(qn.origin) === !1 && (qn.intersectSphere(js, ah) === null || qn.origin.distanceToSquared(ah) > (e.far - e.near) ** 2)) && (rh.copy(r).invert(), qn.copy(e.ray).applyMatrix4(rh), !(n.boundingBox !== null && qn.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, qn))); + raycast(t, e) { + let i = this.geometry, s = this.material, n = this.matrixWorld; + s !== void 0 && (i.boundingSphere === null && i.computeBoundingSphere(), ds.copy(i.boundingSphere), ds.applyMatrix4(n), Ce.copy(t.ray).recast(t.near), !(ds.containsPoint(Ce.origin) === !1 && (Ce.intersectSphere(ds, Ra) === null || Ce.origin.distanceToSquared(Ra) > (t.far - t.near) ** 2)) && (Ea.copy(n).invert(), Ce.copy(t.ray).applyMatrix4(Ea), !(i.boundingBox !== null && Ce.intersectsBox(i.boundingBox) === !1) && this._computeIntersections(t, e, Ce))); } - _computeIntersections(e, t, n) { - let i, r = this.geometry, a = this.material, o = r.index, c = r.attributes.position, l = r.attributes.uv, h = r.attributes.uv1, u = r.attributes.normal, d = r.groups, f = r.drawRange; - if (o !== null) if (Array.isArray(a)) for(let m = 0, _ = d.length; m < _; m++){ - let g = d[m], p = a[g.materialIndex], v = Math.max(g.start, f.start), x1 = Math.min(o.count, Math.min(g.start + g.count, f.start + f.count)); - for(let y1 = v, b = x1; y1 < b; y1 += 3){ - let w = o.getX(y1), R = o.getX(y1 + 1), I = o.getX(y1 + 2); - i = ar(this, p, e, n, l, h, u, w, R, I), i && (i.faceIndex = Math.floor(y1 / 3), i.face.materialIndex = g.materialIndex, t.push(i)); + _computeIntersections(t, e, i) { + let s, n = this.geometry, r = this.material, o = n.index, a = n.attributes.position, l = n.attributes.uv, c = n.attributes.uv1, u = n.attributes.normal, d = n.groups, p = n.drawRange; + if (o !== null) if (Array.isArray(r)) for(let f = 0, m = d.length; f < m; f++){ + let y1 = d[f], g = r[y1.materialIndex], x1 = Math.max(y1.start, p.start), b = Math.min(o.count, Math.min(y1.start + y1.count, p.start + p.count)); + for(let M = x1, _ = b; M < _; M += 3){ + let v = o.getX(M), S = o.getX(M + 1), A = o.getX(M + 2); + s = xs(this, g, t, i, l, c, u, v, S, A), s && (s.faceIndex = Math.floor(M / 3), s.face.materialIndex = y1.materialIndex, e.push(s)); } } else { - let m = Math.max(0, f.start), _ = Math.min(o.count, f.start + f.count); - for(let g = m, p = _; g < p; g += 3){ - let v = o.getX(g), x1 = o.getX(g + 1), y1 = o.getX(g + 2); - i = ar(this, a, e, n, l, h, u, v, x1, y1), i && (i.faceIndex = Math.floor(g / 3), t.push(i)); + let f = Math.max(0, p.start), m = Math.min(o.count, p.start + p.count); + for(let y1 = f, g = m; y1 < g; y1 += 3){ + let x1 = o.getX(y1), b = o.getX(y1 + 1), M = o.getX(y1 + 2); + s = xs(this, r, t, i, l, c, u, x1, b, M), s && (s.faceIndex = Math.floor(y1 / 3), e.push(s)); } } - else if (c !== void 0) if (Array.isArray(a)) for(let m = 0, _ = d.length; m < _; m++){ - let g = d[m], p = a[g.materialIndex], v = Math.max(g.start, f.start), x1 = Math.min(c.count, Math.min(g.start + g.count, f.start + f.count)); - for(let y1 = v, b = x1; y1 < b; y1 += 3){ - let w = y1, R = y1 + 1, I = y1 + 2; - i = ar(this, p, e, n, l, h, u, w, R, I), i && (i.faceIndex = Math.floor(y1 / 3), i.face.materialIndex = g.materialIndex, t.push(i)); + else if (a !== void 0) if (Array.isArray(r)) for(let f = 0, m = d.length; f < m; f++){ + let y1 = d[f], g = r[y1.materialIndex], x1 = Math.max(y1.start, p.start), b = Math.min(a.count, Math.min(y1.start + y1.count, p.start + p.count)); + for(let M = x1, _ = b; M < _; M += 3){ + let v = M, S = M + 1, A = M + 2; + s = xs(this, g, t, i, l, c, u, v, S, A), s && (s.faceIndex = Math.floor(M / 3), s.face.materialIndex = y1.materialIndex, e.push(s)); } } else { - let m = Math.max(0, f.start), _ = Math.min(c.count, f.start + f.count); - for(let g = m, p = _; g < p; g += 3){ - let v = g, x1 = g + 1, y1 = g + 2; - i = ar(this, a, e, n, l, h, u, v, x1, y1), i && (i.faceIndex = Math.floor(g / 3), t.push(i)); + let f = Math.max(0, p.start), m = Math.min(a.count, p.start + p.count); + for(let y1 = f, g = m; y1 < g; y1 += 3){ + let x1 = y1, b = y1 + 1, M = y1 + 2; + s = xs(this, r, t, i, l, c, u, x1, b, M), s && (s.faceIndex = Math.floor(y1 / 3), e.push(s)); } } } }; -function gp(s1, e, t, n, i, r, a, o) { - let c; - if (e.side === Ft ? c = n.intersectTriangle(a, r, i, !0, o) : c = n.intersectTriangle(i, r, a, e.side === Bn, o), c === null) return null; - rr.copy(o), rr.applyMatrix4(s1.matrixWorld); - let l = t.ray.origin.distanceTo(rr); - return l < t.near || l > t.far ? null : { +function Tu(h, t, e, i, s, n, r, o) { + let a; + if (t.side === Al ? a = i.intersectTriangle(r, n, s, !0, o) : a = i.intersectTriangle(s, n, r, t.side === dr, o), a === null) return null; + gs.copy(o), gs.applyMatrix4(h.matrixWorld); + let l = e.ray.origin.distanceTo(gs); + return l < e.near || l > e.far ? null : { distance: l, - point: rr.clone(), - object: s1 + point: gs.clone(), + object: h }; } -function ar(s1, e, t, n, i, r, a, o, c, l) { - s1.getVertexPosition(o, wi), s1.getVertexPosition(c, Ai), s1.getVertexPosition(l, Ri); - let h = gp(s1, e, t, n, wi, Ai, Ri, sr); - if (h) { - i && (tr.fromBufferAttribute(i, o), nr.fromBufferAttribute(i, c), ir.fromBufferAttribute(i, l), h.uv = Un.getInterpolation(sr, wi, Ai, Ri, tr, nr, ir, new Z)), r && (tr.fromBufferAttribute(r, o), nr.fromBufferAttribute(r, c), ir.fromBufferAttribute(r, l), h.uv1 = Un.getInterpolation(sr, wi, Ai, Ri, tr, nr, ir, new Z), h.uv2 = h.uv1), a && (oh.fromBufferAttribute(a, o), ch.fromBufferAttribute(a, c), lh.fromBufferAttribute(a, l), h.normal = Un.getInterpolation(sr, wi, Ai, Ri, oh, ch, lh, new A), h.normal.dot(n.direction) > 0 && h.normal.multiplyScalar(-1)); - let u = { +function xs(h, t, e, i, s, n, r, o, a, l) { + h.getVertexPosition(o, ps), h.getVertexPosition(a, fs), h.getVertexPosition(l, ms); + let c = Tu(h, t, e, i, ps, fs, ms, ka); + if (c) { + let u = new w; + ne.getBarycoord(ka, ps, fs, ms, u), s && (c.uv = ne.getInterpolatedAttribute(s, o, a, l, u, new T)), n && (c.uv1 = ne.getInterpolatedAttribute(n, o, a, l, u, new T)), r && (c.normal = ne.getInterpolatedAttribute(r, o, a, l, u, new w), c.normal.dot(i.direction) > 0 && c.normal.multiplyScalar(-1)); + let d = { a: o, - b: c, + b: a, c: l, - normal: new A, + normal: new w, materialIndex: 0 }; - Un.getNormal(wi, Ai, Ri, u.normal), h.face = u; + ne.getNormal(ps, fs, ms, d.normal), c.face = d, c.barycoord = u; } - return h; + return c; } -var Ji = class s1 extends Ge { - constructor(e = 1, t = 1, n = 1, i = 1, r = 1, a = 1){ +var Ks = class h extends L { + constructor(t = 1, e = 1, i = 1, s = 1, n = 1, r = 1){ super(), this.type = "BoxGeometry", this.parameters = { - width: e, - height: t, - depth: n, - widthSegments: i, - heightSegments: r, - depthSegments: a + width: t, + height: e, + depth: i, + widthSegments: s, + heightSegments: n, + depthSegments: r }; let o = this; - i = Math.floor(i), r = Math.floor(r), a = Math.floor(a); - let c = [], l = [], h = [], u = [], d = 0, f = 0; - m("z", "y", "x", -1, -1, n, t, e, a, r, 0), m("z", "y", "x", 1, -1, n, t, -e, a, r, 1), m("x", "z", "y", 1, 1, e, n, t, i, a, 2), m("x", "z", "y", 1, -1, e, n, -t, i, a, 3), m("x", "y", "z", 1, -1, e, t, n, i, r, 4), m("x", "y", "z", -1, -1, e, t, -n, i, r, 5), this.setIndex(c), this.setAttribute("position", new ve(l, 3)), this.setAttribute("normal", new ve(h, 3)), this.setAttribute("uv", new ve(u, 2)); - function m(_, g, p, v, x1, y1, b, w, R, I, M) { - let T = y1 / R, O = b / I, Y = y1 / 2, $ = b / 2, U = w / 2, z = R + 1, q = I + 1, H = 0, ne = 0, W = new A; - for(let K = 0; K < q; K++){ - let D = K * O - $; - for(let G = 0; G < z; G++){ - let he = G * T - Y; - W[_] = he * v, W[g] = D * x1, W[p] = U, l.push(W.x, W.y, W.z), W[_] = 0, W[g] = 0, W[p] = w > 0 ? 1 : -1, h.push(W.x, W.y, W.z), u.push(G / R), u.push(1 - K / I), H += 1; + s = Math.floor(s), n = Math.floor(n), r = Math.floor(r); + let a = [], l = [], c = [], u = [], d = 0, p = 0; + f("z", "y", "x", -1, -1, i, e, t, r, n, 0), f("z", "y", "x", 1, -1, i, e, -t, r, n, 1), f("x", "z", "y", 1, 1, t, i, e, s, r, 2), f("x", "z", "y", 1, -1, t, i, -e, s, r, 3), f("x", "y", "z", 1, -1, t, e, i, s, n, 4), f("x", "y", "z", -1, -1, t, e, -i, s, n, 5), this.setIndex(a), this.setAttribute("position", new E(l, 3)), this.setAttribute("normal", new E(c, 3)), this.setAttribute("uv", new E(u, 2)); + function f(m, y1, g, x1, b, M, _, v, S, A, I) { + let C = M / S, k = _ / A, U = M / 2, W = _ / 2, H = v / 2, Y = S + 1, Q = A + 1, zt = 0, Pt = 0, j = new w; + for(let st = 0; st < Q; st++){ + let K = st * k - W; + for(let Ot = 0; Ot < Y; Ot++){ + let Se = Ot * C - U; + j[m] = Se * x1, j[y1] = K * b, j[g] = H, l.push(j.x, j.y, j.z), j[m] = 0, j[y1] = 0, j[g] = v > 0 ? 1 : -1, c.push(j.x, j.y, j.z), u.push(Ot / S), u.push(1 - st / A), zt += 1; } } - for(let K = 0; K < I; K++)for(let D = 0; D < R; D++){ - let G = d + D + z * K, he = d + D + z * (K + 1), fe = d + (D + 1) + z * (K + 1), _e = d + (D + 1) + z * K; - c.push(G, he, _e), c.push(he, fe, _e), ne += 6; + for(let st = 0; st < A; st++)for(let K = 0; K < S; K++){ + let Ot = d + K + Y * st, Se = d + K + Y * (st + 1), Tn = d + (K + 1) + Y * (st + 1), es = d + (K + 1) + Y * st; + a.push(Ot, Se, es), a.push(Se, Tn, es), Pt += 6; } - o.addGroup(f, ne, M), f += ne, d += H; + o.addGroup(p, Pt, I), p += Pt, d += zt; } } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - static fromJSON(e) { - return new s1(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments); + static fromJSON(t) { + return new h(t.width, t.height, t.depth, t.widthSegments, t.heightSegments, t.depthSegments); } }; -function $i(s1) { - let e = {}; - for(let t in s1){ - e[t] = {}; - for(let n in s1[t]){ - let i = s1[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; +function An(h) { + let t = {}; + for(let e in h){ + t[e] = {}; + for(let i in h[e]){ + let s = h[e][i]; + s && (s.isColor || s.isMatrix3 || s.isMatrix4 || s.isVector2 || s.isVector3 || s.isVector4 || s.isTexture || s.isQuaternion) ? s.isRenderTargetTexture ? (console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."), t[e][i] = null) : t[e][i] = s.clone() : Array.isArray(s) ? t[e][i] = s.slice() : t[e][i] = s; } } - return e; + return t; } -function Lt(s1) { - let e = {}; - for(let t = 0; t < s1.length; t++){ - let n = $i(s1[t]); - for(let i in n)e[i] = n[i]; +function Iu(h) { + let t = {}; + for(let e = 0; e < h.length; e++){ + let i = An(h[e]); + for(let s in i)t[s] = i[s]; } - return e; + return t; } -function _p(s1) { - let e = []; - for(let t = 0; t < s1.length; t++)e.push(s1[t].clone()); - return e; +function Cu(h) { + let t = []; + for(let e = 0; e < h.length; e++)t.push(h[e].clone()); + return t; } -function bd(s1) { - return s1.getRenderTarget() === null ? s1.outputColorSpace : Qe.workingColorSpace; +function Rf(h) { + let t = h.getRenderTarget(); + return t === null ? h.outputColorSpace : t.isXRRenderTarget === !0 ? t.texture.colorSpace : Tt.workingColorSpace; } -var xp = { - clone: $i, - merge: Lt -}, vp = `void main() { +var kf = { + clone: An, + merge: Iu +}, zu = `void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); -}`, yp = `void main() { +}`, Fu = `void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); -}`, jt = class extends bt { - constructor(e){ - super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = vp, this.fragmentShader = yp, 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 +}`, qi = class extends ct { + constructor(t){ + super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = zu, this.fragmentShader = Fu, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.forceSinglePass = !0, this.extensions = { + clipCullDistance: !1, + multiDraw: !1 }, this.defaultAttributeValues = { color: [ 1, @@ -3920,82 +4014,82 @@ var xp = { 0, 0 ] - }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && this.setValues(e); + }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, t !== void 0 && this.setValues(t); } - copy(e) { - return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = $i(e.uniforms), this.uniformsGroups = _p(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; + copy(t) { + return super.copy(t), this.fragmentShader = t.fragmentShader, this.vertexShader = t.vertexShader, this.uniforms = An(t.uniforms), this.uniformsGroups = Cu(t.uniformsGroups), this.defines = Object.assign({}, t.defines), this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.fog = t.fog, this.lights = t.lights, this.clipping = t.clipping, this.extensions = Object.assign({}, t.extensions), this.glslVersion = t.glslVersion, this; } - toJSON(e) { - let t = super.toJSON(e); - t.glslVersion = this.glslVersion, t.uniforms = {}; - for(let i in this.uniforms){ - let a = this.uniforms[i].value; - a && a.isTexture ? t.uniforms[i] = { + toJSON(t) { + let e = super.toJSON(t); + e.glslVersion = this.glslVersion, e.uniforms = {}; + for(let s in this.uniforms){ + let r = this.uniforms[s].value; + r && r.isTexture ? e.uniforms[s] = { type: "t", - value: a.toJSON(e).uuid - } : a && a.isColor ? t.uniforms[i] = { + value: r.toJSON(t).uuid + } : r && r.isColor ? e.uniforms[s] = { type: "c", - value: a.getHex() - } : a && a.isVector2 ? t.uniforms[i] = { + value: r.getHex() + } : r && r.isVector2 ? e.uniforms[s] = { type: "v2", - value: a.toArray() - } : a && a.isVector3 ? t.uniforms[i] = { + value: r.toArray() + } : r && r.isVector3 ? e.uniforms[s] = { type: "v3", - value: a.toArray() - } : a && a.isVector4 ? t.uniforms[i] = { + value: r.toArray() + } : r && r.isVector4 ? e.uniforms[s] = { type: "v4", - value: a.toArray() - } : a && a.isMatrix3 ? t.uniforms[i] = { + value: r.toArray() + } : r && r.isMatrix3 ? e.uniforms[s] = { type: "m3", - value: a.toArray() - } : a && a.isMatrix4 ? t.uniforms[i] = { + value: r.toArray() + } : r && r.isMatrix4 ? e.uniforms[s] = { type: "m4", - value: a.toArray() - } : t.uniforms[i] = { - value: a + value: r.toArray() + } : e.uniforms[s] = { + value: r }; } - Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader, t.lights = this.lights, t.clipping = this.clipping; - let n = {}; - for(let i in this.extensions)this.extensions[i] === !0 && (n[i] = !0); - return Object.keys(n).length > 0 && (t.extensions = n), t; + Object.keys(this.defines).length > 0 && (e.defines = this.defines), e.vertexShader = this.vertexShader, e.fragmentShader = this.fragmentShader, e.lights = this.lights, e.clipping = this.clipping; + let i = {}; + for(let s in this.extensions)this.extensions[s] === !0 && (i[s] = !0); + return Object.keys(i).length > 0 && (e.extensions = i), e; } -}, Cs = class extends Je { +}, Gi = class extends G { constructor(){ - super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new ze, this.projectionMatrix = new ze, this.projectionMatrixInverse = new ze, this.coordinateSystem = vn; + super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new D, this.projectionMatrix = new D, this.projectionMatrixInverse = new D, this.coordinateSystem = oe; } - copy(e, t) { - return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this.coordinateSystem = e.coordinateSystem, this; + copy(t, e) { + return super.copy(t, e), this.matrixWorldInverse.copy(t.matrixWorldInverse), this.projectionMatrix.copy(t.projectionMatrix), this.projectionMatrixInverse.copy(t.projectionMatrixInverse), this.coordinateSystem = t.coordinateSystem, this; } - getWorldDirection(e) { - return super.getWorldDirection(e).negate(); + getWorldDirection(t) { + return super.getWorldDirection(t).negate(); } - updateMatrixWorld(e) { - super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert(); + updateMatrixWorld(t) { + super.updateMatrixWorld(t), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } - updateWorldMatrix(e, t) { - super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert(); + updateWorldMatrix(t, e) { + super.updateWorldMatrix(t, e), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } clone() { return new this.constructor().copy(this); } -}, yt = class extends Cs { - 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(); +}, ye = new w, Pa = new T, Oa = new T, vt = class extends Gi { + constructor(t = 50, e = 1, i = .1, s = 2e3){ + super(), this.isPerspectiveCamera = !0, this.type = "PerspectiveCamera", this.fov = t, this.zoom = 1, this.near = i, this.far = s, this.focus = 10, this.aspect = e, 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; + copy(t, e) { + return super.copy(t, e), this.fov = t.fov, this.zoom = t.zoom, this.near = t.near, this.far = t.far, this.focus = t.focus, this.aspect = t.aspect, this.view = t.view === null ? null : Object.assign({}, t.view), this.filmGauge = t.filmGauge, this.filmOffset = t.filmOffset, this; } - setFocalLength(e) { - let t = .5 * this.getFilmHeight() / e; - this.fov = Zi * 2 * Math.atan(t), this.updateProjectionMatrix(); + setFocalLength(t) { + let e = .5 * this.getFilmHeight() / t; + this.fov = Ui * 2 * Math.atan(e), this.updateProjectionMatrix(); } getFocalLength() { - let e = Math.tan(ai * .5 * this.fov); - return .5 * this.getFilmHeight() / e; + let t = Math.tan(De * .5 * this.fov); + return .5 * this.getFilmHeight() / t; } getEffectiveFOV() { - return Zi * 2 * Math.atan(Math.tan(ai * .5 * this.fov) / this.zoom); + return Ui * 2 * Math.atan(Math.tan(De * .5 * this.fov) / this.zoom); } getFilmWidth() { return this.filmGauge * Math.min(this.aspect, 1); @@ -4003,8 +4097,14 @@ var xp = { getFilmHeight() { return this.filmGauge / Math.max(this.aspect, 1); } - setViewOffset(e, t, n, i, r, a) { - this.aspect = e / t, this.view === null && (this.view = { + getViewBounds(t, e, i) { + ye.set(-1, -1, .5).applyMatrix4(this.projectionMatrixInverse), e.set(ye.x, ye.y).multiplyScalar(-t / ye.z), ye.set(1, 1, .5).applyMatrix4(this.projectionMatrixInverse), i.set(ye.x, ye.y).multiplyScalar(-t / ye.z); + } + getViewSize(t, e) { + return this.getViewBounds(t, Pa, Oa), e.subVectors(Oa, Pa); + } + setViewOffset(t, e, i, s, n, r) { + this.aspect = t / e, this.view === null && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, @@ -4012,87 +4112,87 @@ var xp = { offsetY: 0, width: 1, height: 1 - }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix(); + }), this.view.enabled = !0, this.view.fullWidth = t, this.view.fullHeight = e, this.view.offsetX = i, this.view.offsetY = s, this.view.width = n, this.view.height = r, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { - let e = this.near, t = e * Math.tan(ai * .5 * this.fov) / this.zoom, n = 2 * t, i = this.aspect * n, r = -.5 * i, a = this.view; + let t = this.near, e = t * Math.tan(De * .5 * this.fov) / this.zoom, i = 2 * e, s = this.aspect * i, n = -.5 * s, r = this.view; if (this.view !== null && this.view.enabled) { - let c = a.fullWidth, l = a.fullHeight; - r += a.offsetX * i / c, t -= a.offsetY * n / l, i *= a.width / c, n *= a.height / l; + let a = r.fullWidth, l = r.fullHeight; + n += r.offsetX * s / a, e -= r.offsetY * i / l, s *= r.width / a, i *= r.height / l; } let o = this.filmOffset; - o !== 0 && (r += e * o / this.getFilmWidth()), this.projectionMatrix.makePerspective(r, r + i, t, t - n, e, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(e) { - let 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; - } -}, Ci = -90, Pi = 1, _o = class extends Je { - constructor(e, t, n){ - super(), this.type = "CubeCamera", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0; - let i = new yt(Ci, Pi, e, t); - i.layers = this.layers, this.add(i); - let r = new yt(Ci, Pi, e, t); + o !== 0 && (n += t * o / this.getFilmWidth()), this.projectionMatrix.makePerspective(n, n + s, e, e - i, t, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); + } + toJSON(t) { + let e = super.toJSON(t); + return e.object.fov = this.fov, e.object.zoom = this.zoom, e.object.near = this.near, e.object.far = this.far, e.object.focus = this.focus, e.object.aspect = this.aspect, this.view !== null && (e.object.view = Object.assign({}, this.view)), e.object.filmGauge = this.filmGauge, e.object.filmOffset = this.filmOffset, e; + } +}, ei = -90, ii = 1, br = class extends G { + constructor(t, e, i){ + super(), this.type = "CubeCamera", this.renderTarget = i, this.coordinateSystem = null, this.activeMipmapLevel = 0; + let s = new vt(ei, ii, t, e); + s.layers = this.layers, this.add(s); + let n = new vt(ei, ii, t, e); + n.layers = this.layers, this.add(n); + let r = new vt(ei, ii, t, e); r.layers = this.layers, this.add(r); - let a = new yt(Ci, Pi, e, t); - a.layers = this.layers, this.add(a); - let o = new yt(Ci, Pi, e, t); + let o = new vt(ei, ii, t, e); o.layers = this.layers, this.add(o); - let c = new yt(Ci, Pi, e, t); - c.layers = this.layers, this.add(c); - let l = new yt(Ci, Pi, e, t); + let a = new vt(ei, ii, t, e); + a.layers = this.layers, this.add(a); + let l = new vt(ei, ii, t, e); l.layers = this.layers, this.add(l); } updateCoordinateSystem() { - let e = this.coordinateSystem, t = this.children.concat(), [n, i, r, a, o, c] = t; - for (let l of t)this.remove(l); - if (e === vn) n.up.set(0, 1, 0), n.lookAt(1, 0, 0), i.up.set(0, 1, 0), i.lookAt(-1, 0, 0), r.up.set(0, 0, -1), r.lookAt(0, 1, 0), a.up.set(0, 0, 1), a.lookAt(0, -1, 0), o.up.set(0, 1, 0), o.lookAt(0, 0, 1), c.up.set(0, 1, 0), c.lookAt(0, 0, -1); - else if (e === Gr) n.up.set(0, -1, 0), n.lookAt(-1, 0, 0), i.up.set(0, -1, 0), i.lookAt(1, 0, 0), r.up.set(0, 0, 1), r.lookAt(0, 1, 0), a.up.set(0, 0, -1), a.lookAt(0, -1, 0), o.up.set(0, -1, 0), o.lookAt(0, 0, 1), c.up.set(0, -1, 0), c.lookAt(0, 0, -1); - else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + e); - for (let l of t)this.add(l), l.updateMatrixWorld(); - } - update(e, t) { + let t = this.coordinateSystem, e = this.children.concat(), [i, s, n, r, o, a] = e; + for (let l of e)this.remove(l); + if (t === oe) i.up.set(0, 1, 0), i.lookAt(1, 0, 0), s.up.set(0, 1, 0), s.lookAt(-1, 0, 0), n.up.set(0, 0, -1), n.lookAt(0, 1, 0), r.up.set(0, 0, 1), r.lookAt(0, -1, 0), o.up.set(0, 1, 0), o.lookAt(0, 0, 1), a.up.set(0, 1, 0), a.lookAt(0, 0, -1); + else if (t === Zs) i.up.set(0, -1, 0), i.lookAt(-1, 0, 0), s.up.set(0, -1, 0), s.lookAt(1, 0, 0), n.up.set(0, 0, 1), n.lookAt(0, 1, 0), r.up.set(0, 0, -1), r.lookAt(0, -1, 0), o.up.set(0, -1, 0), o.lookAt(0, 0, 1), a.up.set(0, -1, 0), a.lookAt(0, 0, -1); + else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + t); + for (let l of e)this.add(l), l.updateMatrixWorld(); + } + update(t, e) { this.parent === null && this.updateMatrixWorld(); - let { renderTarget: n , activeMipmapLevel: i } = this; - this.coordinateSystem !== e.coordinateSystem && (this.coordinateSystem = e.coordinateSystem, this.updateCoordinateSystem()); - let [r, a, o, c, l, h] = this.children, u = e.getRenderTarget(), d = e.getActiveCubeFace(), f = e.getActiveMipmapLevel(), m = e.xr.enabled; - e.xr.enabled = !1; - let _ = n.texture.generateMipmaps; - n.texture.generateMipmaps = !1, e.setRenderTarget(n, 0, i), e.render(t, r), e.setRenderTarget(n, 1, i), e.render(t, a), e.setRenderTarget(n, 2, i), e.render(t, o), e.setRenderTarget(n, 3, i), e.render(t, c), e.setRenderTarget(n, 4, i), e.render(t, l), n.texture.generateMipmaps = _, e.setRenderTarget(n, 5, i), e.render(t, h), e.setRenderTarget(u, d, f), e.xr.enabled = m, n.texture.needsPMREMUpdate = !0; + let { renderTarget: i , activeMipmapLevel: s } = this; + this.coordinateSystem !== t.coordinateSystem && (this.coordinateSystem = t.coordinateSystem, this.updateCoordinateSystem()); + let [n, r, o, a, l, c] = this.children, u = t.getRenderTarget(), d = t.getActiveCubeFace(), p = t.getActiveMipmapLevel(), f = t.xr.enabled; + t.xr.enabled = !1; + let m = i.texture.generateMipmaps; + i.texture.generateMipmaps = !1, t.setRenderTarget(i, 0, s), t.render(e, n), t.setRenderTarget(i, 1, s), t.render(e, r), t.setRenderTarget(i, 2, s), t.render(e, o), t.setRenderTarget(i, 3, s), t.render(e, a), t.setRenderTarget(i, 4, s), t.render(e, l), i.texture.generateMipmaps = m, t.setRenderTarget(i, 5, s), t.render(e, c), t.setRenderTarget(u, d, p), t.xr.enabled = f, i.texture.needsPMREMUpdate = !0; } -}, Ki = class extends St { - constructor(e, t, n, i, r, a, o, c, l, h){ - e = e !== void 0 ? e : [], t = t !== void 0 ? t : zn, super(e, t, n, i, r, a, o, c, l, h), this.isCubeTexture = !0, this.flipY = !1; +}, Xi = class extends lt { + constructor(t, e, i, s, n, r, o, a, l, c){ + t = t !== void 0 ? t : [], e = e !== void 0 ? e : Uo, super(t, e, i, s, n, r, o, a, l, c), this.isCubeTexture = !0, this.flipY = !1; } get images() { return this.image; } - set images(e) { - this.image = e; + set images(t) { + this.image = t; } -}, xo = class extends qt { - constructor(e = 1, t = {}){ - super(e, e, t), this.isWebGLCubeRenderTarget = !0; - let n = { - width: e, - height: e, +}, Na = class extends Hi { + constructor(t = 1, e = {}){ + super(t, t, e), this.isWebGLCubeRenderTarget = !0; + let i = { + width: t, + height: t, depth: 1 - }, i = [ - n, - n, - n, - n, - n, - n + }, s = [ + i, + i, + i, + i, + i, + i ]; - t.encoding !== void 0 && (Ms("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."), t.colorSpace = t.encoding === ri ? vt : Xt), this.texture = new Ki(i, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : mt; + this.texture = new Xi(s, e.mapping, e.wrapS, e.wrapT, e.magFilter, e.minFilter, e.format, e.type, e.anisotropy, e.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = e.generateMipmaps !== void 0 ? e.generateMipmaps : !1, this.texture.minFilter = e.minFilter !== void 0 ? e.minFilter : Et; } - fromEquirectangularTexture(e, t) { - this.texture.type = t.type, this.texture.colorSpace = t.colorSpace, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter; - let n = { + fromEquirectangularTexture(t, e) { + this.texture.type = e.type, this.texture.colorSpace = e.colorSpace, this.texture.generateMipmaps = e.generateMipmaps, this.texture.minFilter = e.minFilter, this.texture.magFilter = e.magFilter; + let i = { uniforms: { tEquirect: { value: null @@ -4135,16032 +4235,17144 @@ var xp = { } ` - }, i = new Ji(5, 5, 5), r = new jt({ + }, s = new Ks(5, 5, 5), n = new qi({ name: "CubemapFromEquirect", - uniforms: $i(n.uniforms), - vertexShader: n.vertexShader, - fragmentShader: n.fragmentShader, - side: Ft, - blending: Dn + uniforms: An(i.uniforms), + vertexShader: i.vertexShader, + fragmentShader: i.fragmentShader, + side: Al, + blending: Ul }); - r.uniforms.tEquirect.value = t; - let a = new Mt(i, r), o = t.minFilter; - return t.minFilter === li && (t.minFilter = mt), new _o(1, 10, this).update(e, a), t.minFilter = o, a.geometry.dispose(), a.material.dispose(), this; + n.uniforms.tEquirect.value = e; + let r = new Ct(s, n), o = e.minFilter; + return e.minFilter === vn && (e.minFilter = Et), new br(1, 10, this).update(t, r), e.minFilter = o, r.geometry.dispose(), r.material.dispose(), this; + } + clear(t, e, i, s) { + let n = t.getRenderTarget(); + for(let r = 0; r < 6; r++)t.setRenderTarget(this, r), t.clear(e, i, s); + t.setRenderTarget(n); + } +}, Ne = class extends G { + constructor(){ + super(), this.isGroup = !0, this.type = "Group"; + } +}, Bu = { + type: "move" +}, Va = class { + constructor(){ + this._targetRay = null, this._grip = null, this._hand = null; + } + getHandSpace() { + return this._hand === null && (this._hand = new Ne, 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 Ne, this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new w, this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new w), this._targetRay; } - clear(e, t, n, i) { - let r = e.getRenderTarget(); - for(let a = 0; a < 6; a++)e.setRenderTarget(this, a), e.clear(t, n, i); - e.setRenderTarget(r); + getGripSpace() { + return this._grip === null && (this._grip = new Ne, this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new w, this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new w), this._grip; } -}, Ja = new A, Mp = new A, Sp = new He, mn = class { - constructor(e = new A(1, 0, 0), t = 0){ - this.isPlane = !0, this.normal = e, this.constant = t; + dispatchEvent(t) { + return this._targetRay !== null && this._targetRay.dispatchEvent(t), this._grip !== null && this._grip.dispatchEvent(t), this._hand !== null && this._hand.dispatchEvent(t), this; } - set(e, t) { - return this.normal.copy(e), this.constant = t, this; + connect(t) { + if (t && t.hand) { + let e = this._hand; + if (e) for (let i of t.hand.values())this._getHandJoint(e, i); + } + return this.dispatchEvent({ + type: "connected", + data: t + }), this; } - setComponents(e, t, n, i) { - return this.normal.set(e, t, n), this.constant = i, this; + disconnect(t) { + return this.dispatchEvent({ + type: "disconnected", + data: t + }), this._targetRay !== null && (this._targetRay.visible = !1), this._grip !== null && (this._grip.visible = !1), this._hand !== null && (this._hand.visible = !1), this; } - setFromNormalAndCoplanarPoint(e, t) { - return this.normal.copy(e), this.constant = -t.dot(this.normal), this; + update(t, e, i) { + let s = null, n = null, r = null, o = this._targetRay, a = this._grip, l = this._hand; + if (t && e.session.visibilityState !== "visible-blurred") { + if (l && t.hand) { + r = !0; + for (let m of t.hand.values()){ + let y1 = e.getJointPose(m, i), g = this._getHandJoint(l, m); + y1 !== null && (g.matrix.fromArray(y1.transform.matrix), g.matrix.decompose(g.position, g.rotation, g.scale), g.matrixWorldNeedsUpdate = !0, g.jointRadius = y1.radius), g.visible = y1 !== null; + } + let c = l.joints["index-finger-tip"], u = l.joints["thumb-tip"], d = c.position.distanceTo(u.position), p = .02, f = .005; + l.inputState.pinching && d > p + f ? (l.inputState.pinching = !1, this.dispatchEvent({ + type: "pinchend", + handedness: t.handedness, + target: this + })) : !l.inputState.pinching && d <= p - f && (l.inputState.pinching = !0, this.dispatchEvent({ + type: "pinchstart", + handedness: t.handedness, + target: this + })); + } else a !== null && t.gripSpace && (n = e.getPose(t.gripSpace, i), n !== null && (a.matrix.fromArray(n.transform.matrix), a.matrix.decompose(a.position, a.rotation, a.scale), a.matrixWorldNeedsUpdate = !0, n.linearVelocity ? (a.hasLinearVelocity = !0, a.linearVelocity.copy(n.linearVelocity)) : a.hasLinearVelocity = !1, n.angularVelocity ? (a.hasAngularVelocity = !0, a.angularVelocity.copy(n.angularVelocity)) : a.hasAngularVelocity = !1)); + o !== null && (s = e.getPose(t.targetRaySpace, i), s === null && n !== null && (s = n), s !== null && (o.matrix.fromArray(s.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, s.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(s.linearVelocity)) : o.hasLinearVelocity = !1, s.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(s.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(Bu))); + } + return o !== null && (o.visible = s !== null), a !== null && (a.visible = n !== null), l !== null && (l.visible = r !== null), this; } - setFromCoplanarPoints(e, t, n) { - let i = Ja.subVectors(n, t).cross(Mp.subVectors(e, t)).normalize(); - return this.setFromNormalAndCoplanarPoint(i, e), this; + _getHandJoint(t, e) { + if (t.joints[e.jointName] === void 0) { + let i = new Ne; + i.matrixAutoUpdate = !1, i.visible = !1, t.joints[e.jointName] = i, t.add(i); + } + return t.joints[e.jointName]; } - copy(e) { - return this.normal.copy(e.normal), this.constant = e.constant, this; +}, wr = class h { + constructor(t, e = 25e-5){ + this.isFogExp2 = !0, this.name = "", this.color = new P(t), this.density = e; } - normalize() { - let e = 1 / this.normal.length(); - return this.normal.multiplyScalar(e), this.constant *= e, this; + clone() { + return new h(this.color, this.density); } - negate() { - return this.constant *= -1, this.normal.negate(), this; + toJSON() { + return { + type: "FogExp2", + name: this.name, + color: this.color.getHex(), + density: this.density + }; + } +}, Mr = class h { + constructor(t, e = 1, i = 1e3){ + this.isFog = !0, this.name = "", this.color = new P(t), this.near = e, this.far = i; + } + clone() { + return new h(this.color, this.near, this.far); } - distanceToPoint(e) { - return this.normal.dot(e) + this.constant; + toJSON() { + return { + type: "Fog", + name: this.name, + color: this.color.getHex(), + near: this.near, + far: this.far + }; } - distanceToSphere(e) { - return this.distanceToPoint(e.center) - e.radius; +}, _r = class extends G { + constructor(){ + super(), this.isScene = !0, this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.backgroundBlurriness = 0, this.backgroundIntensity = 1, this.backgroundRotation = new Xt, this.environmentIntensity = 1, this.environmentRotation = new Xt, this.overrideMaterial = null, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { + detail: this + })); } - projectPoint(e, t) { - return t.copy(e).addScaledVector(this.normal, -this.distanceToPoint(e)); + copy(t, e) { + return super.copy(t, e), t.background !== null && (this.background = t.background.clone()), t.environment !== null && (this.environment = t.environment.clone()), t.fog !== null && (this.fog = t.fog.clone()), this.backgroundBlurriness = t.backgroundBlurriness, this.backgroundIntensity = t.backgroundIntensity, this.backgroundRotation.copy(t.backgroundRotation), this.environmentIntensity = t.environmentIntensity, this.environmentRotation.copy(t.environmentRotation), t.overrideMaterial !== null && (this.overrideMaterial = t.overrideMaterial.clone()), this.matrixAutoUpdate = t.matrixAutoUpdate, this; } - intersectLine(e, t) { - let n = e.delta(Ja), i = this.normal.dot(n); - if (i === 0) return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null; - let r = -(e.start.dot(this.normal) + this.constant) / i; - return r < 0 || r > 1 ? null : t.copy(e.start).addScaledVector(n, r); + toJSON(t) { + let e = super.toJSON(t); + return this.fog !== null && (e.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (e.object.backgroundBlurriness = this.backgroundBlurriness), this.backgroundIntensity !== 1 && (e.object.backgroundIntensity = this.backgroundIntensity), e.object.backgroundRotation = this.backgroundRotation.toArray(), this.environmentIntensity !== 1 && (e.object.environmentIntensity = this.environmentIntensity), e.object.environmentRotation = this.environmentRotation.toArray(), e; } - intersectsLine(e) { - let t = this.distanceToPoint(e.start), n = this.distanceToPoint(e.end); - return t < 0 && n > 0 || n < 0 && t > 0; +}, Ji = class { + constructor(t, e){ + this.isInterleavedBuffer = !0, this.array = t, this.stride = e, this.count = t !== void 0 ? t.length / e : 0, this.usage = Js, this.updateRanges = [], this.version = 0, this.uuid = It(); } - intersectsBox(e) { - return e.intersectsPlane(this); + onUploadCallback() {} + set needsUpdate(t) { + t === !0 && this.version++; } - intersectsSphere(e) { - return e.intersectsPlane(this); + setUsage(t) { + return this.usage = t, this; } - coplanarPoint(e) { - return e.copy(this.normal).multiplyScalar(-this.constant); + addUpdateRange(t, e) { + this.updateRanges.push({ + start: t, + count: e + }); } - applyMatrix4(e, t) { - let n = t || Sp.getNormalMatrix(e), i = this.coplanarPoint(Ja).applyMatrix4(e), r = this.normal.applyMatrix3(n).normalize(); - return this.constant = -i.dot(r), this; + clearUpdateRanges() { + this.updateRanges.length = 0; } - translate(e) { - return this.constant -= e.dot(this.normal), this; + copy(t) { + return this.array = new t.array.constructor(t.array), this.count = t.count, this.stride = t.stride, this.usage = t.usage, this; } - equals(e) { - return e.normal.equals(this.normal) && e.constant === this.constant; + copyAt(t, e, i) { + t *= this.stride, i *= e.stride; + for(let s = 0, n = this.stride; s < n; s++)this.array[t + s] = e.array[i + s]; + return this; } - clone() { - return new this.constructor().copy(this); + set(t, e = 0) { + return this.array.set(t, e), this; } -}, Yn = new Yt, or = new A, Ps = class { - constructor(e = new mn, t = new mn, n = new mn, i = new mn, r = new mn, a = new mn){ - this.planes = [ - e, - t, - n, - i, - r, - a - ]; + clone(t) { + t.arrayBuffers === void 0 && (t.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = It()), t.arrayBuffers[this.array.buffer._uuid] === void 0 && (t.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer); + let e = new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]), i = new this.constructor(e, this.stride); + return i.setUsage(this.usage), i; } - set(e, t, n, i, r, a) { - let o = this.planes; - return o[0].copy(e), o[1].copy(t), o[2].copy(n), o[3].copy(i), o[4].copy(r), o[5].copy(a), this; + onUpload(t) { + return this.onUploadCallback = t, this; } - copy(e) { - let t = this.planes; - for(let n = 0; n < 6; n++)t[n].copy(e.planes[n]); + toJSON(t) { + return t.arrayBuffers === void 0 && (t.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = It()), t.arrayBuffers[this.array.buffer._uuid] === void 0 && (t.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 + }; + } +}, gt = new w, fi = class h { + constructor(t, e, i, s = !1){ + this.isInterleavedBufferAttribute = !0, this.name = "", this.data = t, this.itemSize = e, this.offset = i, this.normalized = s; + } + get count() { + return this.data.count; + } + get array() { + return this.data.array; + } + set needsUpdate(t) { + this.data.needsUpdate = t; + } + applyMatrix4(t) { + for(let e = 0, i = this.data.count; e < i; e++)gt.fromBufferAttribute(this, e), gt.applyMatrix4(t), this.setXYZ(e, gt.x, gt.y, gt.z); return this; } - setFromProjectionMatrix(e, t = vn) { - let n = this.planes, i = e.elements, r = i[0], a = i[1], o = i[2], c = i[3], l = i[4], h = i[5], u = i[6], d = i[7], f = i[8], m = i[9], _ = i[10], g = i[11], p = i[12], v = i[13], x1 = i[14], y1 = i[15]; - if (n[0].setComponents(c - r, d - l, g - f, y1 - p).normalize(), n[1].setComponents(c + r, d + l, g + f, y1 + p).normalize(), n[2].setComponents(c + a, d + h, g + m, y1 + v).normalize(), n[3].setComponents(c - a, d - h, g - m, y1 - v).normalize(), n[4].setComponents(c - o, d - u, g - _, y1 - x1).normalize(), t === vn) n[5].setComponents(c + o, d + u, g + _, y1 + x1).normalize(); - else if (t === Gr) n[5].setComponents(o, u, _, x1).normalize(); - else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t); + applyNormalMatrix(t) { + for(let e = 0, i = this.count; e < i; e++)gt.fromBufferAttribute(this, e), gt.applyNormalMatrix(t), this.setXYZ(e, gt.x, gt.y, gt.z); return this; } - intersectsObject(e) { - if (e.boundingSphere !== void 0) e.boundingSphere === null && e.computeBoundingSphere(), Yn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld); - else { - let t = e.geometry; - t.boundingSphere === null && t.computeBoundingSphere(), Yn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld); - } - return this.intersectsSphere(Yn); + transformDirection(t) { + for(let e = 0, i = this.count; e < i; e++)gt.fromBufferAttribute(this, e), gt.transformDirection(t), this.setXYZ(e, gt.x, gt.y, gt.z); + return this; } - intersectsSprite(e) { - return Yn.center.set(0, 0, 0), Yn.radius = .7071067811865476, Yn.applyMatrix4(e.matrixWorld), this.intersectsSphere(Yn); + getComponent(t, e) { + let i = this.array[t * this.data.stride + this.offset + e]; + return this.normalized && (i = xt(i, this.array)), i; } - intersectsSphere(e) { - let t = this.planes, n = e.center, i = -e.radius; - for(let r = 0; r < 6; r++)if (t[r].distanceToPoint(n) < i) return !1; - return !0; + setComponent(t, e, i) { + return this.normalized && (i = V(i, this.array)), this.data.array[t * this.data.stride + this.offset + e] = i, this; } - intersectsBox(e) { - let t = this.planes; - for(let n = 0; n < 6; n++){ - let i = t[n]; - if (or.x = i.normal.x > 0 ? e.max.x : e.min.x, or.y = i.normal.y > 0 ? e.max.y : e.min.y, or.z = i.normal.z > 0 ? e.max.z : e.min.z, i.distanceToPoint(or) < 0) return !1; - } - return !0; + setX(t, e) { + return this.normalized && (e = V(e, this.array)), this.data.array[t * this.data.stride + this.offset] = e, this; } - containsPoint(e) { - let t = this.planes; - for(let n = 0; n < 6; n++)if (t[n].distanceToPoint(e) < 0) return !1; - return !0; + setY(t, e) { + return this.normalized && (e = V(e, this.array)), this.data.array[t * this.data.stride + this.offset + 1] = e, this; } - clone() { - return new this.constructor().copy(this); + setZ(t, e) { + return this.normalized && (e = V(e, this.array)), this.data.array[t * this.data.stride + this.offset + 2] = e, this; + } + setW(t, e) { + return this.normalized && (e = V(e, this.array)), this.data.array[t * this.data.stride + this.offset + 3] = e, this; + } + getX(t) { + let e = this.data.array[t * this.data.stride + this.offset]; + return this.normalized && (e = xt(e, this.array)), e; + } + getY(t) { + let e = this.data.array[t * this.data.stride + this.offset + 1]; + return this.normalized && (e = xt(e, this.array)), e; + } + getZ(t) { + let e = this.data.array[t * this.data.stride + this.offset + 2]; + return this.normalized && (e = xt(e, this.array)), e; + } + getW(t) { + let e = this.data.array[t * this.data.stride + this.offset + 3]; + return this.normalized && (e = xt(e, this.array)), e; + } + setXY(t, e, i) { + return t = t * this.data.stride + this.offset, this.normalized && (e = V(e, this.array), i = V(i, this.array)), this.data.array[t + 0] = e, this.data.array[t + 1] = i, this; + } + setXYZ(t, e, i, s) { + return t = t * this.data.stride + this.offset, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array)), this.data.array[t + 0] = e, this.data.array[t + 1] = i, this.data.array[t + 2] = s, this; + } + setXYZW(t, e, i, s, n) { + return t = t * this.data.stride + this.offset, this.normalized && (e = V(e, this.array), i = V(i, this.array), s = V(s, this.array), n = V(n, this.array)), this.data.array[t + 0] = e, this.data.array[t + 1] = i, this.data.array[t + 2] = s, this.data.array[t + 3] = n, this; + } + clone(t) { + if (t === void 0) { + console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data."); + let e = []; + for(let i = 0; i < this.count; i++){ + let s = i * this.data.stride + this.offset; + for(let n = 0; n < this.itemSize; n++)e.push(this.data.array[s + n]); + } + return new Z(new this.array.constructor(e), this.itemSize, this.normalized); + } else return t.interleavedBuffers === void 0 && (t.interleavedBuffers = {}), t.interleavedBuffers[this.data.uuid] === void 0 && (t.interleavedBuffers[this.data.uuid] = this.data.clone(t)), new h(t.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); + } + toJSON(t) { + if (t === void 0) { + console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data."); + let e = []; + for(let i = 0; i < this.count; i++){ + let s = i * this.data.stride + this.offset; + for(let n = 0; n < this.itemSize; n++)e.push(this.data.array[s + n]); + } + return { + itemSize: this.itemSize, + type: this.array.constructor.name, + array: e, + normalized: this.normalized + }; + } else return t.interleavedBuffers === void 0 && (t.interleavedBuffers = {}), t.interleavedBuffers[this.data.uuid] === void 0 && (t.interleavedBuffers[this.data.uuid] = this.data.toJSON(t)), { + isInterleavedBufferAttribute: !0, + itemSize: this.itemSize, + data: this.data.uuid, + offset: this.offset, + normalized: this.normalized + }; + } +}, tn = class extends ct { + constructor(t){ + super(), this.isSpriteMaterial = !0, this.type = "SpriteMaterial", this.color = new P(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.alphaMap = t.alphaMap, this.rotation = t.rotation, this.sizeAttenuation = t.sizeAttenuation, this.fog = t.fog, this; + } +}, si, Ci = new w, ni = new w, ri = new w, oi = new T, zi = new T, Bl = new D, bs = new w, Fi = new w, ws = new w, Da = new T, $n = new T, La = new T, vr = class extends G { + constructor(t = new tn){ + if (super(), this.isSprite = !0, this.type = "Sprite", si === void 0) { + si = new L; + let e = new Float32Array([ + -.5, + -.5, + 0, + 0, + 0, + .5, + -.5, + 0, + 1, + 0, + .5, + .5, + 0, + 1, + 1, + -.5, + .5, + 0, + 0, + 1 + ]), i = new Ji(e, 5); + si.setIndex([ + 0, + 1, + 2, + 0, + 2, + 3 + ]), si.setAttribute("position", new fi(i, 3, 0, !1)), si.setAttribute("uv", new fi(i, 2, 3, !1)); + } + this.geometry = si, this.material = t, this.center = new T(.5, .5); + } + raycast(t, e) { + t.camera === null && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), ni.setFromMatrixScale(this.matrixWorld), Bl.copy(t.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse, this.matrixWorld), ri.setFromMatrixPosition(this.modelViewMatrix), t.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && ni.multiplyScalar(-ri.z); + let i = this.material.rotation, s, n; + i !== 0 && (n = Math.cos(i), s = Math.sin(i)); + let r = this.center; + Ms(bs.set(-.5, -.5, 0), ri, r, ni, s, n), Ms(Fi.set(.5, -.5, 0), ri, r, ni, s, n), Ms(ws.set(.5, .5, 0), ri, r, ni, s, n), Da.set(0, 0), $n.set(1, 0), La.set(1, 1); + let o = t.ray.intersectTriangle(bs, Fi, ws, !1, Ci); + if (o === null && (Ms(Fi.set(-.5, .5, 0), ri, r, ni, s, n), $n.set(0, 1), o = t.ray.intersectTriangle(bs, ws, Fi, !1, Ci), o === null)) return; + let a = t.ray.origin.distanceTo(Ci); + a < t.near || a > t.far || e.push({ + distance: a, + point: Ci.clone(), + uv: ne.getInterpolation(Ci, bs, Fi, ws, Da, $n, La, new T), + face: null, + object: this + }); + } + copy(t, e) { + return super.copy(t, e), t.center !== void 0 && this.center.copy(t.center), this.material = t.material, this; } }; -function Ed() { - let s1 = null, e = !1, t = null, n = null; - function i(r, a) { - t(r, a), n = s1.requestAnimationFrame(i); +function Ms(h, t, e, i, s, n) { + oi.subVectors(h, e).addScalar(.5).multiply(i), s !== void 0 ? (zi.x = n * oi.x - s * oi.y, zi.y = s * oi.x + n * oi.y) : zi.copy(oi), h.copy(t), h.x += zi.x, h.y += zi.y, h.applyMatrix4(Bl); +} +var _s = new w, Ua = new w, Ar = class extends G { + constructor(){ + super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { + levels: { + enumerable: !0, + value: [] + }, + isLOD: { + value: !0 + } + }), this.autoUpdate = !0; } - return { - start: function() { - e !== !0 && t !== null && (n = s1.requestAnimationFrame(i), e = !0); - }, - stop: function() { - s1.cancelAnimationFrame(n), e = !1; - }, - setAnimationLoop: function(r) { - t = r; - }, - setContext: function(r) { - s1 = r; + copy(t) { + super.copy(t, !1); + let e = t.levels; + for(let i = 0, s = e.length; i < s; i++){ + let n = e[i]; + this.addLevel(n.object.clone(), n.distance, n.hysteresis); + } + return this.autoUpdate = t.autoUpdate, this; + } + addLevel(t, e = 0, i = 0) { + e = Math.abs(e); + let s = this.levels, n; + for(n = 0; n < s.length && !(e < s[n].distance); n++); + return s.splice(n, 0, { + distance: e, + hysteresis: i, + object: t + }), this.add(t), this; + } + removeLevel(t) { + let e = this.levels; + for(let i = 0; i < e.length; i++)if (e[i].distance === t) { + let s = e.splice(i, 1); + return this.remove(s[0].object), !0; } - }; -} -function bp(s1, e) { - let t = e.isWebGL2, n = new WeakMap; - function i(l, h) { - let u = l.array, d = l.usage, f = s1.createBuffer(); - s1.bindBuffer(h, f), s1.bufferData(h, u, d), l.onUploadCallback(); - let m; - if (u instanceof Float32Array) m = s1.FLOAT; - else if (u instanceof Uint16Array) if (l.isFloat16BufferAttribute) if (t) m = s1.HALF_FLOAT; - else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."); - else m = s1.UNSIGNED_SHORT; - else if (u instanceof Int16Array) m = s1.SHORT; - else if (u instanceof Uint32Array) m = s1.UNSIGNED_INT; - else if (u instanceof Int32Array) m = s1.INT; - else if (u instanceof Int8Array) m = s1.BYTE; - else if (u instanceof Uint8Array) m = s1.UNSIGNED_BYTE; - else if (u instanceof Uint8ClampedArray) m = s1.UNSIGNED_BYTE; - else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: " + u); - return { - buffer: f, - type: m, - bytesPerElement: u.BYTES_PER_ELEMENT, - version: l.version - }; + return !1; + } + getCurrentLevel() { + return this._currentLevel; + } + getObjectForDistance(t) { + let e = this.levels; + if (e.length > 0) { + let i, s; + for(i = 1, s = e.length; i < s; i++){ + let n = e[i].distance; + if (e[i].object.visible && (n -= n * e[i].hysteresis), t < n) break; + } + return e[i - 1].object; + } + return null; } - function r(l, h, u) { - let d = h.array, f = h.updateRange; - s1.bindBuffer(u, l), f.count === -1 ? s1.bufferSubData(u, 0, d) : (t ? s1.bufferSubData(u, f.offset * d.BYTES_PER_ELEMENT, d, f.offset, f.count) : s1.bufferSubData(u, f.offset * d.BYTES_PER_ELEMENT, d.subarray(f.offset, f.offset + f.count)), f.count = -1), h.onUploadCallback(); - } - function a(l) { - return l.isInterleavedBufferAttribute && (l = l.data), n.get(l); - } - function o(l) { - l.isInterleavedBufferAttribute && (l = l.data); - let h = n.get(l); - h && (s1.deleteBuffer(h.buffer), n.delete(l)); - } - function c(l, h) { - if (l.isGLBufferAttribute) { - let d = n.get(l); - (!d || d.version < l.version) && n.set(l, { - buffer: l.buffer, - type: l.type, - bytesPerElement: l.elementSize, - version: l.version + raycast(t, e) { + if (this.levels.length > 0) { + _s.setFromMatrixPosition(this.matrixWorld); + let s = t.ray.origin.distanceTo(_s); + this.getObjectForDistance(s).raycast(t, e); + } + } + update(t) { + let e = this.levels; + if (e.length > 1) { + _s.setFromMatrixPosition(t.matrixWorld), Ua.setFromMatrixPosition(this.matrixWorld); + let i = _s.distanceTo(Ua) / t.zoom; + e[0].object.visible = !0; + let s, n; + for(s = 1, n = e.length; s < n; s++){ + let r = e[s].distance; + if (e[s].object.visible && (r -= r * e[s].hysteresis), i >= r) e[s - 1].object.visible = !1, e[s].object.visible = !0; + else break; + } + for(this._currentLevel = s - 1; s < n; s++)e[s].object.visible = !1; + } + } + toJSON(t) { + let e = super.toJSON(t); + this.autoUpdate === !1 && (e.object.autoUpdate = !1), e.object.levels = []; + let i = this.levels; + for(let s = 0, n = i.length; s < n; s++){ + let r = i[s]; + e.object.levels.push({ + object: r.object.uuid, + distance: r.distance, + hysteresis: r.hysteresis }); - return; } - l.isInterleavedBufferAttribute && (l = l.data); - let u = n.get(l); - u === void 0 ? n.set(l, i(l, h)) : u.version < l.version && (r(u.buffer, l, h), u.version = l.version); + return e; } - return { - get: a, - remove: o, - update: c - }; -} -var $r = class s1 extends Ge { - constructor(e = 1, t = 1, n = 1, i = 1){ - super(), this.type = "PlaneGeometry", this.parameters = { - width: e, - height: t, - widthSegments: n, - heightSegments: i - }; - let r = e / 2, a = t / 2, o = Math.floor(n), c = Math.floor(i), l = o + 1, h = c + 1, u = e / o, d = t / c, f = [], m = [], _ = [], g = []; - for(let p = 0; p < h; p++){ - let v = p * d - a; - for(let x1 = 0; x1 < l; x1++){ - let y1 = x1 * u - r; - m.push(y1, -v, 0), _.push(0, 0, 1), g.push(x1 / o), g.push(1 - p / c); +}, Wa = new w, Ha = new ot, qa = new ot, Eu = new w, Ga = new D, vs = new w, Qn = new ht, Xa = new D, jn = new Le, Sr = class extends Ct { + constructor(t, e){ + super(t, e), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = oa, this.bindMatrix = new D, this.bindMatrixInverse = new D, this.boundingBox = null, this.boundingSphere = null; + } + computeBoundingBox() { + let t = this.geometry; + this.boundingBox === null && (this.boundingBox = new ft), this.boundingBox.makeEmpty(); + let e = t.getAttribute("position"); + for(let i = 0; i < e.count; i++)this.getVertexPosition(i, vs), this.boundingBox.expandByPoint(vs); + } + computeBoundingSphere() { + let t = this.geometry; + this.boundingSphere === null && (this.boundingSphere = new ht), this.boundingSphere.makeEmpty(); + let e = t.getAttribute("position"); + for(let i = 0; i < e.count; i++)this.getVertexPosition(i, vs), this.boundingSphere.expandByPoint(vs); + } + copy(t, e) { + return super.copy(t, e), this.bindMode = t.bindMode, this.bindMatrix.copy(t.bindMatrix), this.bindMatrixInverse.copy(t.bindMatrixInverse), this.skeleton = t.skeleton, t.boundingBox !== null && (this.boundingBox = t.boundingBox.clone()), t.boundingSphere !== null && (this.boundingSphere = t.boundingSphere.clone()), this; + } + raycast(t, e) { + let i = this.material, s = this.matrixWorld; + i !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), Qn.copy(this.boundingSphere), Qn.applyMatrix4(s), t.ray.intersectsSphere(Qn) !== !1 && (Xa.copy(s).invert(), jn.copy(t.ray).applyMatrix4(Xa), !(this.boundingBox !== null && jn.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(t, e, jn))); + } + getVertexPosition(t, e) { + return super.getVertexPosition(t, e), this.applyBoneTransform(t, e), e; + } + bind(t, e) { + this.skeleton = t, e === void 0 && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), e = this.matrixWorld), this.bindMatrix.copy(e), this.bindMatrixInverse.copy(e).invert(); + } + pose() { + this.skeleton.pose(); + } + normalizeSkinWeights() { + let t = new ot, e = this.geometry.attributes.skinWeight; + for(let i = 0, s = e.count; i < s; i++){ + t.fromBufferAttribute(e, i); + let n = 1 / t.manhattanLength(); + n !== 1 / 0 ? t.multiplyScalar(n) : t.set(1, 0, 0, 0), e.setXYZW(i, t.x, t.y, t.z, t.w); + } + } + updateMatrixWorld(t) { + super.updateMatrixWorld(t), this.bindMode === oa ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === Wl ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode); + } + applyBoneTransform(t, e) { + let i = this.skeleton, s = this.geometry; + Ha.fromBufferAttribute(s.attributes.skinIndex, t), qa.fromBufferAttribute(s.attributes.skinWeight, t), Wa.copy(e).applyMatrix4(this.bindMatrix), e.set(0, 0, 0); + for(let n = 0; n < 4; n++){ + let r = qa.getComponent(n); + if (r !== 0) { + let o = Ha.getComponent(n); + Ga.multiplyMatrices(i.bones[o].matrixWorld, i.boneInverses[o]), e.addScaledVector(Eu.copy(Wa).applyMatrix4(Ga), r); } } - for(let p = 0; p < c; p++)for(let v = 0; v < o; v++){ - let x1 = v + l * p, y1 = v + l * (p + 1), b = v + 1 + l * (p + 1), w = v + 1 + l * p; - f.push(x1, y1, w), f.push(y1, b, w); + return e.applyMatrix4(this.bindMatrixInverse); + } +}, en = class extends G { + constructor(){ + super(), this.isBone = !0, this.type = "Bone"; + } +}, Lt = class extends lt { + constructor(t = null, e = 1, i = 1, s, n, r, o, a, l = Ut, c = Ut, u, d){ + super(null, r, o, a, l, c, s, n, u, d), this.isDataTexture = !0, this.image = { + data: t, + width: e, + height: i + }, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; + } +}, Ja = new D, Ru = new D, Tr = class h { + constructor(t = [], e = []){ + this.uuid = It(), this.bones = t.slice(0), this.boneInverses = e, this.boneMatrices = null, this.boneTexture = null, this.init(); + } + init() { + let t = this.bones, e = this.boneInverses; + if (this.boneMatrices = new Float32Array(t.length * 16), e.length === 0) this.calculateInverses(); + else if (t.length !== e.length) { + console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = []; + for(let i = 0, s = this.bones.length; i < s; i++)this.boneInverses.push(new D); } - this.setIndex(f), this.setAttribute("position", new ve(m, 3)), this.setAttribute("normal", new ve(_, 3)), this.setAttribute("uv", new ve(g, 2)); } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + calculateInverses() { + this.boneInverses.length = 0; + for(let t = 0, e = this.bones.length; t < e; t++){ + let i = new D; + this.bones[t] && i.copy(this.bones[t].matrixWorld).invert(), this.boneInverses.push(i); + } } - static fromJSON(e) { - return new s1(e.width, e.height, e.widthSegments, e.heightSegments); + pose() { + for(let t = 0, e = this.bones.length; t < e; t++){ + let i = this.bones[t]; + i && i.matrixWorld.copy(this.boneInverses[t]).invert(); + } + for(let t = 0, e = this.bones.length; t < e; t++){ + let i = this.bones[t]; + i && (i.parent && i.parent.isBone ? (i.matrix.copy(i.parent.matrixWorld).invert(), i.matrix.multiply(i.matrixWorld)) : i.matrix.copy(i.matrixWorld), i.matrix.decompose(i.position, i.quaternion, i.scale)); + } } -}, Ep = `#ifdef USE_ALPHAHASH - if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; -#endif`, Tp = `#ifdef USE_ALPHAHASH - const float ALPHA_HASH_SCALE = 0.05; - float hash2D( vec2 value ) { - return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); - } - float hash3D( vec3 value ) { - return hash2D( vec2( hash2D( value.xy ), value.z ) ); - } - float getAlphaHashThreshold( vec3 position ) { - float maxDeriv = max( - length( dFdx( position.xyz ) ), - length( dFdy( position.xyz ) ) - ); - float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); - vec2 pixScales = vec2( - exp2( floor( log2( pixScale ) ) ), - exp2( ceil( log2( pixScale ) ) ) - ); - vec2 alpha = vec2( - hash3D( floor( pixScales.x * position.xyz ) ), - hash3D( floor( pixScales.y * position.xyz ) ) - ); - float lerpFactor = fract( log2( pixScale ) ); - float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; - float a = min( lerpFactor, 1.0 - lerpFactor ); - vec3 cases = vec3( - x * x / ( 2.0 * a * ( 1.0 - a ) ), - ( x - 0.5 * a ) / ( 1.0 - a ), - 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) - ); - float threshold = ( x < ( 1.0 - a ) ) - ? ( ( x < a ) ? cases.x : cases.y ) - : cases.z; - return clamp( threshold , 1.0e-6, 1.0 ); - } -#endif`, wp = `#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; -#endif`, Ap = `#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`, Rp = `#ifdef USE_ALPHATEST - if ( diffuseColor.a < alphaTest ) discard; -#endif`, Cp = `#ifdef USE_ALPHATEST - uniform float alphaTest; -#endif`, Pp = `#ifdef USE_AOMAP - float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; - reflectedLight.indirectDiffuse *= ambientOcclusion; - #if defined( USE_ENVMAP ) && defined( STANDARD ) - float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); - reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); - #endif -#endif`, Lp = `#ifdef USE_AOMAP - uniform sampler2D aoMap; - uniform float aoMapIntensity; -#endif`, Ip = `vec3 transformed = vec3( position ); -#ifdef USE_ALPHAHASH - vPosition = vec3( position ); -#endif`, Up = `vec3 objectNormal = vec3( normal ); -#ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); -#endif`, Dp = `float G_BlinnPhong_Implicit( ) { - return 0.25; + update() { + let t = this.bones, e = this.boneInverses, i = this.boneMatrices, s = this.boneTexture; + for(let n = 0, r = t.length; n < r; n++){ + let o = t[n] ? t[n].matrixWorld : Ru; + Ja.multiplyMatrices(o, e[n]), Ja.toArray(i, n * 16); + } + s !== null && (s.needsUpdate = !0); + } + clone() { + return new h(this.bones, this.boneInverses); + } + computeBoneTexture() { + let t = Math.sqrt(this.bones.length * 4); + t = Math.ceil(t / 4) * 4, t = Math.max(t, 4); + let e = new Float32Array(t * t * 4); + e.set(this.boneMatrices); + let i = new Lt(e, t, t, Li, pi); + return i.needsUpdate = !0, this.boneMatrices = e, this.boneTexture = i, this; + } + getBoneByName(t) { + for(let e = 0, i = this.bones.length; e < i; e++){ + let s = this.bones[e]; + if (s.name === t) return s; + } + } + dispose() { + this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null); + } + fromJSON(t, e) { + this.uuid = t.uuid; + for(let i = 0, s = t.bones.length; i < s; i++){ + let n = t.bones[i], r = e[n]; + r === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", n), r = new en), this.bones.push(r), this.boneInverses.push(new D().fromArray(t.boneInverses[i])); + } + return this.init(), this; + } + toJSON() { + let t = { + metadata: { + version: 4.6, + type: "Skeleton", + generator: "Skeleton.toJSON" + }, + bones: [], + boneInverses: [] + }; + t.uuid = this.uuid; + let e = this.bones, i = this.boneInverses; + for(let s = 0, n = e.length; s < n; s++){ + let r = e[s]; + t.bones.push(r.uuid); + let o = i[s]; + t.boneInverses.push(o.toArray()); + } + return t; + } +}, Ue = class extends Z { + constructor(t, e, i, s = 1){ + super(t, e, i), this.isInstancedBufferAttribute = !0, this.meshPerAttribute = s; + } + copy(t) { + return super.copy(t), this.meshPerAttribute = t.meshPerAttribute, this; + } + toJSON() { + let t = super.toJSON(); + return t.meshPerAttribute = this.meshPerAttribute, t.isInstancedBufferAttribute = !0, t; + } +}, ai = new D, Za = new D, As = [], Ya = new ft, ku = new D, Bi = new Ct, Ei = new ht, Ir = class extends Ct { + constructor(t, e, i){ + super(t, e), this.isInstancedMesh = !0, this.instanceMatrix = new Ue(new Float32Array(i * 16), 16), this.instanceColor = null, this.morphTexture = null, this.count = i, this.boundingBox = null, this.boundingSphere = null; + for(let s = 0; s < i; s++)this.setMatrixAt(s, ku); + } + computeBoundingBox() { + let t = this.geometry, e = this.count; + this.boundingBox === null && (this.boundingBox = new ft), t.boundingBox === null && t.computeBoundingBox(), this.boundingBox.makeEmpty(); + for(let i = 0; i < e; i++)this.getMatrixAt(i, ai), Ya.copy(t.boundingBox).applyMatrix4(ai), this.boundingBox.union(Ya); + } + computeBoundingSphere() { + let t = this.geometry, e = this.count; + this.boundingSphere === null && (this.boundingSphere = new ht), t.boundingSphere === null && t.computeBoundingSphere(), this.boundingSphere.makeEmpty(); + for(let i = 0; i < e; i++)this.getMatrixAt(i, ai), Ei.copy(t.boundingSphere).applyMatrix4(ai), this.boundingSphere.union(Ei); + } + copy(t, e) { + return super.copy(t, e), this.instanceMatrix.copy(t.instanceMatrix), t.morphTexture !== null && (this.morphTexture = t.morphTexture.clone()), t.instanceColor !== null && (this.instanceColor = t.instanceColor.clone()), this.count = t.count, t.boundingBox !== null && (this.boundingBox = t.boundingBox.clone()), t.boundingSphere !== null && (this.boundingSphere = t.boundingSphere.clone()), this; + } + getColorAt(t, e) { + e.fromArray(this.instanceColor.array, t * 3); + } + getMatrixAt(t, e) { + e.fromArray(this.instanceMatrix.array, t * 16); + } + getMorphAt(t, e) { + let i = e.morphTargetInfluences, s = this.morphTexture.source.data.data, n = i.length + 1, r = t * n + 1; + for(let o = 0; o < i.length; o++)i[o] = s[r + o]; + } + raycast(t, e) { + let i = this.matrixWorld, s = this.count; + if (Bi.geometry = this.geometry, Bi.material = this.material, Bi.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), Ei.copy(this.boundingSphere), Ei.applyMatrix4(i), t.ray.intersectsSphere(Ei) !== !1)) for(let n = 0; n < s; n++){ + this.getMatrixAt(n, ai), Za.multiplyMatrices(i, ai), Bi.matrixWorld = Za, Bi.raycast(t, As); + for(let r = 0, o = As.length; r < o; r++){ + let a = As[r]; + a.instanceId = n, a.object = this, e.push(a); + } + As.length = 0; + } + } + setColorAt(t, e) { + this.instanceColor === null && (this.instanceColor = new Ue(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), e.toArray(this.instanceColor.array, t * 3); + } + setMatrixAt(t, e) { + e.toArray(this.instanceMatrix.array, t * 16); + } + setMorphAt(t, e) { + let i = e.morphTargetInfluences, s = i.length + 1; + this.morphTexture === null && (this.morphTexture = new Lt(new Float32Array(s * this.count), s, this.count, Tl, pi)); + let n = this.morphTexture.source.data.data, r = 0; + for(let l = 0; l < i.length; l++)r += i[l]; + let o = this.geometry.morphTargetsRelative ? 1 : 1 - r, a = s * t; + n[a] = o, n.set(i, a + 1); + } + updateMorphTargets() {} + dispose() { + return this.dispatchEvent({ + type: "dispose" + }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null), this; + } +}, Kn = new w, Pu = new w, Ou = new Gt, xe = class { + constructor(t = new w(1, 0, 0), e = 0){ + this.isPlane = !0, this.normal = t, this.constant = e; + } + set(t, e) { + return this.normal.copy(t), this.constant = e, this; + } + setComponents(t, e, i, s) { + return this.normal.set(t, e, i), this.constant = s, this; + } + setFromNormalAndCoplanarPoint(t, e) { + return this.normal.copy(t), this.constant = -e.dot(this.normal), this; + } + setFromCoplanarPoints(t, e, i) { + let s = Kn.subVectors(i, e).cross(Pu.subVectors(t, e)).normalize(); + return this.setFromNormalAndCoplanarPoint(s, t), this; + } + copy(t) { + return this.normal.copy(t.normal), this.constant = t.constant, this; + } + normalize() { + let t = 1 / this.normal.length(); + return this.normal.multiplyScalar(t), this.constant *= t, this; + } + negate() { + return this.constant *= -1, this.normal.negate(), this; + } + distanceToPoint(t) { + return this.normal.dot(t) + this.constant; + } + distanceToSphere(t) { + return this.distanceToPoint(t.center) - t.radius; + } + projectPoint(t, e) { + return e.copy(t).addScaledVector(this.normal, -this.distanceToPoint(t)); + } + intersectLine(t, e) { + let i = t.delta(Kn), s = this.normal.dot(i); + if (s === 0) return this.distanceToPoint(t.start) === 0 ? e.copy(t.start) : null; + let n = -(t.start.dot(this.normal) + this.constant) / s; + return n < 0 || n > 1 ? null : e.copy(t.start).addScaledVector(i, n); + } + intersectsLine(t) { + let e = this.distanceToPoint(t.start), i = this.distanceToPoint(t.end); + return e < 0 && i > 0 || i < 0 && e > 0; + } + intersectsBox(t) { + return t.intersectsPlane(this); + } + intersectsSphere(t) { + return t.intersectsPlane(this); + } + coplanarPoint(t) { + return t.copy(this.normal).multiplyScalar(-this.constant); + } + applyMatrix4(t, e) { + let i = e || Ou.getNormalMatrix(t), s = this.coplanarPoint(Kn).applyMatrix4(t), n = this.normal.applyMatrix3(i).normalize(); + return this.constant = -s.dot(n), this; + } + translate(t) { + return this.constant -= t.dot(this.normal), this; + } + equals(t) { + return t.normal.equals(this.normal) && t.constant === this.constant; + } + clone() { + return new this.constructor().copy(this); + } +}, ze = new ht, Ss = new w, sn = class { + constructor(t = new xe, e = new xe, i = new xe, s = new xe, n = new xe, r = new xe){ + this.planes = [ + t, + e, + i, + s, + n, + r + ]; + } + set(t, e, i, s, n, r) { + let o = this.planes; + return o[0].copy(t), o[1].copy(e), o[2].copy(i), o[3].copy(s), o[4].copy(n), o[5].copy(r), this; + } + copy(t) { + let e = this.planes; + for(let i = 0; i < 6; i++)e[i].copy(t.planes[i]); + return this; + } + setFromProjectionMatrix(t, e = oe) { + let i = this.planes, s = t.elements, n = s[0], r = s[1], o = s[2], a = s[3], l = s[4], c = s[5], u = s[6], d = s[7], p = s[8], f = s[9], m = s[10], y1 = s[11], g = s[12], x1 = s[13], b = s[14], M = s[15]; + if (i[0].setComponents(a - n, d - l, y1 - p, M - g).normalize(), i[1].setComponents(a + n, d + l, y1 + p, M + g).normalize(), i[2].setComponents(a + r, d + c, y1 + f, M + x1).normalize(), i[3].setComponents(a - r, d - c, y1 - f, M - x1).normalize(), i[4].setComponents(a - o, d - u, y1 - m, M - b).normalize(), e === oe) i[5].setComponents(a + o, d + u, y1 + m, M + b).normalize(); + else if (e === Zs) i[5].setComponents(o, u, m, b).normalize(); + else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + e); + return this; + } + intersectsObject(t) { + if (t.boundingSphere !== void 0) t.boundingSphere === null && t.computeBoundingSphere(), ze.copy(t.boundingSphere).applyMatrix4(t.matrixWorld); + else { + let e = t.geometry; + e.boundingSphere === null && e.computeBoundingSphere(), ze.copy(e.boundingSphere).applyMatrix4(t.matrixWorld); + } + return this.intersectsSphere(ze); + } + intersectsSprite(t) { + return ze.center.set(0, 0, 0), ze.radius = .7071067811865476, ze.applyMatrix4(t.matrixWorld), this.intersectsSphere(ze); + } + intersectsSphere(t) { + let e = this.planes, i = t.center, s = -t.radius; + for(let n = 0; n < 6; n++)if (e[n].distanceToPoint(i) < s) return !1; + return !0; + } + intersectsBox(t) { + let e = this.planes; + for(let i = 0; i < 6; i++){ + let s = e[i]; + if (Ss.x = s.normal.x > 0 ? t.max.x : t.min.x, Ss.y = s.normal.y > 0 ? t.max.y : t.min.y, Ss.z = s.normal.z > 0 ? t.max.z : t.min.z, s.distanceToPoint(Ss) < 0) return !1; + } + return !0; + } + containsPoint(t) { + let e = this.planes; + for(let i = 0; i < 6; i++)if (e[i].distanceToPoint(t) < 0) return !1; + return !0; + } + clone() { + return new this.constructor().copy(this); + } +}; +function tr(h, t) { + return h - t; } -float D_BlinnPhong( const in float shininess, const in float dotNH ) { - return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); +function Nu(h, t) { + return h.z - t.z; } -vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( specularColor, 1.0, dotVH ); - float G = G_BlinnPhong_Implicit( ); - float D = D_BlinnPhong( shininess, dotNH ); - return F * ( G * D ); -} // validated`, Np = `#ifdef USE_IRIDESCENCE - const mat3 XYZ_TO_REC709 = mat3( - 3.2404542, -0.9692660, 0.0556434, - -1.5371385, 1.8760108, -0.2040259, - -0.4985314, 0.0415560, 1.0572252 - ); - vec3 Fresnel0ToIor( vec3 fresnel0 ) { - vec3 sqrtF0 = sqrt( fresnel0 ); - return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); - } - vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { - return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); - } - float IorToFresnel0( float transmittedIor, float incidentIor ) { - return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); - } - vec3 evalSensitivity( float OPD, vec3 shift ) { - float phase = 2.0 * PI * OPD * 1.0e-9; - vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); - vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); - vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); - vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); - 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 ) ); - xyz /= 1.0685e-7; - vec3 rgb = XYZ_TO_REC709 * xyz; - return rgb; - } - vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { - vec3 I; - float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); - float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); - float cosTheta2Sq = 1.0 - sinTheta2Sq; - if ( cosTheta2Sq < 0.0 ) { - return vec3( 1.0 ); - } - float cosTheta2 = sqrt( cosTheta2Sq ); - float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); - float R12 = F_Schlick( R0, 1.0, cosTheta1 ); - float T121 = 1.0 - R12; - float phi12 = 0.0; - if ( iridescenceIOR < outsideIOR ) phi12 = PI; - float phi21 = PI - phi12; - vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); - vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); - vec3 phi23 = vec3( 0.0 ); - if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; - if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; - if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; - float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; - vec3 phi = vec3( phi21 ) + phi23; - vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); - vec3 r123 = sqrt( R123 ); - vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); - vec3 C0 = R12 + Rs; - I = C0; - vec3 Cm = Rs - T121; - for ( int m = 1; m <= 2; ++ m ) { - Cm *= r123; - vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); - I += Cm * Sm; - } - return max( I, vec3( 0.0 ) ); - } -#endif`, Op = `#ifdef USE_BUMPMAP - uniform sampler2D bumpMap; - uniform float bumpScale; - vec2 dHdxy_fwd() { - vec2 dSTdx = dFdx( vBumpMapUv ); - vec2 dSTdy = dFdy( vBumpMapUv ); - float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; - float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; - float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; - return vec2( dBx, dBy ); - } - vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { - vec3 vSigmaX = dFdx( surf_pos.xyz ); - vec3 vSigmaY = dFdy( surf_pos.xyz ); - vec3 vN = surf_norm; - vec3 R1 = cross( vSigmaY, vN ); - vec3 R2 = cross( vN, vSigmaX ); - float fDet = dot( vSigmaX, R1 ) * faceDirection; - vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); - return normalize( abs( fDet ) * surf_norm - vGrad ); - } -#endif`, Fp = `#if NUM_CLIPPING_PLANES > 0 - vec4 plane; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif -#endif`, Bp = `#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`, zp = `#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`, Vp = `#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`, kp = `#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`, Hp = `#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`, Gp = `#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`, Wp = `#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`, Xp = `#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); +function Vu(h, t) { + return t.z - h.z; } -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; +var Cr = class { + constructor(){ + this.index = 0, this.pool = [], this.list = []; + } + push(t, e, i, s) { + let n = this.pool, r = this.list; + this.index >= n.length && n.push({ + start: -1, + count: -1, + z: -1, + index: -1 + }); + let o = n[this.index]; + r.push(o), this.index++, o.start = t, o.count = e, o.z = i, o.index = s; + } + reset() { + this.list.length = 0, this.index = 0; + } +}, Mt = new D, Du = new P(1, 1, 1), er = new sn, Ts = new ft, Fe = new ht, Ri = new w, $a = new w, Lu = new w, ir = new Cr, pt = new Ct, Is = []; +function Uu(h, t, e = 0) { + let i = t.itemSize; + if (h.isInterleavedBufferAttribute || h.array.constructor !== t.array.constructor) { + let s = h.count; + for(let n = 0; n < s; n++)for(let r = 0; r < i; r++)t.setComponent(n + e, r, h.getComponent(n, r)); + } else t.array.set(h.array, e * i); + t.needsUpdate = !0; +} +function Be(h, t) { + if (h.constructor !== t.constructor) { + let e = Math.min(h.length, t.length); + for(let i = 0; i < e; i++)t[i] = h[i]; + } else { + let e = Math.min(h.length, t.length); + t.set(new h.constructor(h.buffer, 0, e)); + } +} +var zr = class extends Ct { + get maxInstanceCount() { + return this._maxInstanceCount; + } + get instanceCount() { + return this._instanceInfo.length - this._availableInstanceIds.length; + } + get unusedVertexCount() { + return this._maxVertexCount - this._nextVertexStart; + } + get unusedIndexCount() { + return this._maxIndexCount - this._nextIndexStart; + } + constructor(t, e, i = e * 2, s){ + super(new L, s), this.isBatchedMesh = !0, this.perObjectFrustumCulled = !0, this.sortObjects = !0, this.boundingBox = null, this.boundingSphere = null, this.customSort = null, this._instanceInfo = [], this._geometryInfo = [], this._availableInstanceIds = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._visibilityChanged = !0, this._geometryInitialized = !1, this._maxInstanceCount = t, this._maxVertexCount = e, this._maxIndexCount = i, this._multiDrawCounts = new Int32Array(t), this._multiDrawStarts = new Int32Array(t), this._multiDrawCount = 0, this._multiDrawInstances = null, this._matricesTexture = null, this._indirectTexture = null, this._colorsTexture = null, this._initMatricesTexture(), this._initIndirectTexture(); + } + _initMatricesTexture() { + let t = Math.sqrt(this._maxInstanceCount * 4); + t = Math.ceil(t / 4) * 4, t = Math.max(t, 4); + let e = new Float32Array(t * t * 4), i = new Lt(e, t, t, Li, pi); + this._matricesTexture = i; + } + _initIndirectTexture() { + let t = Math.sqrt(this._maxInstanceCount); + t = Math.ceil(t); + let e = new Uint32Array(t * t), i = new Lt(e, t, t, Il, Wo); + this._indirectTexture = i; + } + _initColorsTexture() { + let t = Math.sqrt(this._maxInstanceCount); + t = Math.ceil(t); + let e = new Float32Array(t * t * 4).fill(1), i = new Lt(e, t, t, Li, pi); + i.colorSpace = Tt.workingColorSpace, this._colorsTexture = i; + } + _initializeGeometry(t) { + let e = this.geometry, i = this._maxVertexCount, s = this._maxIndexCount; + if (this._geometryInitialized === !1) { + for(let n in t.attributes){ + let r = t.getAttribute(n), { array: o , itemSize: a , normalized: l } = r, c = new o.constructor(i * a), u = new Z(c, a, l); + e.setAttribute(n, u); + } + if (t.getIndex() !== null) { + let n = i > 65535 ? new Uint32Array(s) : new Uint16Array(s); + e.setIndex(new Z(n, 1)); + } + this._geometryInitialized = !0; + } + } + _validateGeometry(t) { + let e = this.geometry; + if (!!t.getIndex() != !!e.getIndex()) throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".'); + for(let i in e.attributes){ + if (!t.hasAttribute(i)) throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`); + let s = t.getAttribute(i), n = e.getAttribute(i); + if (s.itemSize !== n.itemSize || s.normalized !== n.normalized) throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value."); + } + } + validateInstanceId(t) { + let e = this._instanceInfo; + if (t < 0 || t >= e.length || e[t].active === !1) throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`); + } + validateGeometryId(t) { + let e = this._geometryInfo; + if (t < 0 || t >= e.length || e[t].active === !1) throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`); + } + setCustomSort(t) { + return this.customSort = t, this; + } + computeBoundingBox() { + this.boundingBox === null && (this.boundingBox = new ft); + let t = this.boundingBox, e = this._instanceInfo; + t.makeEmpty(); + for(let i = 0, s = e.length; i < s; i++){ + if (e[i].active === !1) continue; + let n = e[i].geometryIndex; + this.getMatrixAt(i, Mt), this.getBoundingBoxAt(n, Ts).applyMatrix4(Mt), t.union(Ts); + } + } + computeBoundingSphere() { + this.boundingSphere === null && (this.boundingSphere = new ht); + let t = this.boundingSphere, e = this._instanceInfo; + t.makeEmpty(); + for(let i = 0, s = e.length; i < s; i++){ + if (e[i].active === !1) continue; + let n = e[i].geometryIndex; + this.getMatrixAt(i, Mt), this.getBoundingSphereAt(n, Fe).applyMatrix4(Mt), t.union(Fe); + } + } + addInstance(t) { + if (this._instanceInfo.length >= this.maxInstanceCount && this._availableInstanceIds.length === 0) throw new Error("THREE.BatchedMesh: Maximum item count reached."); + let i = { + visible: !0, + active: !0, + geometryIndex: t + }, s = null; + this._availableInstanceIds.length > 0 ? (this._availableInstanceIds.sort(tr), s = this._availableInstanceIds.shift(), this._instanceInfo[s] = i) : (s = this._instanceInfo.length, this._instanceInfo.push(i)); + let n = this._matricesTexture; + Mt.identity().toArray(n.image.data, s * 16), n.needsUpdate = !0; + let r = this._colorsTexture; + return r && (Du.toArray(r.image.data, s * 4), r.needsUpdate = !0), this._visibilityChanged = !0, s; + } + addGeometry(t, e = -1, i = -1) { + this._initializeGeometry(t), this._validateGeometry(t); + let s = { + vertexStart: -1, + vertexCount: -1, + reservedVertexCount: -1, + indexStart: -1, + indexCount: -1, + reservedIndexCount: -1, + start: -1, + count: -1, + boundingBox: null, + boundingSphere: null, + active: !0 + }, n = this._geometryInfo; + s.vertexStart = this._nextVertexStart, s.reservedVertexCount = e === -1 ? t.getAttribute("position").count : e; + let r = t.getIndex(); + if (r !== null && (s.indexStart = this._nextIndexStart, s.reservedIndexCount = i === -1 ? r.count : i), s.indexStart !== -1 && s.indexStart + s.reservedIndexCount > this._maxIndexCount || s.vertexStart + s.reservedVertexCount > this._maxVertexCount) throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size."); + let a; + return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(tr), a = this._availableGeometryIds.shift(), n[a] = s) : (a = this._geometryCount, this._geometryCount++, n.push(s)), this.setGeometryAt(a, t), this._nextIndexStart = s.indexStart + s.reservedIndexCount, this._nextVertexStart = s.vertexStart + s.reservedVertexCount, a; + } + setGeometryAt(t, e) { + if (t >= this._geometryCount) throw new Error("THREE.BatchedMesh: Maximum geometry count reached."); + this._validateGeometry(e); + let i = this.geometry, s = i.getIndex() !== null, n = i.getIndex(), r = e.getIndex(), o = this._geometryInfo[t]; + if (s && r.count > o.reservedIndexCount || e.attributes.position.count > o.reservedVertexCount) throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry."); + let a = o.vertexStart, l = o.reservedVertexCount; + o.vertexCount = e.getAttribute("position").count; + for(let c in i.attributes){ + let u = e.getAttribute(c), d = i.getAttribute(c); + Uu(u, d, a); + let p = u.itemSize; + for(let f = u.count, m = l; f < m; f++){ + let y1 = a + f; + for(let g = 0; g < p; g++)d.setComponent(y1, g, 0); + } + d.needsUpdate = !0, d.addUpdateRange(a * p, l * p); + } + if (s) { + let c = o.indexStart, u = o.reservedIndexCount; + o.indexCount = e.getIndex().count; + for(let d = 0; d < r.count; d++)n.setX(c + d, a + r.getX(d)); + for(let d = r.count, p = u; d < p; d++)n.setX(c + d, a); + n.needsUpdate = !0, n.addUpdateRange(c, o.reservedIndexCount); + } + return o.start = s ? o.indexStart : o.vertexStart, o.count = s ? o.indexCount : o.vertexCount, o.boundingBox = null, e.boundingBox !== null && (o.boundingBox = e.boundingBox.clone()), o.boundingSphere = null, e.boundingSphere !== null && (o.boundingSphere = e.boundingSphere.clone()), this._visibilityChanged = !0, t; + } + deleteGeometry(t) { + let e = this._geometryInfo; + if (t >= e.length || e[t].active === !1) return this; + let i = this._instanceInfo; + for(let s = 0, n = i.length; s < n; s++)i[s].active && i[s].geometryIndex === t && this.deleteInstance(s); + return e[t].active = !1, this._availableGeometryIds.push(t), this._visibilityChanged = !0, this; + } + deleteInstance(t) { + return this.validateInstanceId(t), this._instanceInfo[t].active = !1, this._availableInstanceIds.push(t), this._visibilityChanged = !0, this; + } + optimize() { + let t = 0, e = 0, i = this._geometryInfo, s = i.map((r, o)=>o).sort((r, o)=>i[r].vertexStart - i[o].vertexStart), n = this.geometry; + for(let r = 0, o = i.length; r < o; r++){ + let a = s[r], l = i[a]; + if (l.active !== !1) { + if (n.index !== null) { + if (l.indexStart !== e) { + let { indexStart: c , vertexStart: u , reservedIndexCount: d } = l, p = n.index, f = p.array, m = t - u; + for(let y1 = c; y1 < c + d; y1++)f[y1] = f[y1] + m; + p.array.copyWithin(e, c, c + d), p.addUpdateRange(e, d), l.indexStart = e; + } + e += l.reservedIndexCount; + } + if (l.vertexStart !== t) { + let { vertexStart: c , reservedVertexCount: u } = l, d = n.attributes; + for(let p in d){ + let f = d[p], { array: m , itemSize: y1 } = f; + m.copyWithin(t * y1, c * y1, (c + u) * y1), f.addUpdateRange(t * y1, u * y1); + } + l.vertexStart = t; + } + t += l.reservedVertexCount, l.start = n.index ? l.indexStart : l.vertexStart, this._nextIndexStart = n.index ? l.indexStart + l.reservedIndexCount : 0, this._nextVertexStart = l.vertexStart + l.reservedVertexCount; + } + } + return this; + } + getBoundingBoxAt(t, e) { + if (t >= this._geometryCount) return null; + let i = this.geometry, s = this._geometryInfo[t]; + if (s.boundingBox === null) { + let n = new ft, r = i.index, o = i.attributes.position; + for(let a = s.start, l = s.start + s.count; a < l; a++){ + let c = a; + r && (c = r.getX(c)), n.expandByPoint(Ri.fromBufferAttribute(o, c)); + } + s.boundingBox = n; + } + return e.copy(s.boundingBox), e; + } + getBoundingSphereAt(t, e) { + if (t >= this._geometryCount) return null; + let i = this.geometry, s = this._geometryInfo[t]; + if (s.boundingSphere === null) { + let n = new ht; + this.getBoundingBoxAt(t, Ts), Ts.getCenter(n.center); + let r = i.index, o = i.attributes.position, a = 0; + for(let l = s.start, c = s.start + s.count; l < c; l++){ + let u = l; + r && (u = r.getX(u)), Ri.fromBufferAttribute(o, u), a = Math.max(a, n.center.distanceToSquared(Ri)); + } + n.radius = Math.sqrt(a), s.boundingSphere = n; + } + return e.copy(s.boundingSphere), e; + } + setMatrixAt(t, e) { + this.validateInstanceId(t); + let i = this._matricesTexture, s = this._matricesTexture.image.data; + return e.toArray(s, t * 16), i.needsUpdate = !0, this; + } + getMatrixAt(t, e) { + return this.validateInstanceId(t), e.fromArray(this._matricesTexture.image.data, t * 16); + } + setColorAt(t, e) { + return this.validateInstanceId(t), this._colorsTexture === null && this._initColorsTexture(), e.toArray(this._colorsTexture.image.data, t * 4), this._colorsTexture.needsUpdate = !0, this; + } + getColorAt(t, e) { + return this.validateInstanceId(t), e.fromArray(this._colorsTexture.image.data, t * 4); + } + setVisibleAt(t, e) { + return this.validateInstanceId(t), this._instanceInfo[t].visible === e ? this : (this._instanceInfo[t].visible = e, this._visibilityChanged = !0, this); + } + getVisibleAt(t) { + return this.validateInstanceId(t), this._instanceInfo[t].visible; + } + setGeometryIdAt(t, e) { + return this.validateInstanceId(t), this.validateGeometryId(e), this._instanceInfo[t].geometryIndex = e, this; + } + getGeometryIdAt(t) { + return this.validateInstanceId(t), this._instanceInfo[t].geometryIndex; + } + getGeometryRangeAt(t, e = {}) { + this.validateGeometryId(t); + let i = this._geometryInfo[t]; + return e.vertexStart = i.vertexStart, e.vertexCount = i.vertexCount, e.reservedVertexCount = i.reservedVertexCount, e.indexStart = i.indexStart, e.indexCount = i.indexCount, e.reservedIndexCount = i.reservedIndexCount, e.start = i.start, e.count = i.count, e; + } + setInstanceCount(t) { + let e = this._availableInstanceIds, i = this._instanceInfo; + for(e.sort(tr); e[e.length - 1] === i.length;)i.pop(), e.pop(); + if (t < i.length) throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`); + let s = new Int32Array(t), n = new Int32Array(t); + Be(this._multiDrawCounts, s), Be(this._multiDrawStarts, n), this._multiDrawCounts = s, this._multiDrawStarts = n, this._maxInstanceCount = t; + let r = this._indirectTexture, o = this._matricesTexture, a = this._colorsTexture; + r.dispose(), this._initIndirectTexture(), Be(r.image.data, this._indirectTexture.image.data), o.dispose(), this._initMatricesTexture(), Be(o.image.data, this._matricesTexture.image.data), a && (a.dispose(), this._initColorsTexture(), Be(a.image.data, this._colorsTexture.image.data)); + } + setGeometrySize(t, e) { + let i = [ + ...this._geometryInfo + ].filter((o)=>o.active); + if (Math.max(...i.map((o)=>o.vertexStart + o.reservedVertexCount)) > t) throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`); + if (this.geometry.index && Math.max(...i.map((a)=>a.indexStart + a.reservedIndexCount)) > e) throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`); + let n = this.geometry; + n.dispose(), this._maxVertexCount = t, this._maxIndexCount = e, this._geometryInitialized && (this._geometryInitialized = !1, this.geometry = new L, this._initializeGeometry(n)); + let r = this.geometry; + n.index && Be(n.index.array, r.index.array); + for(let o in n.attributes)Be(n.attributes[o].array, r.attributes[o].array); + } + raycast(t, e) { + let i = this._instanceInfo, s = this._geometryInfo, n = this.matrixWorld, r = this.geometry; + pt.material = this.material, pt.geometry.index = r.index, pt.geometry.attributes = r.attributes, pt.geometry.boundingBox === null && (pt.geometry.boundingBox = new ft), pt.geometry.boundingSphere === null && (pt.geometry.boundingSphere = new ht); + for(let o = 0, a = i.length; o < a; o++){ + if (!i[o].visible || !i[o].active) continue; + let l = i[o].geometryIndex, c = s[l]; + pt.geometry.setDrawRange(c.start, c.count), this.getMatrixAt(o, pt.matrixWorld).premultiply(n), this.getBoundingBoxAt(l, pt.geometry.boundingBox), this.getBoundingSphereAt(l, pt.geometry.boundingSphere), pt.raycast(t, Is); + for(let u = 0, d = Is.length; u < d; u++){ + let p = Is[u]; + p.object = this, p.batchId = o, e.push(p); + } + Is.length = 0; + } + pt.material = null, pt.geometry.index = null, pt.geometry.attributes = {}, pt.geometry.setDrawRange(0, 1 / 0); + } + copy(t) { + return super.copy(t), this.geometry = t.geometry.clone(), this.perObjectFrustumCulled = t.perObjectFrustumCulled, this.sortObjects = t.sortObjects, this.boundingBox = t.boundingBox !== null ? t.boundingBox.clone() : null, this.boundingSphere = t.boundingSphere !== null ? t.boundingSphere.clone() : null, this._geometryInfo = t._geometryInfo.map((e)=>({ + ...e, + boundingBox: e.boundingBox !== null ? e.boundingBox.clone() : null, + boundingSphere: e.boundingSphere !== null ? e.boundingSphere.clone() : null + })), this._instanceInfo = t._instanceInfo.map((e)=>({ + ...e + })), this._maxInstanceCount = t._maxInstanceCount, this._maxVertexCount = t._maxVertexCount, this._maxIndexCount = t._maxIndexCount, this._geometryInitialized = t._geometryInitialized, this._geometryCount = t._geometryCount, this._multiDrawCounts = t._multiDrawCounts.slice(), this._multiDrawStarts = t._multiDrawStarts.slice(), this._matricesTexture = t._matricesTexture.clone(), this._matricesTexture.image.data = this._matricesTexture.image.data.slice(), this._colorsTexture !== null && (this._colorsTexture = t._colorsTexture.clone(), this._colorsTexture.image.data = this._colorsTexture.image.data.slice()), this; + } + dispose() { + return this.geometry.dispose(), this._matricesTexture.dispose(), this._matricesTexture = null, this._indirectTexture.dispose(), this._indirectTexture = null, this._colorsTexture !== null && (this._colorsTexture.dispose(), this._colorsTexture = null), this; + } + onBeforeRender(t, e, i, s, n) { + if (!this._visibilityChanged && !this.perObjectFrustumCulled && !this.sortObjects) return; + let r = s.getIndex(), o = r === null ? 1 : r.array.BYTES_PER_ELEMENT, a = this._instanceInfo, l = this._multiDrawStarts, c = this._multiDrawCounts, u = this._geometryInfo, d = this.perObjectFrustumCulled, p = this._indirectTexture, f = p.image.data; + d && (Mt.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse).multiply(this.matrixWorld), er.setFromProjectionMatrix(Mt, t.coordinateSystem)); + let m = 0; + if (this.sortObjects) { + Mt.copy(this.matrixWorld).invert(), Ri.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Mt), $a.set(0, 0, -1).transformDirection(i.matrixWorld).transformDirection(Mt); + for(let x1 = 0, b = a.length; x1 < b; x1++)if (a[x1].visible && a[x1].active) { + let M = a[x1].geometryIndex; + this.getMatrixAt(x1, Mt), this.getBoundingSphereAt(M, Fe).applyMatrix4(Mt); + let _ = !1; + if (d && (_ = !er.intersectsSphere(Fe)), !_) { + let v = u[M], S = Lu.subVectors(Fe.center, Ri).dot($a); + ir.push(v.start, v.count, S, x1); + } + } + let y1 = ir.list, g = this.customSort; + g === null ? y1.sort(n.transparent ? Vu : Nu) : g.call(this, y1, i); + for(let x1 = 0, b = y1.length; x1 < b; x1++){ + let M = y1[x1]; + l[m] = M.start * o, c[m] = M.count, f[m] = M.index, m++; + } + ir.reset(); + } else for(let y1 = 0, g = a.length; y1 < g; y1++)if (a[y1].visible && a[y1].active) { + let x1 = a[y1].geometryIndex, b = !1; + if (d && (this.getMatrixAt(y1, Mt), this.getBoundingSphereAt(x1, Fe).applyMatrix4(Mt), b = !er.intersectsSphere(Fe)), !b) { + let M = u[x1]; + l[m] = M.start * o, c[m] = M.count, f[m] = y1, m++; + } + } + p.needsUpdate = !0, this._multiDrawCount = m, this._visibilityChanged = !1; + } + onBeforeShadow(t, e, i, s, n, r) { + this.onBeforeRender(t, null, s, n, r); + } +}, mt = class extends ct { + constructor(t){ + super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new P(16777215), this.map = null, this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.linewidth = t.linewidth, this.linecap = t.linecap, this.linejoin = t.linejoin, this.fog = t.fog, this; + } +}, nn = new w, rn = new w, Qa = new D, ki = new Le, Cs = new ht, sr = new w, ja = new w, le = class extends G { + constructor(t = new L, e = new mt){ + super(), this.isLine = !0, this.type = "Line", this.geometry = t, this.material = e, this.updateMorphTargets(); + } + copy(t, e) { + return super.copy(t, e), this.material = Array.isArray(t.material) ? t.material.slice() : t.material, this.geometry = t.geometry, this; + } + computeLineDistances() { + let t = this.geometry; + if (t.index === null) { + let e = t.attributes.position, i = [ + 0 + ]; + for(let s = 1, n = e.count; s < n; s++)nn.fromBufferAttribute(e, s - 1), rn.fromBufferAttribute(e, s), i[s] = i[s - 1], i[s] += nn.distanceTo(rn); + t.setAttribute("lineDistance", new E(i, 1)); + } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); + return this; + } + raycast(t, e) { + let i = this.geometry, s = this.matrixWorld, n = t.params.Line.threshold, r = i.drawRange; + if (i.boundingSphere === null && i.computeBoundingSphere(), Cs.copy(i.boundingSphere), Cs.applyMatrix4(s), Cs.radius += n, t.ray.intersectsSphere(Cs) === !1) return; + Qa.copy(s).invert(), ki.copy(t.ray).applyMatrix4(Qa); + let o = n / ((this.scale.x + this.scale.y + this.scale.z) / 3), a = o * o, l = this.isLineSegments ? 2 : 1, c = i.index, d = i.attributes.position; + if (c !== null) { + let p = Math.max(0, r.start), f = Math.min(c.count, r.start + r.count); + for(let m = p, y1 = f - 1; m < y1; m += l){ + let g = c.getX(m), x1 = c.getX(m + 1), b = zs(this, t, ki, a, g, x1, m); + b && e.push(b); + } + if (this.isLineLoop) { + let m = c.getX(f - 1), y1 = c.getX(p), g = zs(this, t, ki, a, m, y1, f - 1); + g && e.push(g); + } + } else { + let p = Math.max(0, r.start), f = Math.min(d.count, r.start + r.count); + for(let m = p, y1 = f - 1; m < y1; m += l){ + let g = zs(this, t, ki, a, m, m + 1, m); + g && e.push(g); + } + if (this.isLineLoop) { + let m = zs(this, t, ki, a, f - 1, p, f - 1); + m && e.push(m); + } + } + } + updateMorphTargets() { + let e = this.geometry.morphAttributes, i = Object.keys(e); + if (i.length > 0) { + let s = e[i[0]]; + if (s !== void 0) { + this.morphTargetInfluences = [], this.morphTargetDictionary = {}; + for(let n = 0, r = s.length; n < r; n++){ + let o = s[n].name || String(n); + this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = n; + } + } + } + } }; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; +function zs(h, t, e, i, s, n, r) { + let o = h.geometry.attributes.position; + if (nn.fromBufferAttribute(o, s), rn.fromBufferAttribute(o, n), e.distanceSqToSegment(nn, rn, sr, ja) > i) return; + sr.applyMatrix4(h.matrixWorld); + let l = t.ray.origin.distanceTo(sr); + if (!(l < t.near || l > t.far)) return { + distance: l, + point: ja.clone().applyMatrix4(h.matrixWorld), + index: r, + face: null, + faceIndex: null, + barycoord: null, + object: h + }; +} +var Ka = new w, th = new w, Wt = class extends le { + constructor(t, e){ + super(t, e), this.isLineSegments = !0, this.type = "LineSegments"; + } + computeLineDistances() { + let t = this.geometry; + if (t.index === null) { + let e = t.attributes.position, i = []; + for(let s = 0, n = e.count; s < n; s += 2)Ka.fromBufferAttribute(e, s), th.fromBufferAttribute(e, s + 1), i[s] = s === 0 ? 0 : i[s - 1], i[s + 1] = i[s] + Ka.distanceTo(th); + t.setAttribute("lineDistance", new E(i, 1)); + } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); + return this; + } +}, Fr = class extends le { + constructor(t, e){ + super(t, e), this.isLineLoop = !0, this.type = "LineLoop"; + } +}, on = class extends ct { + constructor(t){ + super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new P(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.alphaMap = t.alphaMap, this.size = t.size, this.sizeAttenuation = t.sizeAttenuation, this.fog = t.fog, this; + } +}, eh = new D, Br = new Le, Fs = new ht, Bs = new w, Er = class extends G { + constructor(t = new L, e = new on){ + super(), this.isPoints = !0, this.type = "Points", this.geometry = t, this.material = e, this.updateMorphTargets(); + } + copy(t, e) { + return super.copy(t, e), this.material = Array.isArray(t.material) ? t.material.slice() : t.material, this.geometry = t.geometry, this; + } + raycast(t, e) { + let i = this.geometry, s = this.matrixWorld, n = t.params.Points.threshold, r = i.drawRange; + if (i.boundingSphere === null && i.computeBoundingSphere(), Fs.copy(i.boundingSphere), Fs.applyMatrix4(s), Fs.radius += n, t.ray.intersectsSphere(Fs) === !1) return; + eh.copy(s).invert(), Br.copy(t.ray).applyMatrix4(eh); + let o = n / ((this.scale.x + this.scale.y + this.scale.z) / 3), a = o * o, l = i.index, u = i.attributes.position; + if (l !== null) { + let d = Math.max(0, r.start), p = Math.min(l.count, r.start + r.count); + for(let f = d, m = p; f < m; f++){ + let y1 = l.getX(f); + Bs.fromBufferAttribute(u, y1), ih(Bs, y1, a, s, t, e, this); + } + } else { + let d = Math.max(0, r.start), p = Math.min(u.count, r.start + r.count); + for(let f = d, m = p; f < m; f++)Bs.fromBufferAttribute(u, f), ih(Bs, f, a, s, t, e, this); + } + } + updateMorphTargets() { + let e = this.geometry.morphAttributes, i = Object.keys(e); + if (i.length > 0) { + let s = e[i[0]]; + if (s !== void 0) { + this.morphTargetInfluences = [], this.morphTargetDictionary = {}; + for(let n = 0, r = s.length; n < r; n++){ + let o = s[n].name || String(n); + this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = n; + } + } + } + } }; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +function ih(h, t, e, i, s, n, r) { + let o = Br.distanceSqToPoint(h); + if (o < e) { + let a = new w; + Br.closestPointToPoint(h, a), a.applyMatrix4(i); + let l = s.ray.origin.distanceTo(a); + if (l < s.near || l > s.far) return; + n.push({ + distance: l, + distanceToRay: Math.sqrt(o), + point: a, + index: t, + face: null, + faceIndex: null, + barycoord: null, + object: r + }); + } } -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +var Rr = class extends lt { + constructor(t, e, i, s, n, r, o, a, l){ + super(t, e, i, s, n, r, o, a, l), this.isVideoTexture = !0, this.minFilter = r !== void 0 ? r : Et, this.magFilter = n !== void 0 ? n : Et, this.generateMipmaps = !1; + let c = this; + function u() { + c.needsUpdate = !0, t.requestVideoFrameCallback(u); + } + "requestVideoFrameCallback" in t && t.requestVideoFrameCallback(u); + } + clone() { + return new this.constructor(this.image).copy(this); + } + update() { + let t = this.image; + "requestVideoFrameCallback" in t === !1 && t.readyState >= t.HAVE_CURRENT_DATA && (this.needsUpdate = !0); + } +}, sh = class extends Rr { + constructor(t, e, i, s, n, r, o, a){ + super({}, t, e, i, s, n, r, o, a), this.isVideoFrameTexture = !0; + } + update() {} + clone() { + return new this.constructor().copy(this); + } + setFrame(t) { + this.image = t, this.needsUpdate = !0; + } +}, nh = class extends lt { + constructor(t, e){ + super({ + width: t, + height: e + }), this.isFramebufferTexture = !0, this.magFilter = Ut, this.minFilter = Ut, this.generateMipmaps = !1, this.needsUpdate = !0; + } +}, Zi = class extends lt { + constructor(t, e, i, s, n, r, o, a, l, c, u, d){ + super(null, r, o, a, l, c, s, n, u, d), this.isCompressedTexture = !0, this.image = { + width: e, + height: i + }, this.mipmaps = t, this.flipY = !1, this.generateMipmaps = !1; + } +}, rh = class extends Zi { + constructor(t, e, i, s, n, r){ + super(t, e, i, n, r), this.isCompressedArrayTexture = !0, this.image.depth = s, this.wrapR = Ht, this.layerUpdates = new Set; + } + addLayerUpdate(t) { + this.layerUpdates.add(t); + } + clearLayerUpdates() { + this.layerUpdates.clear(); + } +}, oh = class extends Zi { + constructor(t, e, i){ + super(void 0, t[0].width, t[0].height, e, i, Uo), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = t; + } +}, ah = class extends lt { + constructor(t, e, i, s, n, r, o, a, l){ + super(t, e, i, s, n, r, o, a, l), this.isCanvasTexture = !0, this.needsUpdate = !0; + } +}, hh = class extends lt { + constructor(t, e, i, s, n, r, o, a, l, c = Cn){ + if (c !== Cn && c !== aa) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); + i === void 0 && c === Cn && (i = Wo), i === void 0 && c === aa && (i = sc), super(null, s, n, r, o, a, c, i, l), this.isDepthTexture = !0, this.image = { + width: t, + height: e + }, this.magFilter = o !== void 0 ? o : Ut, this.minFilter = a !== void 0 ? a : Ut, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null; + } + copy(t) { + return super.copy(t), this.compareFunction = t.compareFunction, this; + } + toJSON(t) { + let e = super.toJSON(t); + return this.compareFunction !== null && (e.compareFunction = this.compareFunction), e; + } +}, Rt = class { + constructor(){ + this.type = "Curve", this.arcLengthDivisions = 200; + } + getPoint() { + return console.warn("THREE.Curve: .getPoint() not implemented."), null; + } + getPointAt(t, e) { + let i = this.getUtoTmapping(t); + return this.getPoint(i, e); + } + getPoints(t = 5) { + let e = []; + for(let i = 0; i <= t; i++)e.push(this.getPoint(i / t)); + return e; + } + getSpacedPoints(t = 5) { + let e = []; + for(let i = 0; i <= t; i++)e.push(this.getPointAt(i / t)); + return e; + } + getLength() { + let t = this.getLengths(); + return t[t.length - 1]; + } + getLengths(t = this.arcLengthDivisions) { + if (this.cacheArcLengths && this.cacheArcLengths.length === t + 1 && !this.needsUpdate) return this.cacheArcLengths; + this.needsUpdate = !1; + let e = [], i, s = this.getPoint(0), n = 0; + e.push(0); + for(let r = 1; r <= t; r++)i = this.getPoint(r / t), n += i.distanceTo(s), e.push(n), s = i; + return this.cacheArcLengths = e, e; + } + updateArcLengths() { + this.needsUpdate = !0, this.getLengths(); + } + getUtoTmapping(t, e) { + let i = this.getLengths(), s = 0, n = i.length, r; + e ? r = e : r = t * i[n - 1]; + let o = 0, a = n - 1, l; + for(; o <= a;)if (s = Math.floor(o + (a - o) / 2), l = i[s] - r, l < 0) o = s + 1; + else if (l > 0) a = s - 1; + else { + a = s; + break; + } + if (s = a, i[s] === r) return s / (n - 1); + let c = i[s], d = i[s + 1] - c, p = (r - c) / d; + return (s + p) / (n - 1); + } + getTangent(t, e) { + let s = t - 1e-4, n = t + 1e-4; + s < 0 && (s = 0), n > 1 && (n = 1); + let r = this.getPoint(s), o = this.getPoint(n), a = e || (r.isVector2 ? new T : new w); + return a.copy(o).sub(r).normalize(), a; + } + getTangentAt(t, e) { + let i = this.getUtoTmapping(t); + return this.getTangent(i, e); + } + computeFrenetFrames(t, e) { + let i = new w, s = [], n = [], r = [], o = new w, a = new D; + for(let p = 0; p <= t; p++){ + let f = p / t; + s[p] = this.getTangentAt(f, new w); + } + n[0] = new w, r[0] = new w; + let l = Number.MAX_VALUE, c = Math.abs(s[0].x), u = Math.abs(s[0].y), d = Math.abs(s[0].z); + c <= l && (l = c, i.set(1, 0, 0)), u <= l && (l = u, i.set(0, 1, 0)), d <= l && i.set(0, 0, 1), o.crossVectors(s[0], i).normalize(), n[0].crossVectors(s[0], o), r[0].crossVectors(s[0], n[0]); + for(let p = 1; p <= t; p++){ + if (n[p] = n[p - 1].clone(), r[p] = r[p - 1].clone(), o.crossVectors(s[p - 1], s[p]), o.length() > Number.EPSILON) { + o.normalize(); + let f = Math.acos(N(s[p - 1].dot(s[p]), -1, 1)); + n[p].applyMatrix4(a.makeRotationAxis(o, f)); + } + r[p].crossVectors(s[p], n[p]); + } + if (e === !0) { + let p = Math.acos(N(n[0].dot(n[t]), -1, 1)); + p /= t, s[0].dot(o.crossVectors(n[0], n[t])) > 0 && (p = -p); + for(let f = 1; f <= t; f++)n[f].applyMatrix4(a.makeRotationAxis(s[f], p * f)), r[f].crossVectors(s[f], n[f]); + } + return { + tangents: s, + normals: n, + binormals: r + }; + } + clone() { + return new this.constructor().copy(this); + } + copy(t) { + return this.arcLengthDivisions = t.arcLengthDivisions, this; + } + toJSON() { + let t = { + metadata: { + version: 4.6, + type: "Curve", + generator: "Curve.toJSON" + } + }; + return t.arcLengthDivisions = this.arcLengthDivisions, t.type = this.type, t; + } + fromJSON(t) { + return this.arcLengthDivisions = t.arcLengthDivisions, this; + } +}, Yi = class extends Rt { + constructor(t = 0, e = 0, i = 1, s = 1, n = 0, r = Math.PI * 2, o = !1, a = 0){ + super(), this.isEllipseCurve = !0, this.type = "EllipseCurve", this.aX = t, this.aY = e, this.xRadius = i, this.yRadius = s, this.aStartAngle = n, this.aEndAngle = r, this.aClockwise = o, this.aRotation = a; + } + getPoint(t, e = new T) { + let i = e, s = Math.PI * 2, n = this.aEndAngle - this.aStartAngle, r = Math.abs(n) < Number.EPSILON; + for(; n < 0;)n += s; + for(; n > s;)n -= s; + n < Number.EPSILON && (r ? n = 0 : n = s), this.aClockwise === !0 && !r && (n === s ? n = -s : n = n - s); + let o = this.aStartAngle + t * n, a = this.aX + this.xRadius * Math.cos(o), l = this.aY + this.yRadius * Math.sin(o); + if (this.aRotation !== 0) { + let c = Math.cos(this.aRotation), u = Math.sin(this.aRotation), d = a - this.aX, p = l - this.aY; + a = d * c - p * u + this.aX, l = d * u + p * c + this.aY; + } + return i.set(a, l); + } + copy(t) { + return super.copy(t), this.aX = t.aX, this.aY = t.aY, this.xRadius = t.xRadius, this.yRadius = t.yRadius, this.aStartAngle = t.aStartAngle, this.aEndAngle = t.aEndAngle, this.aClockwise = t.aClockwise, this.aRotation = t.aRotation, this; + } + toJSON() { + let t = super.toJSON(); + return t.aX = this.aX, t.aY = this.aY, t.xRadius = this.xRadius, t.yRadius = this.yRadius, t.aStartAngle = this.aStartAngle, t.aEndAngle = this.aEndAngle, t.aClockwise = this.aClockwise, t.aRotation = this.aRotation, t; + } + fromJSON(t) { + return super.fromJSON(t), this.aX = t.aX, this.aY = t.aY, this.xRadius = t.xRadius, this.yRadius = t.yRadius, this.aStartAngle = t.aStartAngle, this.aEndAngle = t.aEndAngle, this.aClockwise = t.aClockwise, this.aRotation = t.aRotation, this; + } +}, kr = class extends Yi { + constructor(t, e, i, s, n, r){ + super(t, e, i, i, s, n, r), this.isArcCurve = !0, this.type = "ArcCurve"; + } +}; +function Go() { + let h = 0, t = 0, e = 0, i = 0; + function s(n, r, o, a) { + h = n, t = o, e = -3 * n + 3 * r - 2 * o - a, i = 2 * n - 2 * r + o + a; + } + return { + initCatmullRom: function(n, r, o, a, l) { + s(r, o, l * (o - n), l * (a - r)); + }, + initNonuniformCatmullRom: function(n, r, o, a, l, c, u) { + let d = (r - n) / l - (o - n) / (l + c) + (o - r) / c, p = (o - r) / c - (a - r) / (c + u) + (a - o) / u; + d *= c, p *= c, s(r, o, d, p); + }, + calc: function(n) { + let r = n * n, o = r * n; + return h + t * n + e * r + i * o; + } + }; } -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); - return dot( weights, rgb ); -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); +var Es = new w, nr = new Go, rr = new Go, or = new Go, Pr = class extends Rt { + constructor(t = [], e = !1, i = "centripetal", s = .5){ + super(), this.isCatmullRomCurve3 = !0, this.type = "CatmullRomCurve3", this.points = t, this.closed = e, this.curveType = i, this.tension = s; + } + getPoint(t, e = new w) { + let i = e, s = this.points, n = s.length, r = (n - (this.closed ? 0 : 1)) * t, o = Math.floor(r), a = r - o; + this.closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / n) + 1) * n : a === 0 && o === n - 1 && (o = n - 2, a = 1); + let l, c; + this.closed || o > 0 ? l = s[(o - 1) % n] : (Es.subVectors(s[0], s[1]).add(s[0]), l = Es); + let u = s[o % n], d = s[(o + 1) % n]; + if (this.closed || o + 2 < n ? c = s[(o + 2) % n] : (Es.subVectors(s[n - 1], s[n - 2]).add(s[n - 1]), c = Es), this.curveType === "centripetal" || this.curveType === "chordal") { + let p = this.curveType === "chordal" ? .5 : .25, f = Math.pow(l.distanceToSquared(u), p), m = Math.pow(u.distanceToSquared(d), p), y1 = Math.pow(d.distanceToSquared(c), p); + m < 1e-4 && (m = 1), f < 1e-4 && (f = m), y1 < 1e-4 && (y1 = m), nr.initNonuniformCatmullRom(l.x, u.x, d.x, c.x, f, m, y1), rr.initNonuniformCatmullRom(l.y, u.y, d.y, c.y, f, m, y1), or.initNonuniformCatmullRom(l.z, u.z, d.z, c.z, f, m, y1); + } else this.curveType === "catmullrom" && (nr.initCatmullRom(l.x, u.x, d.x, c.x, this.tension), rr.initCatmullRom(l.y, u.y, d.y, c.y, this.tension), or.initCatmullRom(l.z, u.z, d.z, c.z, this.tension)); + return i.set(nr.calc(a), rr.calc(a), or.calc(a)), i; + } + copy(t) { + super.copy(t), this.points = []; + for(let e = 0, i = t.points.length; e < i; e++){ + let s = t.points[e]; + this.points.push(s.clone()); + } + return this.closed = t.closed, this.curveType = t.curveType, this.tension = t.tension, this; + } + toJSON() { + let t = super.toJSON(); + t.points = []; + for(let e = 0, i = this.points.length; e < i; e++){ + let s = this.points[e]; + t.points.push(s.toArray()); + } + return t.closed = this.closed, t.curveType = this.curveType, t.tension = this.tension, t; + } + fromJSON(t) { + super.fromJSON(t), this.points = []; + for(let e = 0, i = t.points.length; e < i; e++){ + let s = t.points[e]; + this.points.push(new w().fromArray(s)); + } + return this.closed = t.closed, this.curveType = t.curveType, this.tension = t.tension, this; + } +}; +function lh(h, t, e, i, s) { + let n = (i - t) * .5, r = (s - e) * .5, o = h * h, a = h * o; + return (2 * e - 2 * i + n + r) * a + (-3 * e + 3 * i - 2 * n - r) * o + n * h + e; } -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; +function Wu(h, t) { + let e = 1 - h; + return e * e * t; } -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +function Hu(h, t) { + return 2 * (1 - h) * h * t; } -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`, qp = `#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_v0 0.339 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_v1 0.276 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_v4 0.046 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_v5 0.016 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_v6 0.0038 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`, Yp = `vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`, Zp = `#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`, Jp = `#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`, $p = `#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`, Kp = `#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`, Qp = "gl_FragColor = linearToOutputTexel( gl_FragColor );", jp = ` -const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( - vec3( 0.8224621, 0.177538, 0.0 ), - vec3( 0.0331941, 0.9668058, 0.0 ), - vec3( 0.0170827, 0.0723974, 0.9105199 ) -); -const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( - vec3( 1.2249401, - 0.2249404, 0.0 ), - vec3( - 0.0420569, 1.0420571, 0.0 ), - vec3( - 0.0196376, - 0.0786361, 1.0982735 ) -); -vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { - return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +function qu(h, t) { + return h * h * t; } -vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { - return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +function Vi(h, t, e, i) { + return Wu(h, t) + Hu(h, e) + qu(h, i); } -vec4 LinearTransferOETF( in vec4 value ) { - return value; +function Gu(h, t) { + let e = 1 - h; + return e * e * e * t; } -vec4 sRGBTransferOETF( in vec4 value ) { - 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 ); +function Xu(h, t) { + let e = 1 - h; + return 3 * e * e * h * t; } -vec4 LinearToLinear( in vec4 value ) { - return value; +function Ju(h, t) { + return 3 * (1 - h) * h * h * t; } -vec4 LinearTosRGB( in vec4 value ) { - return sRGBTransferOETF( value ); -}`, em = `#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`, tm = `#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`, nm = `#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`, im = `#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`, sm = `#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`, rm = `#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`, am = `#ifdef USE_FOG - varying float vFogDepth; -#endif`, om = `#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`, cm = `#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`, lm = `#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`, hm = `#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`, um = `#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`, dm = `LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`, fm = `varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +function Zu(h, t) { + return h * h * h * t; } -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +function Di(h, t, e, i, s) { + return Gu(h, t) + Xu(h, e) + Ju(h, i) + Zu(h, s); } -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, pm = `uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - #if defined ( LEGACY_LIGHTS ) - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #else - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #endif -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`, mm = `#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`, gm = `ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`, _m = `varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, xm = `BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`, vm = `varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, ym = `PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y; -#endif`, Mm = `struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = vec3( 0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void 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 ) { -#else -void 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 ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`, Sm = ` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal; -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`, bm = `#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`, Em = `#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`, Tm = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`, wm = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`, Am = `#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`, Rm = `#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`, Cm = `#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - 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 ); - - #endif - diffuseColor *= sampledDiffuseColor; -#endif`, Pm = `#ifdef USE_MAP - uniform sampler2D map; -#endif`, Lm = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`, Im = `#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`, Um = `float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`, Dm = `#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`, Nm = `#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`, Om = `#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`, Fm = `#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`, Bm = `#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`, zm = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`, Vm = `#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`, km = `#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`, Hm = `#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`, Gm = `#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`, Wm = `#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`, Xm = `#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`, qm = `#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`, Ym = `#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`, Zm = `#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`, Jm = `#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, $m = `vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; -const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec2 packDepthToRG( in highp float v ) { - return packDepthToRGBA( v ).yx; -} -float unpackRGToDepth( const in highp vec2 v ) { - return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); -} -vec4 pack2HalfToRGBA( vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`, Km = `#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`, Qm = `vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`, jm = `#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`, eg = `#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`, tg = `float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`, ng = `#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`, ig = `#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - 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 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return shadow; - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`, sg = `#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`, rg = `#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`, ag = `float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`, og = `#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`, cg = `#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`, lg = `#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`, hg = `#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`, ug = `float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`, dg = `#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`, fg = `#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`, pg = `#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 OptimizedCineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`, mg = `#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`, gg = `#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`, _g = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`, xg = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`, vg = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`, yg = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`, Mg = `varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`, Sg = `uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - 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 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`, bg = `varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`, Eg = `#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`, Tg = `varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`, wg = `uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`, Ag = `#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`, Rg = `#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #endif -}`, Cg = `#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`, Pg = `#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`, Lg = `varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`, Ig = `uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`, Ug = `uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, Dg = `uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`, Ng = `#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, Og = `uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`, Fg = `#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`, Bg = `#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`, zg = `#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`, Vg = `#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`, kg = `#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`, Hg = `#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`, Gg = `#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`, Wg = `#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`, Xg = `#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`, qg = `#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`, Yg = `#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`, Zg = `#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`, Jg = `uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`, $g = `uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`, Kg = `#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`, Qg = `uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`, jg = `uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`, e_ = `uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`, ke = { - alphahash_fragment: Ep, - alphahash_pars_fragment: Tp, - alphamap_fragment: wp, - alphamap_pars_fragment: Ap, - alphatest_fragment: Rp, - alphatest_pars_fragment: Cp, - aomap_fragment: Pp, - aomap_pars_fragment: Lp, - begin_vertex: Ip, - beginnormal_vertex: Up, - bsdfs: Dp, - iridescence_fragment: Np, - bumpmap_pars_fragment: Op, - clipping_planes_fragment: Fp, - clipping_planes_pars_fragment: Bp, - clipping_planes_pars_vertex: zp, - clipping_planes_vertex: Vp, - color_fragment: kp, - color_pars_fragment: Hp, - color_pars_vertex: Gp, - color_vertex: Wp, - common: Xp, - cube_uv_reflection_fragment: qp, - defaultnormal_vertex: Yp, - displacementmap_pars_vertex: Zp, - displacementmap_vertex: Jp, - emissivemap_fragment: $p, - emissivemap_pars_fragment: Kp, - colorspace_fragment: Qp, - colorspace_pars_fragment: jp, - envmap_fragment: em, - envmap_common_pars_fragment: tm, - envmap_pars_fragment: nm, - envmap_pars_vertex: im, - envmap_physical_pars_fragment: mm, - envmap_vertex: sm, - fog_vertex: rm, - fog_pars_vertex: am, - fog_fragment: om, - fog_pars_fragment: cm, - gradientmap_pars_fragment: lm, - lightmap_fragment: hm, - lightmap_pars_fragment: um, - lights_lambert_fragment: dm, - lights_lambert_pars_fragment: fm, - lights_pars_begin: pm, - lights_toon_fragment: gm, - lights_toon_pars_fragment: _m, - lights_phong_fragment: xm, - lights_phong_pars_fragment: vm, - lights_physical_fragment: ym, - lights_physical_pars_fragment: Mm, - lights_fragment_begin: Sm, - lights_fragment_maps: bm, - lights_fragment_end: Em, - logdepthbuf_fragment: Tm, - logdepthbuf_pars_fragment: wm, - logdepthbuf_pars_vertex: Am, - logdepthbuf_vertex: Rm, - map_fragment: Cm, - map_pars_fragment: Pm, - map_particle_fragment: Lm, - map_particle_pars_fragment: Im, - metalnessmap_fragment: Um, - metalnessmap_pars_fragment: Dm, - morphcolor_vertex: Nm, - morphnormal_vertex: Om, - morphtarget_pars_vertex: Fm, - morphtarget_vertex: Bm, - normal_fragment_begin: zm, - normal_fragment_maps: Vm, - normal_pars_fragment: km, - normal_pars_vertex: Hm, - normal_vertex: Gm, - normalmap_pars_fragment: Wm, - clearcoat_normal_fragment_begin: Xm, - clearcoat_normal_fragment_maps: qm, - clearcoat_pars_fragment: Ym, - iridescence_pars_fragment: Zm, - opaque_fragment: Jm, - packing: $m, - premultiplied_alpha_fragment: Km, - project_vertex: Qm, - dithering_fragment: jm, - dithering_pars_fragment: eg, - roughnessmap_fragment: tg, - roughnessmap_pars_fragment: ng, - shadowmap_pars_fragment: ig, - shadowmap_pars_vertex: sg, - shadowmap_vertex: rg, - shadowmask_pars_fragment: ag, - skinbase_vertex: og, - skinning_pars_vertex: cg, - skinning_vertex: lg, - skinnormal_vertex: hg, - specularmap_fragment: ug, - specularmap_pars_fragment: dg, - tonemapping_fragment: fg, - tonemapping_pars_fragment: pg, - transmission_fragment: mg, - transmission_pars_fragment: gg, - uv_pars_fragment: _g, - uv_pars_vertex: xg, - uv_vertex: vg, - worldpos_vertex: yg, - background_vert: Mg, - background_frag: Sg, - backgroundCube_vert: bg, - backgroundCube_frag: Eg, - cube_vert: Tg, - cube_frag: wg, - depth_vert: Ag, - depth_frag: Rg, - distanceRGBA_vert: Cg, - distanceRGBA_frag: Pg, - equirect_vert: Lg, - equirect_frag: Ig, - linedashed_vert: Ug, - linedashed_frag: Dg, - meshbasic_vert: Ng, - meshbasic_frag: Og, - meshlambert_vert: Fg, - meshlambert_frag: Bg, - meshmatcap_vert: zg, - meshmatcap_frag: Vg, - meshnormal_vert: kg, - meshnormal_frag: Hg, - meshphong_vert: Gg, - meshphong_frag: Wg, - meshphysical_vert: Xg, - meshphysical_frag: qg, - meshtoon_vert: Yg, - meshtoon_frag: Zg, - points_vert: Jg, - points_frag: $g, - shadow_vert: Kg, - shadow_frag: Qg, - sprite_vert: jg, - sprite_frag: e_ -}, le = { - common: { - diffuse: { - value: new pe(16777215) - }, - opacity: { - value: 1 - }, - map: { - value: null - }, - mapTransform: { - value: new He - }, - alphaMap: { - value: null - }, - alphaMapTransform: { - value: new He - }, - alphaTest: { - value: 0 +var an = class extends Rt { + constructor(t = new T, e = new T, i = new T, s = new T){ + super(), this.isCubicBezierCurve = !0, this.type = "CubicBezierCurve", this.v0 = t, this.v1 = e, this.v2 = i, this.v3 = s; + } + getPoint(t, e = new T) { + let i = e, s = this.v0, n = this.v1, r = this.v2, o = this.v3; + return i.set(Di(t, s.x, n.x, r.x, o.x), Di(t, s.y, n.y, r.y, o.y)), i; + } + copy(t) { + return super.copy(t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this.v3.copy(t.v3), this; + } + toJSON() { + let t = super.toJSON(); + return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t.v3 = this.v3.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this.v3.fromArray(t.v3), this; + } +}, Or = class extends Rt { + constructor(t = new w, e = new w, i = new w, s = new w){ + super(), this.isCubicBezierCurve3 = !0, this.type = "CubicBezierCurve3", this.v0 = t, this.v1 = e, this.v2 = i, this.v3 = s; + } + getPoint(t, e = new w) { + let i = e, s = this.v0, n = this.v1, r = this.v2, o = this.v3; + return i.set(Di(t, s.x, n.x, r.x, o.x), Di(t, s.y, n.y, r.y, o.y), Di(t, s.z, n.z, r.z, o.z)), i; + } + copy(t) { + return super.copy(t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this.v3.copy(t.v3), this; + } + toJSON() { + let t = super.toJSON(); + return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t.v3 = this.v3.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this.v3.fromArray(t.v3), this; + } +}, hn = class extends Rt { + constructor(t = new T, e = new T){ + super(), this.isLineCurve = !0, this.type = "LineCurve", this.v1 = t, this.v2 = e; + } + getPoint(t, e = new T) { + let i = e; + return t === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(t).add(this.v1)), i; + } + getPointAt(t, e) { + return this.getPoint(t, e); + } + getTangent(t, e = new T) { + return e.subVectors(this.v2, this.v1).normalize(); + } + getTangentAt(t, e) { + return this.getTangent(t, e); + } + copy(t) { + return super.copy(t), this.v1.copy(t.v1), this.v2.copy(t.v2), this; + } + toJSON() { + let t = super.toJSON(); + return t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this; + } +}, Nr = class extends Rt { + constructor(t = new w, e = new w){ + super(), this.isLineCurve3 = !0, this.type = "LineCurve3", this.v1 = t, this.v2 = e; + } + getPoint(t, e = new w) { + let i = e; + return t === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(t).add(this.v1)), i; + } + getPointAt(t, e) { + return this.getPoint(t, e); + } + getTangent(t, e = new w) { + return e.subVectors(this.v2, this.v1).normalize(); + } + getTangentAt(t, e) { + return this.getTangent(t, e); + } + copy(t) { + return super.copy(t), this.v1.copy(t.v1), this.v2.copy(t.v2), this; + } + toJSON() { + let t = super.toJSON(); + return t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this; + } +}, ln = class extends Rt { + constructor(t = new T, e = new T, i = new T){ + super(), this.isQuadraticBezierCurve = !0, this.type = "QuadraticBezierCurve", this.v0 = t, this.v1 = e, this.v2 = i; + } + getPoint(t, e = new T) { + let i = e, s = this.v0, n = this.v1, r = this.v2; + return i.set(Vi(t, s.x, n.x, r.x), Vi(t, s.y, n.y, r.y)), i; + } + copy(t) { + return super.copy(t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this; + } + toJSON() { + let t = super.toJSON(); + return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this; + } +}, cn = class extends Rt { + constructor(t = new w, e = new w, i = new w){ + super(), this.isQuadraticBezierCurve3 = !0, this.type = "QuadraticBezierCurve3", this.v0 = t, this.v1 = e, this.v2 = i; + } + getPoint(t, e = new w) { + let i = e, s = this.v0, n = this.v1, r = this.v2; + return i.set(Vi(t, s.x, n.x, r.x), Vi(t, s.y, n.y, r.y), Vi(t, s.z, n.z, r.z)), i; + } + copy(t) { + return super.copy(t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this; + } + toJSON() { + let t = super.toJSON(); + return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this; + } +}, un = class extends Rt { + constructor(t = []){ + super(), this.isSplineCurve = !0, this.type = "SplineCurve", this.points = t; + } + getPoint(t, e = new T) { + let i = e, s = this.points, n = (s.length - 1) * t, r = Math.floor(n), o = n - r, a = s[r === 0 ? r : r - 1], l = s[r], c = s[r > s.length - 2 ? s.length - 1 : r + 1], u = s[r > s.length - 3 ? s.length - 1 : r + 2]; + return i.set(lh(o, a.x, l.x, c.x, u.x), lh(o, a.y, l.y, c.y, u.y)), i; + } + copy(t) { + super.copy(t), this.points = []; + for(let e = 0, i = t.points.length; e < i; e++){ + let s = t.points[e]; + this.points.push(s.clone()); } - }, - specularmap: { - specularMap: { - value: null - }, - specularMapTransform: { - value: new He + return this; + } + toJSON() { + let t = super.toJSON(); + t.points = []; + for(let e = 0, i = this.points.length; e < i; e++){ + let s = this.points[e]; + t.points.push(s.toArray()); } - }, - envmap: { - envMap: { - value: null - }, - flipEnvMap: { - value: -1 - }, - reflectivity: { - value: 1 - }, - ior: { - value: 1.5 - }, - refractionRatio: { - value: .98 + return t; + } + fromJSON(t) { + super.fromJSON(t), this.points = []; + for(let e = 0, i = t.points.length; e < i; e++){ + let s = t.points[e]; + this.points.push(new T().fromArray(s)); } - }, - aomap: { - aoMap: { - value: null - }, - aoMapIntensity: { - value: 1 - }, - aoMapTransform: { - value: new He + return this; + } +}, dn = Object.freeze({ + __proto__: null, + ArcCurve: kr, + CatmullRomCurve3: Pr, + CubicBezierCurve: an, + CubicBezierCurve3: Or, + EllipseCurve: Yi, + LineCurve: hn, + LineCurve3: Nr, + QuadraticBezierCurve: ln, + QuadraticBezierCurve3: cn, + SplineCurve: un +}), Vr = class extends Rt { + constructor(){ + super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1; + } + add(t) { + this.curves.push(t); + } + closePath() { + let t = this.curves[0].getPoint(0), e = this.curves[this.curves.length - 1].getPoint(1); + if (!t.equals(e)) { + let i = t.isVector2 === !0 ? "LineCurve" : "LineCurve3"; + this.curves.push(new dn[i](e, t)); } - }, - lightmap: { - lightMap: { - value: null - }, - lightMapIntensity: { - value: 1 - }, - lightMapTransform: { - value: new He + return this; + } + getPoint(t, e) { + let i = t * this.getLength(), s = this.getCurveLengths(), n = 0; + for(; n < s.length;){ + if (s[n] >= i) { + let r = s[n] - i, o = this.curves[n], a = o.getLength(), l = a === 0 ? 0 : 1 - r / a; + return o.getPointAt(l, e); + } + n++; } - }, - bumpmap: { - bumpMap: { - value: null - }, - bumpMapTransform: { - value: new He - }, - bumpScale: { - value: 1 + return null; + } + getLength() { + let t = this.getCurveLengths(); + return t[t.length - 1]; + } + updateArcLengths() { + this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths(); + } + getCurveLengths() { + if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; + let t = [], e = 0; + for(let i = 0, s = this.curves.length; i < s; i++)e += this.curves[i].getLength(), t.push(e); + return this.cacheLengths = t, t; + } + getSpacedPoints(t = 40) { + let e = []; + for(let i = 0; i <= t; i++)e.push(this.getPoint(i / t)); + return this.autoClose && e.push(e[0]), e; + } + getPoints(t = 12) { + let e = [], i; + for(let s = 0, n = this.curves; s < n.length; s++){ + let r = n[s], o = r.isEllipseCurve ? t * 2 : r.isLineCurve || r.isLineCurve3 ? 1 : r.isSplineCurve ? t * r.points.length : t, a = r.getPoints(o); + for(let l = 0; l < a.length; l++){ + let c = a[l]; + i && i.equals(c) || (e.push(c), i = c); + } } - }, - normalmap: { - normalMap: { - value: null - }, - normalMapTransform: { - value: new He - }, - normalScale: { - value: new Z(1, 1) + return this.autoClose && e.length > 1 && !e[e.length - 1].equals(e[0]) && e.push(e[0]), e; + } + copy(t) { + super.copy(t), this.curves = []; + for(let e = 0, i = t.curves.length; e < i; e++){ + let s = t.curves[e]; + this.curves.push(s.clone()); } - }, - displacementmap: { - displacementMap: { - value: null - }, - displacementMapTransform: { - value: new He - }, - displacementScale: { - value: 1 - }, - displacementBias: { - value: 0 + return this.autoClose = t.autoClose, this; + } + toJSON() { + let t = super.toJSON(); + t.autoClose = this.autoClose, t.curves = []; + for(let e = 0, i = this.curves.length; e < i; e++){ + let s = this.curves[e]; + t.curves.push(s.toJSON()); } - }, - emissivemap: { - emissiveMap: { - value: null - }, - emissiveMapTransform: { - value: new He + return t; + } + fromJSON(t) { + super.fromJSON(t), this.autoClose = t.autoClose, this.curves = []; + for(let e = 0, i = t.curves.length; e < i; e++){ + let s = t.curves[e]; + this.curves.push(new dn[s.type]().fromJSON(s)); } - }, - metalnessmap: { - metalnessMap: { - value: null - }, - metalnessMapTransform: { - value: new He + return this; + } +}, mi = class extends Vr { + constructor(t){ + super(), this.type = "Path", this.currentPoint = new T, t && this.setFromPoints(t); + } + setFromPoints(t) { + this.moveTo(t[0].x, t[0].y); + for(let e = 1, i = t.length; e < i; e++)this.lineTo(t[e].x, t[e].y); + return this; + } + moveTo(t, e) { + return this.currentPoint.set(t, e), this; + } + lineTo(t, e) { + let i = new hn(this.currentPoint.clone(), new T(t, e)); + return this.curves.push(i), this.currentPoint.set(t, e), this; + } + quadraticCurveTo(t, e, i, s) { + let n = new ln(this.currentPoint.clone(), new T(t, e), new T(i, s)); + return this.curves.push(n), this.currentPoint.set(i, s), this; + } + bezierCurveTo(t, e, i, s, n, r) { + let o = new an(this.currentPoint.clone(), new T(t, e), new T(i, s), new T(n, r)); + return this.curves.push(o), this.currentPoint.set(n, r), this; + } + splineThru(t) { + let e = [ + this.currentPoint.clone() + ].concat(t), i = new un(e); + return this.curves.push(i), this.currentPoint.copy(t[t.length - 1]), this; + } + arc(t, e, i, s, n, r) { + let o = this.currentPoint.x, a = this.currentPoint.y; + return this.absarc(t + o, e + a, i, s, n, r), this; + } + absarc(t, e, i, s, n, r) { + return this.absellipse(t, e, i, i, s, n, r), this; + } + ellipse(t, e, i, s, n, r, o, a) { + let l = this.currentPoint.x, c = this.currentPoint.y; + return this.absellipse(t + l, e + c, i, s, n, r, o, a), this; + } + absellipse(t, e, i, s, n, r, o, a) { + let l = new Yi(t, e, i, s, n, r, o, a); + if (this.curves.length > 0) { + let u = l.getPoint(0); + u.equals(this.currentPoint) || this.lineTo(u.x, u.y); } - }, - roughnessmap: { - roughnessMap: { - value: null - }, - roughnessMapTransform: { - value: new He + this.curves.push(l); + let c = l.getPoint(1); + return this.currentPoint.copy(c), this; + } + copy(t) { + return super.copy(t), this.currentPoint.copy(t.currentPoint), this; + } + toJSON() { + let t = super.toJSON(); + return t.currentPoint = this.currentPoint.toArray(), t; + } + fromJSON(t) { + return super.fromJSON(t), this.currentPoint.fromArray(t.currentPoint), this; + } +}, pn = class h extends L { + constructor(t = [ + new T(0, -.5), + new T(.5, 0), + new T(0, .5) + ], e = 12, i = 0, s = Math.PI * 2){ + super(), this.type = "LatheGeometry", this.parameters = { + points: t, + segments: e, + phiStart: i, + phiLength: s + }, e = Math.floor(e), s = N(s, 0, Math.PI * 2); + let n = [], r = [], o = [], a = [], l = [], c = 1 / e, u = new w, d = new T, p = new w, f = new w, m = new w, y1 = 0, g = 0; + for(let x1 = 0; x1 <= t.length - 1; x1++)switch(x1){ + case 0: + y1 = t[x1 + 1].x - t[x1].x, g = t[x1 + 1].y - t[x1].y, p.x = g * 1, p.y = -y1, p.z = g * 0, m.copy(p), p.normalize(), a.push(p.x, p.y, p.z); + break; + case t.length - 1: + a.push(m.x, m.y, m.z); + break; + default: + y1 = t[x1 + 1].x - t[x1].x, g = t[x1 + 1].y - t[x1].y, p.x = g * 1, p.y = -y1, p.z = g * 0, f.copy(p), p.x += m.x, p.y += m.y, p.z += m.z, p.normalize(), a.push(p.x, p.y, p.z), m.copy(f); } - }, - gradientmap: { - gradientMap: { - value: null + for(let x1 = 0; x1 <= e; x1++){ + let b = i + x1 * c * s, M = Math.sin(b), _ = Math.cos(b); + for(let v = 0; v <= t.length - 1; v++){ + u.x = t[v].x * M, u.y = t[v].y, u.z = t[v].x * _, r.push(u.x, u.y, u.z), d.x = x1 / e, d.y = v / (t.length - 1), o.push(d.x, d.y); + let S = a[3 * v + 0] * M, A = a[3 * v + 1], I = a[3 * v + 0] * _; + l.push(S, A, I); + } } - }, - fog: { - fogDensity: { - value: 25e-5 - }, - fogNear: { - value: 1 - }, - fogFar: { - value: 2e3 - }, - fogColor: { - value: new pe(16777215) + for(let x1 = 0; x1 < e; x1++)for(let b = 0; b < t.length - 1; b++){ + let M = b + x1 * t.length, _ = M, v = M + t.length, S = M + t.length + 1, A = M + 1; + n.push(_, v, A), n.push(S, A, v); } - }, - lights: { - ambientLightColor: { - value: [] - }, - lightProbe: { - value: [] - }, - directionalLights: { - value: [], - properties: { - direction: {}, - color: {} - } - }, - directionalLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} + this.setIndex(n), this.setAttribute("position", new E(r, 3)), this.setAttribute("uv", new E(o, 2)), this.setAttribute("normal", new E(l, 3)); + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.points, t.segments, t.phiStart, t.phiLength); + } +}, Dr = class h extends pn { + constructor(t = 1, e = 1, i = 4, s = 8){ + let n = new mi; + n.absarc(0, -e / 2, t, Math.PI * 1.5, 0), n.absarc(0, e / 2, t, 0, Math.PI * .5), super(n.getPoints(i), s), this.type = "CapsuleGeometry", this.parameters = { + radius: t, + length: e, + capSegments: i, + radialSegments: s + }; + } + static fromJSON(t) { + return new h(t.radius, t.length, t.capSegments, t.radialSegments); + } +}, Lr = class h extends L { + constructor(t = 1, e = 32, i = 0, s = Math.PI * 2){ + super(), this.type = "CircleGeometry", this.parameters = { + radius: t, + segments: e, + thetaStart: i, + thetaLength: s + }, e = Math.max(3, e); + let n = [], r = [], o = [], a = [], l = new w, c = new T; + r.push(0, 0, 0), o.push(0, 0, 1), a.push(.5, .5); + for(let u = 0, d = 3; u <= e; u++, d += 3){ + let p = i + u / e * s; + l.x = t * Math.cos(p), l.y = t * Math.sin(p), r.push(l.x, l.y, l.z), o.push(0, 0, 1), c.x = (r[d] / t + 1) / 2, c.y = (r[d + 1] / t + 1) / 2, a.push(c.x, c.y); + } + for(let u = 1; u <= e; u++)n.push(u, u + 1, 0); + this.setIndex(n), this.setAttribute("position", new E(r, 3)), this.setAttribute("normal", new E(o, 3)), this.setAttribute("uv", new E(a, 2)); + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.radius, t.segments, t.thetaStart, t.thetaLength); + } +}, $i = class h extends L { + constructor(t = 1, e = 1, i = 1, s = 32, n = 1, r = !1, o = 0, a = Math.PI * 2){ + super(), this.type = "CylinderGeometry", this.parameters = { + radiusTop: t, + radiusBottom: e, + height: i, + radialSegments: s, + heightSegments: n, + openEnded: r, + thetaStart: o, + thetaLength: a + }; + let l = this; + s = Math.floor(s), n = Math.floor(n); + let c = [], u = [], d = [], p = [], f = 0, m = [], y1 = i / 2, g = 0; + x1(), r === !1 && (t > 0 && b(!0), e > 0 && b(!1)), this.setIndex(c), this.setAttribute("position", new E(u, 3)), this.setAttribute("normal", new E(d, 3)), this.setAttribute("uv", new E(p, 2)); + function x1() { + let M = new w, _ = new w, v = 0, S = (e - t) / i; + for(let A = 0; A <= n; A++){ + let I = [], C = A / n, k = C * (e - t) + t; + for(let U = 0; U <= s; U++){ + let W = U / s, H = W * a + o, Y = Math.sin(H), Q = Math.cos(H); + _.x = k * Y, _.y = -C * i + y1, _.z = k * Q, u.push(_.x, _.y, _.z), M.set(Y, S, Q).normalize(), d.push(M.x, M.y, M.z), p.push(W, 1 - C), I.push(f++); + } + m.push(I); } - }, - directionalShadowMap: { - value: [] - }, - directionalShadowMatrix: { - value: [] - }, - spotLights: { - value: [], - properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {} + for(let A = 0; A < s; A++)for(let I = 0; I < n; I++){ + let C = m[I][A], k = m[I + 1][A], U = m[I + 1][A + 1], W = m[I][A + 1]; + (t > 0 || I !== 0) && (c.push(C, k, W), v += 3), (e > 0 || I !== n - 1) && (c.push(k, U, W), v += 3); } - }, - spotLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} + l.addGroup(g, v, 0), g += v; + } + function b(M) { + let _ = f, v = new T, S = new w, A = 0, I = M === !0 ? t : e, C = M === !0 ? 1 : -1; + for(let U = 1; U <= s; U++)u.push(0, y1 * C, 0), d.push(0, C, 0), p.push(.5, .5), f++; + let k = f; + for(let U = 0; U <= s; U++){ + let H = U / s * a + o, Y = Math.cos(H), Q = Math.sin(H); + S.x = I * Q, S.y = y1 * C, S.z = I * Y, u.push(S.x, S.y, S.z), d.push(0, C, 0), v.x = Y * .5 + .5, v.y = Q * .5 * C + .5, p.push(v.x, v.y), f++; } - }, - spotLightMap: { - value: [] - }, - spotShadowMap: { - value: [] - }, - spotLightMatrix: { - value: [] - }, - pointLights: { - value: [], - properties: { - color: {}, - position: {}, - decay: {}, - distance: {} + for(let U = 0; U < s; U++){ + let W = _ + U, H = k + U; + M === !0 ? c.push(H, H + 1, W) : c.push(H + 1, H, W), A += 3; } - }, - pointLightShadows: { - value: [], - properties: { - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - shadowCameraNear: {}, - shadowCameraFar: {} + l.addGroup(g, A, M === !0 ? 1 : 2), g += A; + } + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.radiusTop, t.radiusBottom, t.height, t.radialSegments, t.heightSegments, t.openEnded, t.thetaStart, t.thetaLength); + } +}, Ur = class h extends $i { + constructor(t = 1, e = 1, i = 32, s = 1, n = !1, r = 0, o = Math.PI * 2){ + super(0, t, e, i, s, n, r, o), this.type = "ConeGeometry", this.parameters = { + radius: t, + height: e, + radialSegments: i, + heightSegments: s, + openEnded: n, + thetaStart: r, + thetaLength: o + }; + } + static fromJSON(t) { + return new h(t.radius, t.height, t.radialSegments, t.heightSegments, t.openEnded, t.thetaStart, t.thetaLength); + } +}, We = class h extends L { + constructor(t = [], e = [], i = 1, s = 0){ + super(), this.type = "PolyhedronGeometry", this.parameters = { + vertices: t, + indices: e, + radius: i, + detail: s + }; + let n = [], r = []; + o(s), l(i), c(), this.setAttribute("position", new E(n, 3)), this.setAttribute("normal", new E(n.slice(), 3)), this.setAttribute("uv", new E(r, 2)), s === 0 ? this.computeVertexNormals() : this.normalizeNormals(); + function o(x1) { + let b = new w, M = new w, _ = new w; + for(let v = 0; v < e.length; v += 3)p(e[v + 0], b), p(e[v + 1], M), p(e[v + 2], _), a(b, M, _, x1); + } + function a(x1, b, M, _) { + let v = _ + 1, S = []; + for(let A = 0; A <= v; A++){ + S[A] = []; + let I = x1.clone().lerp(M, A / v), C = b.clone().lerp(M, A / v), k = v - A; + for(let U = 0; U <= k; U++)U === 0 && A === v ? S[A][U] = I : S[A][U] = I.clone().lerp(C, U / k); } - }, - pointShadowMap: { - value: [] - }, - pointShadowMatrix: { - value: [] - }, - hemisphereLights: { - value: [], - properties: { - direction: {}, - skyColor: {}, - groundColor: {} + for(let A = 0; A < v; A++)for(let I = 0; I < 2 * (v - A) - 1; I++){ + let C = Math.floor(I / 2); + I % 2 === 0 ? (d(S[A][C + 1]), d(S[A + 1][C]), d(S[A][C])) : (d(S[A][C + 1]), d(S[A + 1][C + 1]), d(S[A + 1][C])); + } + } + function l(x1) { + let b = new w; + for(let M = 0; M < n.length; M += 3)b.x = n[M + 0], b.y = n[M + 1], b.z = n[M + 2], b.normalize().multiplyScalar(x1), n[M + 0] = b.x, n[M + 1] = b.y, n[M + 2] = b.z; + } + function c() { + let x1 = new w; + for(let b = 0; b < n.length; b += 3){ + x1.x = n[b + 0], x1.y = n[b + 1], x1.z = n[b + 2]; + let M = y1(x1) / 2 / Math.PI + .5, _ = g(x1) / Math.PI + .5; + r.push(M, 1 - _); + } + f(), u(); + } + function u() { + for(let x1 = 0; x1 < r.length; x1 += 6){ + let b = r[x1 + 0], M = r[x1 + 2], _ = r[x1 + 4], v = Math.max(b, M, _), S = Math.min(b, M, _); + v > .9 && S < .1 && (b < .2 && (r[x1 + 0] += 1), M < .2 && (r[x1 + 2] += 1), _ < .2 && (r[x1 + 4] += 1)); + } + } + function d(x1) { + n.push(x1.x, x1.y, x1.z); + } + function p(x1, b) { + let M = x1 * 3; + b.x = t[M + 0], b.y = t[M + 1], b.z = t[M + 2]; + } + function f() { + let x1 = new w, b = new w, M = new w, _ = new w, v = new T, S = new T, A = new T; + for(let I = 0, C = 0; I < n.length; I += 9, C += 6){ + x1.set(n[I + 0], n[I + 1], n[I + 2]), b.set(n[I + 3], n[I + 4], n[I + 5]), M.set(n[I + 6], n[I + 7], n[I + 8]), v.set(r[C + 0], r[C + 1]), S.set(r[C + 2], r[C + 3]), A.set(r[C + 4], r[C + 5]), _.copy(x1).add(b).add(M).divideScalar(3); + let k = y1(_); + m(v, C + 0, x1, k), m(S, C + 2, b, k), m(A, C + 4, M, k); + } + } + function m(x1, b, M, _) { + _ < 0 && x1.x === 1 && (r[b] = x1.x - 1), M.x === 0 && M.z === 0 && (r[b] = _ / 2 / Math.PI + .5); + } + function y1(x1) { + return Math.atan2(x1.z, -x1.x); + } + function g(x1) { + return Math.atan2(-x1.y, Math.sqrt(x1.x * x1.x + x1.z * x1.z)); + } + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.vertices, t.indices, t.radius, t.details); + } +}, Wr = class h extends We { + constructor(t = 1, e = 0){ + let i = (1 + Math.sqrt(5)) / 2, s = 1 / i, n = [ + -1, + -1, + -1, + -1, + -1, + 1, + -1, + 1, + -1, + -1, + 1, + 1, + 1, + -1, + -1, + 1, + -1, + 1, + 1, + 1, + -1, + 1, + 1, + 1, + 0, + -s, + -i, + 0, + -s, + i, + 0, + s, + -i, + 0, + s, + i, + -s, + -i, + 0, + -s, + i, + 0, + s, + -i, + 0, + s, + i, + 0, + -i, + 0, + -s, + i, + 0, + -s, + -i, + 0, + s, + i, + 0, + s + ], r = [ + 3, + 11, + 7, + 3, + 7, + 15, + 3, + 15, + 13, + 7, + 19, + 17, + 7, + 17, + 6, + 7, + 6, + 15, + 17, + 4, + 8, + 17, + 8, + 10, + 17, + 10, + 6, + 8, + 0, + 16, + 8, + 16, + 2, + 8, + 2, + 10, + 0, + 12, + 1, + 0, + 1, + 18, + 0, + 18, + 16, + 6, + 10, + 2, + 6, + 2, + 13, + 6, + 13, + 15, + 2, + 16, + 18, + 2, + 18, + 3, + 2, + 3, + 13, + 18, + 1, + 9, + 18, + 9, + 11, + 18, + 11, + 3, + 4, + 14, + 12, + 4, + 12, + 0, + 4, + 0, + 8, + 11, + 9, + 5, + 11, + 5, + 19, + 11, + 19, + 7, + 19, + 5, + 14, + 19, + 14, + 4, + 19, + 4, + 17, + 1, + 12, + 14, + 1, + 14, + 5, + 1, + 5, + 9 + ]; + super(n, r, t, e), this.type = "DodecahedronGeometry", this.parameters = { + radius: t, + detail: e + }; + } + static fromJSON(t) { + return new h(t.radius, t.detail); + } +}, Rs = new w, ks = new w, ar = new w, Ps = new ne, Hr = class extends L { + constructor(t = null, e = 1){ + if (super(), this.type = "EdgesGeometry", this.parameters = { + geometry: t, + thresholdAngle: e + }, t !== null) { + let s = Math.pow(10, 4), n = Math.cos(De * e), r = t.getIndex(), o = t.getAttribute("position"), a = r ? r.count : o.count, l = [ + 0, + 0, + 0 + ], c = [ + "a", + "b", + "c" + ], u = new Array(3), d = {}, p = []; + for(let f = 0; f < a; f += 3){ + r ? (l[0] = r.getX(f), l[1] = r.getX(f + 1), l[2] = r.getX(f + 2)) : (l[0] = f, l[1] = f + 1, l[2] = f + 2); + let { a: m , b: y1 , c: g } = Ps; + if (m.fromBufferAttribute(o, l[0]), y1.fromBufferAttribute(o, l[1]), g.fromBufferAttribute(o, l[2]), Ps.getNormal(ar), u[0] = `${Math.round(m.x * s)},${Math.round(m.y * s)},${Math.round(m.z * s)}`, u[1] = `${Math.round(y1.x * s)},${Math.round(y1.y * s)},${Math.round(y1.z * s)}`, u[2] = `${Math.round(g.x * s)},${Math.round(g.y * s)},${Math.round(g.z * s)}`, !(u[0] === u[1] || u[1] === u[2] || u[2] === u[0])) for(let x1 = 0; x1 < 3; x1++){ + let b = (x1 + 1) % 3, M = u[x1], _ = u[b], v = Ps[c[x1]], S = Ps[c[b]], A = `${M}_${_}`, I = `${_}_${M}`; + I in d && d[I] ? (ar.dot(d[I].normal) <= n && (p.push(v.x, v.y, v.z), p.push(S.x, S.y, S.z)), d[I] = null) : A in d || (d[A] = { + index0: l[x1], + index1: l[b], + normal: ar.clone() + }); + } } - }, - rectAreaLights: { - value: [], - properties: { - color: {}, - position: {}, - width: {}, - height: {} + for(let f in d)if (d[f]) { + let { index0: m , index1: y1 } = d[f]; + Rs.fromBufferAttribute(o, m), ks.fromBufferAttribute(o, y1), p.push(Rs.x, Rs.y, Rs.z), p.push(ks.x, ks.y, ks.z); } - }, - ltc_1: { - value: null - }, - ltc_2: { - value: null + this.setAttribute("position", new E(p, 3)); } - }, - points: { - diffuse: { - value: new pe(16777215) - }, - opacity: { - value: 1 - }, - size: { - value: 1 - }, - scale: { - value: 1 - }, - map: { - value: null - }, - alphaMap: { - value: null - }, - alphaMapTransform: { - value: new He - }, - alphaTest: { - value: 0 - }, - uvTransform: { - value: new He + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } +}, Me = class extends mi { + constructor(t){ + super(t), this.uuid = It(), this.type = "Shape", this.holes = []; + } + getPointsHoles(t) { + let e = []; + for(let i = 0, s = this.holes.length; i < s; i++)e[i] = this.holes[i].getPoints(t); + return e; + } + extractPoints(t) { + return { + shape: this.getPoints(t), + holes: this.getPointsHoles(t) + }; + } + copy(t) { + super.copy(t), this.holes = []; + for(let e = 0, i = t.holes.length; e < i; e++){ + let s = t.holes[e]; + this.holes.push(s.clone()); } - }, - sprite: { - diffuse: { - value: new pe(16777215) - }, - opacity: { - value: 1 - }, - center: { - value: new Z(.5, .5) - }, - rotation: { - value: 0 - }, - map: { - value: null - }, - mapTransform: { - value: new He - }, - alphaMap: { - value: null - }, - alphaMapTransform: { - value: new He - }, - alphaTest: { - value: 0 + return this; + } + toJSON() { + let t = super.toJSON(); + t.uuid = this.uuid, t.holes = []; + for(let e = 0, i = this.holes.length; e < i; e++){ + let s = this.holes[e]; + t.holes.push(s.toJSON()); } + return t; } -}, nn = { - basic: { - uniforms: Lt([ - le.common, - le.specularmap, - le.envmap, - le.aomap, - le.lightmap, - le.fog - ]), - vertexShader: ke.meshbasic_vert, - fragmentShader: ke.meshbasic_frag - }, - lambert: { - uniforms: Lt([ - le.common, - le.specularmap, - le.envmap, - le.aomap, - le.lightmap, - le.emissivemap, - le.bumpmap, - le.normalmap, - le.displacementmap, - le.fog, - le.lights, - { - emissive: { - value: new pe(0) - } - } - ]), - vertexShader: ke.meshlambert_vert, - fragmentShader: ke.meshlambert_frag - }, - phong: { - uniforms: Lt([ - le.common, - le.specularmap, - le.envmap, - le.aomap, - le.lightmap, - le.emissivemap, - le.bumpmap, - le.normalmap, - le.displacementmap, - le.fog, - le.lights, - { - emissive: { - value: new pe(0) - }, - specular: { - value: new pe(1118481) - }, - shininess: { - value: 30 - } - } - ]), - vertexShader: ke.meshphong_vert, - fragmentShader: ke.meshphong_frag - }, - standard: { - uniforms: Lt([ - le.common, - le.envmap, - le.aomap, - le.lightmap, - le.emissivemap, - le.bumpmap, - le.normalmap, - le.displacementmap, - le.roughnessmap, - le.metalnessmap, - le.fog, - le.lights, - { - emissive: { - value: new pe(0) - }, - roughness: { - value: 1 - }, - metalness: { - value: 0 - }, - envMapIntensity: { - value: 1 - } - } - ]), - vertexShader: ke.meshphysical_vert, - fragmentShader: ke.meshphysical_frag - }, - toon: { - uniforms: Lt([ - le.common, - le.aomap, - le.lightmap, - le.emissivemap, - le.bumpmap, - le.normalmap, - le.displacementmap, - le.gradientmap, - le.fog, - le.lights, - { - emissive: { - value: new pe(0) - } - } - ]), - vertexShader: ke.meshtoon_vert, - fragmentShader: ke.meshtoon_frag - }, - matcap: { - uniforms: Lt([ - le.common, - le.bumpmap, - le.normalmap, - le.displacementmap, - le.fog, - { - matcap: { - value: null - } - } - ]), - vertexShader: ke.meshmatcap_vert, - fragmentShader: ke.meshmatcap_frag - }, - points: { - uniforms: Lt([ - le.points, - le.fog - ]), - vertexShader: ke.points_vert, - fragmentShader: ke.points_frag - }, - dashed: { - uniforms: Lt([ - le.common, - le.fog, - { - scale: { - value: 1 - }, - dashSize: { - value: 1 - }, - totalSize: { - value: 2 - } - } - ]), - vertexShader: ke.linedashed_vert, - fragmentShader: ke.linedashed_frag - }, - depth: { - uniforms: Lt([ - le.common, - le.displacementmap - ]), - vertexShader: ke.depth_vert, - fragmentShader: ke.depth_frag - }, - normal: { - uniforms: Lt([ - le.common, - le.bumpmap, - le.normalmap, - le.displacementmap, - { - opacity: { - value: 1 - } - } - ]), - vertexShader: ke.meshnormal_vert, - fragmentShader: ke.meshnormal_frag - }, - sprite: { - uniforms: Lt([ - le.sprite, - le.fog - ]), - vertexShader: ke.sprite_vert, - fragmentShader: ke.sprite_frag - }, - background: { - uniforms: { - uvTransform: { - value: new He - }, - t2D: { - value: null - }, - backgroundIntensity: { - value: 1 + fromJSON(t) { + super.fromJSON(t), this.uuid = t.uuid, this.holes = []; + for(let e = 0, i = t.holes.length; e < i; e++){ + let s = t.holes[e]; + this.holes.push(new mi().fromJSON(s)); + } + return this; + } +}, Yu = { + triangulate: function(h, t, e = 2) { + let i = t && t.length, s = i ? t[0] * e : h.length, n = El(h, 0, s, e, !0), r = []; + if (!n || n.next === n.prev) return r; + let o, a, l, c, u, d, p; + if (i && (n = td(h, t, n, e)), h.length > 80 * e) { + o = l = h[0], a = c = h[1]; + for(let f = e; f < s; f += e)u = h[f], d = h[f + 1], u < o && (o = u), d < a && (a = d), u > l && (l = u), d > c && (c = d); + p = Math.max(l - o, c - a), p = p !== 0 ? 32767 / p : 0; + } + return Qi(n, r, e, o, a, p, 0), r; + } +}; +function El(h, t, e, i, s) { + let n, r; + if (s === ud(h, t, e, i) > 0) for(n = t; n < e; n += i)r = ch(n, h[n], h[n + 1], r); + else for(n = e - i; n >= t; n -= i)r = ch(n, h[n], h[n + 1], r); + return r && Sn(r, r.next) && (Ki(r), r = r.next), r; +} +function He(h, t) { + if (!h) return h; + t || (t = h); + let e = h, i; + do if (i = !1, !e.steiner && (Sn(e, e.next) || $(e.prev, e, e.next) === 0)) { + if (Ki(e), e = t = e.prev, e === e.next) break; + i = !0; + } else e = e.next; + while (i || e !== t) + return t; +} +function Qi(h, t, e, i, s, n, r) { + if (!h) return; + !r && n && rd(h, i, s, n); + let o = h, a, l; + for(; h.prev !== h.next;){ + if (a = h.prev, l = h.next, n ? Qu(h, i, s, n) : $u(h)) { + t.push(a.i / e | 0), t.push(h.i / e | 0), t.push(l.i / e | 0), Ki(h), h = l.next, o = l.next; + continue; + } + if (h = l, h === o) { + r ? r === 1 ? (h = ju(He(h), t, e), Qi(h, t, e, i, s, n, 2)) : r === 2 && Ku(h, t, e, i, s, n) : Qi(He(h), t, e, i, s, n, 1); + break; + } + } +} +function $u(h) { + let t = h.prev, e = h, i = h.next; + if ($(t, e, i) >= 0) return !1; + let s = t.x, n = e.x, r = i.x, o = t.y, a = e.y, l = i.y, c = s < n ? s < r ? s : r : n < r ? n : r, u = o < a ? o < l ? o : l : a < l ? a : l, d = s > n ? s > r ? s : r : n > r ? n : r, p = o > a ? o > l ? o : l : a > l ? a : l, f = i.next; + for(; f !== t;){ + if (f.x >= c && f.x <= d && f.y >= u && f.y <= p && ui(s, o, n, a, r, l, f.x, f.y) && $(f.prev, f, f.next) >= 0) return !1; + f = f.next; + } + return !0; +} +function Qu(h, t, e, i) { + let s = h.prev, n = h, r = h.next; + if ($(s, n, r) >= 0) return !1; + let o = s.x, a = n.x, l = r.x, c = s.y, u = n.y, d = r.y, p = o < a ? o < l ? o : l : a < l ? a : l, f = c < u ? c < d ? c : d : u < d ? u : d, m = o > a ? o > l ? o : l : a > l ? a : l, y1 = c > u ? c > d ? c : d : u > d ? u : d, g = qr(p, f, t, e, i), x1 = qr(m, y1, t, e, i), b = h.prevZ, M = h.nextZ; + for(; b && b.z >= g && M && M.z <= x1;){ + if (b.x >= p && b.x <= m && b.y >= f && b.y <= y1 && b !== s && b !== r && ui(o, c, a, u, l, d, b.x, b.y) && $(b.prev, b, b.next) >= 0 || (b = b.prevZ, M.x >= p && M.x <= m && M.y >= f && M.y <= y1 && M !== s && M !== r && ui(o, c, a, u, l, d, M.x, M.y) && $(M.prev, M, M.next) >= 0)) return !1; + M = M.nextZ; + } + for(; b && b.z >= g;){ + if (b.x >= p && b.x <= m && b.y >= f && b.y <= y1 && b !== s && b !== r && ui(o, c, a, u, l, d, b.x, b.y) && $(b.prev, b, b.next) >= 0) return !1; + b = b.prevZ; + } + for(; M && M.z <= x1;){ + if (M.x >= p && M.x <= m && M.y >= f && M.y <= y1 && M !== s && M !== r && ui(o, c, a, u, l, d, M.x, M.y) && $(M.prev, M, M.next) >= 0) return !1; + M = M.nextZ; + } + return !0; +} +function ju(h, t, e) { + let i = h; + do { + let s = i.prev, n = i.next.next; + !Sn(s, n) && Rl(s, i, i.next, n) && ji(s, n) && ji(n, s) && (t.push(s.i / e | 0), t.push(i.i / e | 0), t.push(n.i / e | 0), Ki(i), Ki(i.next), i = h = n), i = i.next; + }while (i !== h) + return He(i); +} +function Ku(h, t, e, i, s, n) { + let r = h; + do { + let o = r.next.next; + for(; o !== r.prev;){ + if (r.i !== o.i && hd(r, o)) { + let a = kl(r, o); + r = He(r, r.next), a = He(a, a.next), Qi(r, t, e, i, s, n, 0), Qi(a, t, e, i, s, n, 0); + return; } - }, - vertexShader: ke.background_vert, - fragmentShader: ke.background_frag - }, - backgroundCube: { - uniforms: { - envMap: { - value: null - }, - flipEnvMap: { - value: -1 - }, - backgroundBlurriness: { - value: 0 - }, - backgroundIntensity: { - value: 1 + o = o.next; + } + r = r.next; + }while (r !== h) +} +function td(h, t, e, i) { + let s = [], n, r, o, a, l; + for(n = 0, r = t.length; n < r; n++)o = t[n] * i, a = n < r - 1 ? t[n + 1] * i : h.length, l = El(h, o, a, i, !1), l === l.next && (l.steiner = !0), s.push(ad(l)); + for(s.sort(ed), n = 0; n < s.length; n++)e = id(s[n], e); + return e; +} +function ed(h, t) { + return h.x - t.x; +} +function id(h, t) { + let e = sd(h, t); + if (!e) return t; + let i = kl(e, h); + return He(i, i.next), He(e, e.next); +} +function sd(h, t) { + let e = t, i = -1 / 0, s, n = h.x, r = h.y; + do { + if (r <= e.y && r >= e.next.y && e.next.y !== e.y) { + let d = e.x + (r - e.y) * (e.next.x - e.x) / (e.next.y - e.y); + if (d <= n && d > i && (i = d, s = e.x < e.next.x ? e : e.next, d === n)) return s; + } + e = e.next; + }while (e !== t) + if (!s) return null; + let o = s, a = s.x, l = s.y, c = 1 / 0, u; + e = s; + do n >= e.x && e.x >= a && n !== e.x && ui(r < l ? n : i, r, a, l, r < l ? i : n, r, e.x, e.y) && (u = Math.abs(r - e.y) / (n - e.x), ji(e, h) && (u < c || u === c && (e.x > s.x || e.x === s.x && nd(s, e))) && (s = e, c = u)), e = e.next; + while (e !== o) + return s; +} +function nd(h, t) { + return $(h.prev, h, t.prev) < 0 && $(t.next, h, h.next) < 0; +} +function rd(h, t, e, i) { + let s = h; + do s.z === 0 && (s.z = qr(s.x, s.y, t, e, i)), s.prevZ = s.prev, s.nextZ = s.next, s = s.next; + while (s !== h) + s.prevZ.nextZ = null, s.prevZ = null, od(s); +} +function od(h) { + let t, e, i, s, n, r, o, a, l = 1; + do { + for(e = h, h = null, n = null, r = 0; e;){ + for(r++, i = e, o = 0, t = 0; t < l && (o++, i = i.nextZ, !!i); t++); + for(a = l; o > 0 || a > 0 && i;)o !== 0 && (a === 0 || !i || e.z <= i.z) ? (s = e, e = e.nextZ, o--) : (s = i, i = i.nextZ, a--), n ? n.nextZ = s : h = s, s.prevZ = n, n = s; + e = i; + } + n.nextZ = null, l *= 2; + }while (r > 1) + return h; +} +function qr(h, t, e, i, s) { + return h = (h - e) * s | 0, t = (t - i) * s | 0, h = (h | h << 8) & 16711935, h = (h | h << 4) & 252645135, h = (h | h << 2) & 858993459, h = (h | h << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, h | t << 1; +} +function ad(h) { + let t = h, e = h; + do (t.x < e.x || t.x === e.x && t.y < e.y) && (e = t), t = t.next; + while (t !== h) + return e; +} +function ui(h, t, e, i, s, n, r, o) { + return (s - r) * (t - o) >= (h - r) * (n - o) && (h - r) * (i - o) >= (e - r) * (t - o) && (e - r) * (n - o) >= (s - r) * (i - o); +} +function hd(h, t) { + return h.next.i !== t.i && h.prev.i !== t.i && !ld(h, t) && (ji(h, t) && ji(t, h) && cd(h, t) && ($(h.prev, h, t.prev) || $(h, t.prev, t)) || Sn(h, t) && $(h.prev, h, h.next) > 0 && $(t.prev, t, t.next) > 0); +} +function $(h, t, e) { + return (t.y - h.y) * (e.x - t.x) - (t.x - h.x) * (e.y - t.y); +} +function Sn(h, t) { + return h.x === t.x && h.y === t.y; +} +function Rl(h, t, e, i) { + let s = Ns($(h, t, e)), n = Ns($(h, t, i)), r = Ns($(e, i, h)), o = Ns($(e, i, t)); + return !!(s !== n && r !== o || s === 0 && Os(h, e, t) || n === 0 && Os(h, i, t) || r === 0 && Os(e, h, i) || o === 0 && Os(e, t, i)); +} +function Os(h, t, e) { + return t.x <= Math.max(h.x, e.x) && t.x >= Math.min(h.x, e.x) && t.y <= Math.max(h.y, e.y) && t.y >= Math.min(h.y, e.y); +} +function Ns(h) { + return h > 0 ? 1 : h < 0 ? -1 : 0; +} +function ld(h, t) { + let e = h; + do { + if (e.i !== h.i && e.next.i !== h.i && e.i !== t.i && e.next.i !== t.i && Rl(e, e.next, h, t)) return !0; + e = e.next; + }while (e !== h) + return !1; +} +function ji(h, t) { + return $(h.prev, h, h.next) < 0 ? $(h, t, h.next) >= 0 && $(h, h.prev, t) >= 0 : $(h, t, h.prev) < 0 || $(h, h.next, t) < 0; +} +function cd(h, t) { + let e = h, i = !1, s = (h.x + t.x) / 2, n = (h.y + t.y) / 2; + do e.y > n != e.next.y > n && e.next.y !== e.y && s < (e.next.x - e.x) * (n - e.y) / (e.next.y - e.y) + e.x && (i = !i), e = e.next; + while (e !== h) + return i; +} +function kl(h, t) { + let e = new Gr(h.i, h.x, h.y), i = new Gr(t.i, t.x, t.y), s = h.next, n = t.prev; + return h.next = t, t.prev = h, e.next = s, s.prev = e, i.next = e, e.prev = i, n.next = i, i.prev = n, i; +} +function ch(h, t, e, i) { + let s = new Gr(h, t, e); + return i ? (s.next = i.next, s.prev = i, i.next.prev = s, i.next = s) : (s.prev = s, s.next = s), s; +} +function Ki(h) { + h.next.prev = h.prev, h.prev.next = h.next, h.prevZ && (h.prevZ.nextZ = h.nextZ), h.nextZ && (h.nextZ.prevZ = h.prevZ); +} +function Gr(h, t, e) { + this.i = h, this.x = t, this.y = e, this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1; +} +function ud(h, t, e, i) { + let s = 0; + for(let n = t, r = e - i; n < e; n += i)s += (h[r] - h[n]) * (h[n + 1] + h[r + 1]), r = n; + return s; +} +var he = class h { + static area(t) { + let e = t.length, i = 0; + for(let s = e - 1, n = 0; n < e; s = n++)i += t[s].x * t[n].y - t[n].x * t[s].y; + return i * .5; + } + static isClockWise(t) { + return h.area(t) < 0; + } + static triangulateShape(t, e) { + let i = [], s = [], n = []; + uh(t), dh(i, t); + let r = t.length; + e.forEach(uh); + for(let a = 0; a < e.length; a++)s.push(r), r += e[a].length, dh(i, e[a]); + let o = Yu.triangulate(i, s); + for(let a = 0; a < o.length; a += 3)n.push(o.slice(a, a + 3)); + return n; + } +}; +function uh(h) { + let t = h.length; + t > 2 && h[t - 1].equals(h[0]) && h.pop(); +} +function dh(h, t) { + for(let e = 0; e < t.length; e++)h.push(t[e].x), h.push(t[e].y); +} +var Xr = class h extends L { + constructor(t = new Me([ + new T(.5, .5), + new T(-.5, .5), + new T(-.5, -.5), + new T(.5, -.5) + ]), e = {}){ + super(), this.type = "ExtrudeGeometry", this.parameters = { + shapes: t, + options: e + }, t = Array.isArray(t) ? t : [ + t + ]; + let i = this, s = [], n = []; + for(let o = 0, a = t.length; o < a; o++){ + let l = t[o]; + r(l); + } + this.setAttribute("position", new E(s, 3)), this.setAttribute("uv", new E(n, 2)), this.computeVertexNormals(); + function r(o) { + let a = [], l = e.curveSegments !== void 0 ? e.curveSegments : 12, c = e.steps !== void 0 ? e.steps : 1, u = e.depth !== void 0 ? e.depth : 1, d = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, p = e.bevelThickness !== void 0 ? e.bevelThickness : .2, f = e.bevelSize !== void 0 ? e.bevelSize : p - .1, m = e.bevelOffset !== void 0 ? e.bevelOffset : 0, y1 = e.bevelSegments !== void 0 ? e.bevelSegments : 3, g = e.extrudePath, x1 = e.UVGenerator !== void 0 ? e.UVGenerator : dd, b, M = !1, _, v, S, A; + g && (b = g.getSpacedPoints(c), M = !0, d = !1, _ = g.computeFrenetFrames(c, !1), v = new w, S = new w, A = new w), d || (y1 = 0, p = 0, f = 0, m = 0); + let I = o.extractPoints(l), C = I.shape, k = I.holes; + if (!he.isClockWise(C)) { + C = C.reverse(); + for(let z = 0, F = k.length; z < F; z++){ + let B = k[z]; + he.isClockWise(B) && (k[z] = B.reverse()); + } } - }, - vertexShader: ke.backgroundCube_vert, - fragmentShader: ke.backgroundCube_frag - }, - cube: { - uniforms: { - tCube: { - value: null - }, - tFlip: { - value: -1 - }, - opacity: { - value: 1 + let W = he.triangulateShape(C, k), H = C; + for(let z = 0, F = k.length; z < F; z++){ + let B = k[z]; + C = C.concat(B); + } + function Y(z, F, B) { + return F || console.error("THREE.ExtrudeGeometry: vec does not exist"), z.clone().addScaledVector(F, B); + } + let Q = C.length, zt = W.length; + function Pt(z, F, B) { + let O, R, q, X = z.x - F.x, tt = z.y - F.y, yt = B.x - z.x, at = B.y - z.y, vi = X * X + tt * tt, In = X * at - tt * yt; + if (Math.abs(In) > Number.EPSILON) { + let Qt = Math.sqrt(vi), $o = Math.sqrt(yt * yt + at * at), Qo = F.x - tt / Qt, jo = F.y + X / Qt, Dl = B.x - at / $o, Ll = B.y + yt / $o, Ko = ((Dl - Qo) * at - (Ll - jo) * yt) / (X * at - tt * yt); + O = Qo + X * Ko - z.x, R = jo + tt * Ko - z.y; + let ta = O * O + R * R; + if (ta <= 2) return new T(O, R); + q = Math.sqrt(ta / 2); + } else { + let Qt = !1; + X > Number.EPSILON ? yt > Number.EPSILON && (Qt = !0) : X < -Number.EPSILON ? yt < -Number.EPSILON && (Qt = !0) : Math.sign(tt) === Math.sign(at) && (Qt = !0), Qt ? (O = -tt, R = X, q = Math.sqrt(vi)) : (O = X, R = tt, q = Math.sqrt(vi / 2)); + } + return new T(O / q, R / q); + } + let j = []; + for(let z = 0, F = H.length, B = F - 1, O = z + 1; z < F; z++, B++, O++)B === F && (B = 0), O === F && (O = 0), j[z] = Pt(H[z], H[B], H[O]); + let st = [], K, Ot = j.concat(); + for(let z = 0, F = k.length; z < F; z++){ + let B = k[z]; + K = []; + for(let O = 0, R = B.length, q = R - 1, X = O + 1; O < R; O++, q++, X++)q === R && (q = 0), X === R && (X = 0), K[O] = Pt(B[O], B[q], B[X]); + st.push(K), Ot = Ot.concat(K); + } + for(let z = 0; z < y1; z++){ + let F = z / y1, B = p * Math.cos(F * Math.PI / 2), O = f * Math.sin(F * Math.PI / 2) + m; + for(let R = 0, q = H.length; R < q; R++){ + let X = Y(H[R], j[R], O); + Zt(X.x, X.y, -B); + } + for(let R = 0, q = k.length; R < q; R++){ + let X = k[R]; + K = st[R]; + for(let tt = 0, yt = X.length; tt < yt; tt++){ + let at = Y(X[tt], K[tt], O); + Zt(at.x, at.y, -B); + } + } } - }, - vertexShader: ke.cube_vert, - fragmentShader: ke.cube_frag - }, - equirect: { - uniforms: { - tEquirect: { - value: null + let Se = f + m; + for(let z = 0; z < Q; z++){ + let F = d ? Y(C[z], Ot[z], Se) : C[z]; + M ? (S.copy(_.normals[0]).multiplyScalar(F.x), v.copy(_.binormals[0]).multiplyScalar(F.y), A.copy(b[0]).add(S).add(v), Zt(A.x, A.y, A.z)) : Zt(F.x, F.y, 0); } - }, - vertexShader: ke.equirect_vert, - fragmentShader: ke.equirect_frag - }, - distanceRGBA: { - uniforms: Lt([ - le.common, - le.displacementmap, - { - referencePosition: { - value: new A - }, - nearDistance: { - value: 1 - }, - farDistance: { - value: 1e3 + for(let z = 1; z <= c; z++)for(let F = 0; F < Q; F++){ + let B = d ? Y(C[F], Ot[F], Se) : C[F]; + M ? (S.copy(_.normals[z]).multiplyScalar(B.x), v.copy(_.binormals[z]).multiplyScalar(B.y), A.copy(b[z]).add(S).add(v), Zt(A.x, A.y, A.z)) : Zt(B.x, B.y, u / c * z); + } + for(let z = y1 - 1; z >= 0; z--){ + let F = z / y1, B = p * Math.cos(F * Math.PI / 2), O = f * Math.sin(F * Math.PI / 2) + m; + for(let R = 0, q = H.length; R < q; R++){ + let X = Y(H[R], j[R], O); + Zt(X.x, X.y, u + B); + } + for(let R = 0, q = k.length; R < q; R++){ + let X = k[R]; + K = st[R]; + for(let tt = 0, yt = X.length; tt < yt; tt++){ + let at = Y(X[tt], K[tt], O); + M ? Zt(at.x, at.y + b[c - 1].y, b[c - 1].x + B) : Zt(at.x, at.y, u + B); + } } } - ]), - vertexShader: ke.distanceRGBA_vert, - fragmentShader: ke.distanceRGBA_frag - }, - shadow: { - uniforms: Lt([ - le.lights, - le.fog, - { - color: { - value: new pe(0) - }, - opacity: { - value: 1 + Tn(), es(); + function Tn() { + let z = s.length / 3; + if (d) { + let F = 0, B = Q * F; + for(let O = 0; O < zt; O++){ + let R = W[O]; + is(R[2] + B, R[1] + B, R[0] + B); + } + F = c + y1 * 2, B = Q * F; + for(let O = 0; O < zt; O++){ + let R = W[O]; + is(R[0] + B, R[1] + B, R[2] + B); + } + } else { + for(let F = 0; F < zt; F++){ + let B = W[F]; + is(B[2], B[1], B[0]); + } + for(let F = 0; F < zt; F++){ + let B = W[F]; + is(B[0] + Q * c, B[1] + Q * c, B[2] + Q * c); + } + } + i.addGroup(z, s.length / 3 - z, 0); + } + function es() { + let z = s.length / 3, F = 0; + Yo(H, F), F += H.length; + for(let B = 0, O = k.length; B < O; B++){ + let R = k[B]; + Yo(R, F), F += R.length; + } + i.addGroup(z, s.length / 3 - z, 1); + } + function Yo(z, F) { + let B = z.length; + for(; --B >= 0;){ + let O = B, R = B - 1; + R < 0 && (R = z.length - 1); + for(let q = 0, X = c + y1 * 2; q < X; q++){ + let tt = Q * q, yt = Q * (q + 1), at = F + O + tt, vi = F + R + tt, In = F + R + yt, Qt = F + O + yt; + Vl(at, vi, In, Qt); + } } } - ]), - vertexShader: ke.shadow_vert, - fragmentShader: ke.shadow_frag - } -}; -nn.physical = { - uniforms: Lt([ - nn.standard.uniforms, - { - clearcoat: { - value: 0 - }, - clearcoatMap: { - value: null - }, - clearcoatMapTransform: { - value: new He - }, - clearcoatNormalMap: { - value: null - }, - clearcoatNormalMapTransform: { - value: new He - }, - clearcoatNormalScale: { - value: new Z(1, 1) - }, - clearcoatRoughness: { - value: 0 - }, - clearcoatRoughnessMap: { - value: null - }, - clearcoatRoughnessMapTransform: { - value: new He - }, - iridescence: { - value: 0 - }, - iridescenceMap: { - value: null - }, - iridescenceMapTransform: { - value: new He - }, - iridescenceIOR: { - value: 1.3 - }, - iridescenceThicknessMinimum: { - value: 100 - }, - iridescenceThicknessMaximum: { - value: 400 - }, - iridescenceThicknessMap: { - value: null - }, - iridescenceThicknessMapTransform: { - value: new He - }, - sheen: { - value: 0 - }, - sheenColor: { - value: new pe(0) - }, - sheenColorMap: { - value: null - }, - sheenColorMapTransform: { - value: new He - }, - sheenRoughness: { - value: 1 - }, - sheenRoughnessMap: { - value: null - }, - sheenRoughnessMapTransform: { - value: new He - }, - transmission: { - value: 0 - }, - transmissionMap: { - value: null - }, - transmissionMapTransform: { - value: new He - }, - transmissionSamplerSize: { - value: new Z - }, - transmissionSamplerMap: { - value: null - }, - thickness: { - value: 0 - }, - thicknessMap: { - value: null - }, - thicknessMapTransform: { - value: new He - }, - attenuationDistance: { - value: 0 - }, - attenuationColor: { - value: new pe(0) - }, - specularColor: { - value: new pe(1, 1, 1) - }, - specularColorMap: { - value: null - }, - specularColorMapTransform: { - value: new He - }, - specularIntensity: { - value: 1 - }, - specularIntensityMap: { - value: null - }, - specularIntensityMapTransform: { - value: new He - }, - anisotropyVector: { - value: new Z - }, - anisotropyMap: { - value: null - }, - anisotropyMapTransform: { - value: new He + function Zt(z, F, B) { + a.push(z), a.push(F), a.push(B); } - } - ]), - vertexShader: ke.meshphysical_vert, - fragmentShader: ke.meshphysical_frag -}; -var cr = { - r: 0, - b: 0, - g: 0 -}; -function t_(s1, e, t, n, i, r, a) { - let o = new pe(0), c = r === !0 ? 0 : 1, l, h, u = null, d = 0, f = null; - function m(g, p) { - let v = !1, x1 = p.isScene === !0 ? p.background : null; - x1 && x1.isTexture && (x1 = (p.backgroundBlurriness > 0 ? t : e).get(x1)), x1 === null ? _(o, c) : x1 && x1.isColor && (_(x1, 1), v = !0); - let y1 = s1.xr.getEnvironmentBlendMode(); - y1 === "additive" ? n.buffers.color.setClear(0, 0, 0, 1, a) : y1 === "alpha-blend" && n.buffers.color.setClear(0, 0, 0, 0, a), (s1.autoClear || v) && s1.clear(s1.autoClearColor, s1.autoClearDepth, s1.autoClearStencil), x1 && (x1.isCubeTexture || x1.mapping === Vs) ? (h === void 0 && (h = new Mt(new Ji(1, 1, 1), new jt({ - name: "BackgroundCubeMaterial", - uniforms: $i(nn.backgroundCube.uniforms), - vertexShader: nn.backgroundCube.vertexShader, - fragmentShader: nn.backgroundCube.fragmentShader, - side: Ft, - depthTest: !1, - depthWrite: !1, - fog: !1 - })), h.geometry.deleteAttribute("normal"), h.geometry.deleteAttribute("uv"), h.onBeforeRender = function(b, w, R) { - this.matrixWorld.copyPosition(R.matrixWorld); - }, Object.defineProperty(h.material, "envMap", { - get: function() { - return this.uniforms.envMap.value; + function is(z, F, B) { + Yt(z), Yt(F), Yt(B); + let O = s.length / 3, R = x1.generateTopUV(i, s, O - 3, O - 2, O - 1); + $t(R[0]), $t(R[1]), $t(R[2]); } - }), i.update(h)), h.material.uniforms.envMap.value = x1, h.material.uniforms.flipEnvMap.value = x1.isCubeTexture && x1.isRenderTargetTexture === !1 ? -1 : 1, h.material.uniforms.backgroundBlurriness.value = p.backgroundBlurriness, h.material.uniforms.backgroundIntensity.value = p.backgroundIntensity, h.material.toneMapped = Qe.getTransfer(x1.colorSpace) !== nt, (u !== x1 || d !== x1.version || f !== s1.toneMapping) && (h.material.needsUpdate = !0, u = x1, d = x1.version, f = s1.toneMapping), h.layers.enableAll(), g.unshift(h, h.geometry, h.material, 0, 0, null)) : x1 && x1.isTexture && (l === void 0 && (l = new Mt(new $r(2, 2), new jt({ - name: "BackgroundMaterial", - uniforms: $i(nn.background.uniforms), - vertexShader: nn.background.vertexShader, - fragmentShader: nn.background.fragmentShader, - side: Bn, - depthTest: !1, - depthWrite: !1, - fog: !1 - })), l.geometry.deleteAttribute("normal"), Object.defineProperty(l.material, "map", { - get: function() { - return this.uniforms.t2D.value; + function Vl(z, F, B, O) { + Yt(z), Yt(F), Yt(O), Yt(F), Yt(B), Yt(O); + let R = s.length / 3, q = x1.generateSideWallUV(i, s, R - 6, R - 3, R - 2, R - 1); + $t(q[0]), $t(q[1]), $t(q[3]), $t(q[1]), $t(q[2]), $t(q[3]); + } + function Yt(z) { + s.push(a[z * 3 + 0]), s.push(a[z * 3 + 1]), s.push(a[z * 3 + 2]); + } + function $t(z) { + n.push(z.x), n.push(z.y); } - }), i.update(l)), l.material.uniforms.t2D.value = x1, l.material.uniforms.backgroundIntensity.value = p.backgroundIntensity, l.material.toneMapped = Qe.getTransfer(x1.colorSpace) !== nt, x1.matrixAutoUpdate === !0 && x1.updateMatrix(), l.material.uniforms.uvTransform.value.copy(x1.matrix), (u !== x1 || d !== x1.version || f !== s1.toneMapping) && (l.material.needsUpdate = !0, u = x1, d = x1.version, f = s1.toneMapping), l.layers.enableAll(), g.unshift(l, l.geometry, l.material, 0, 0, null)); + } } - function _(g, p) { - g.getRGB(cr, bd(s1)), n.buffers.color.setClear(cr.r, cr.g, cr.b, p, a); + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - return { - getClearColor: function() { - return o; - }, - setClearColor: function(g, p = 1) { - o.set(g), c = p, _(o, c); - }, - getClearAlpha: function() { - return c; - }, - setClearAlpha: function(g) { - c = g, _(o, c); - }, - render: m - }; -} -function n_(s1, e, t, n) { - let i = s1.getParameter(s1.MAX_VERTEX_ATTRIBS), r = n.isWebGL2 ? null : e.get("OES_vertex_array_object"), a = n.isWebGL2 || r !== null, o = {}, c = g(null), l = c, h = !1; - function u(U, z, q, H, ne) { - let W = !1; - if (a) { - let K = _(H, q, z); - l !== K && (l = K, f(l.object)), W = p(U, H, q, ne), W && v(U, H, q, ne); - } else { - let K = z.wireframe === !0; - (l.geometry !== H.id || l.program !== q.id || l.wireframe !== K) && (l.geometry = H.id, l.program = q.id, l.wireframe = K, W = !0); + toJSON() { + let t = super.toJSON(), e = this.parameters.shapes, i = this.parameters.options; + return pd(e, i, t); + } + static fromJSON(t, e) { + let i = []; + for(let n = 0, r = t.shapes.length; n < r; n++){ + let o = e[t.shapes[n]]; + i.push(o); } - ne !== null && t.update(ne, s1.ELEMENT_ARRAY_BUFFER), (W || h) && (h = !1, I(U, z, q, H), ne !== null && s1.bindBuffer(s1.ELEMENT_ARRAY_BUFFER, t.get(ne).buffer)); + let s = t.options.extrudePath; + return s !== void 0 && (t.options.extrudePath = new dn[s.type]().fromJSON(s)), new h(i, t.options); } - function d() { - return n.isWebGL2 ? s1.createVertexArray() : r.createVertexArrayOES(); +}, dd = { + generateTopUV: function(h, t, e, i, s) { + let n = t[e * 3], r = t[e * 3 + 1], o = t[i * 3], a = t[i * 3 + 1], l = t[s * 3], c = t[s * 3 + 1]; + return [ + new T(n, r), + new T(o, a), + new T(l, c) + ]; + }, + generateSideWallUV: function(h, t, e, i, s, n) { + let r = t[e * 3], o = t[e * 3 + 1], a = t[e * 3 + 2], l = t[i * 3], c = t[i * 3 + 1], u = t[i * 3 + 2], d = t[s * 3], p = t[s * 3 + 1], f = t[s * 3 + 2], m = t[n * 3], y1 = t[n * 3 + 1], g = t[n * 3 + 2]; + return Math.abs(o - c) < Math.abs(r - l) ? [ + new T(r, 1 - a), + new T(l, 1 - u), + new T(d, 1 - f), + new T(m, 1 - g) + ] : [ + new T(o, 1 - a), + new T(c, 1 - u), + new T(p, 1 - f), + new T(y1, 1 - g) + ]; + } +}; +function pd(h, t, e) { + if (e.shapes = [], Array.isArray(h)) for(let i = 0, s = h.length; i < s; i++){ + let n = h[i]; + e.shapes.push(n.uuid); + } + else e.shapes.push(h.uuid); + return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e; +} +var Jr = class h extends We { + constructor(t = 1, e = 0){ + let i = (1 + Math.sqrt(5)) / 2, s = [ + -1, + i, + 0, + 1, + i, + 0, + -1, + -i, + 0, + 1, + -i, + 0, + 0, + -1, + i, + 0, + 1, + i, + 0, + -1, + -i, + 0, + 1, + -i, + i, + 0, + -1, + i, + 0, + 1, + -i, + 0, + -1, + -i, + 0, + 1 + ], n = [ + 0, + 11, + 5, + 0, + 5, + 1, + 0, + 1, + 7, + 0, + 7, + 10, + 0, + 10, + 11, + 1, + 5, + 9, + 5, + 11, + 4, + 11, + 10, + 2, + 10, + 7, + 6, + 7, + 1, + 8, + 3, + 9, + 4, + 3, + 4, + 2, + 3, + 2, + 6, + 3, + 6, + 8, + 3, + 8, + 9, + 4, + 9, + 5, + 2, + 4, + 11, + 6, + 2, + 10, + 8, + 6, + 7, + 9, + 8, + 1 + ]; + super(s, n, t, e), this.type = "IcosahedronGeometry", this.parameters = { + radius: t, + detail: e + }; } - function f(U) { - return n.isWebGL2 ? s1.bindVertexArray(U) : r.bindVertexArrayOES(U); + static fromJSON(t) { + return new h(t.radius, t.detail); } - function m(U) { - return n.isWebGL2 ? s1.deleteVertexArray(U) : r.deleteVertexArrayOES(U); +}, fn = class h extends We { + constructor(t = 1, e = 0){ + let i = [ + 1, + 0, + 0, + -1, + 0, + 0, + 0, + 1, + 0, + 0, + -1, + 0, + 0, + 0, + 1, + 0, + 0, + -1 + ], s = [ + 0, + 2, + 4, + 0, + 4, + 3, + 0, + 3, + 5, + 0, + 5, + 2, + 1, + 2, + 5, + 1, + 5, + 3, + 1, + 3, + 4, + 1, + 4, + 2 + ]; + super(i, s, t, e), this.type = "OctahedronGeometry", this.parameters = { + radius: t, + detail: e + }; } - function _(U, z, q) { - let H = q.wireframe === !0, ne = o[U.id]; - ne === void 0 && (ne = {}, o[U.id] = ne); - let W = ne[z.id]; - W === void 0 && (W = {}, ne[z.id] = W); - let K = W[H]; - return K === void 0 && (K = g(d()), W[H] = K), K; + static fromJSON(t) { + return new h(t.radius, t.detail); } - function g(U) { - let z = [], q = [], H = []; - for(let ne = 0; ne < i; ne++)z[ne] = 0, q[ne] = 0, H[ne] = 0; - return { - geometry: null, - program: null, - wireframe: !1, - newAttributes: z, - enabledAttributes: q, - attributeDivisors: H, - object: U, - attributes: {}, - index: null +}, Zr = class h extends L { + constructor(t = 1, e = 1, i = 1, s = 1){ + super(), this.type = "PlaneGeometry", this.parameters = { + width: t, + height: e, + widthSegments: i, + heightSegments: s }; - } - function p(U, z, q, H) { - let ne = l.attributes, W = z.attributes, K = 0, D = q.getAttributes(); - for(let G in D)if (D[G].location >= 0) { - let fe = ne[G], _e = W[G]; - if (_e === void 0 && (G === "instanceMatrix" && U.instanceMatrix && (_e = U.instanceMatrix), G === "instanceColor" && U.instanceColor && (_e = U.instanceColor)), fe === void 0 || fe.attribute !== _e || _e && fe.data !== _e.data) return !0; - K++; + let n = t / 2, r = e / 2, o = Math.floor(i), a = Math.floor(s), l = o + 1, c = a + 1, u = t / o, d = e / a, p = [], f = [], m = [], y1 = []; + for(let g = 0; g < c; g++){ + let x1 = g * d - r; + for(let b = 0; b < l; b++){ + let M = b * u - n; + f.push(M, -x1, 0), m.push(0, 0, 1), y1.push(b / o), y1.push(1 - g / a); + } } - return l.attributesNum !== K || l.index !== H; - } - function v(U, z, q, H) { - let ne = {}, W = z.attributes, K = 0, D = q.getAttributes(); - for(let G in D)if (D[G].location >= 0) { - let fe = W[G]; - fe === void 0 && (G === "instanceMatrix" && U.instanceMatrix && (fe = U.instanceMatrix), G === "instanceColor" && U.instanceColor && (fe = U.instanceColor)); - let _e = {}; - _e.attribute = fe, fe && fe.data && (_e.data = fe.data), ne[G] = _e, K++; + for(let g = 0; g < a; g++)for(let x1 = 0; x1 < o; x1++){ + let b = x1 + l * g, M = x1 + l * (g + 1), _ = x1 + 1 + l * (g + 1), v = x1 + 1 + l * g; + p.push(b, M, v), p.push(M, _, v); } - l.attributes = ne, l.attributesNum = K, l.index = H; - } - function x1() { - let U = l.newAttributes; - for(let z = 0, q = U.length; z < q; z++)U[z] = 0; + this.setIndex(p), this.setAttribute("position", new E(f, 3)), this.setAttribute("normal", new E(m, 3)), this.setAttribute("uv", new E(y1, 2)); } - function y1(U) { - b(U, 0); + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - function b(U, z) { - let q = l.newAttributes, H = l.enabledAttributes, ne = l.attributeDivisors; - q[U] = 1, H[U] === 0 && (s1.enableVertexAttribArray(U), H[U] = 1), ne[U] !== z && ((n.isWebGL2 ? s1 : e.get("ANGLE_instanced_arrays"))[n.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](U, z), ne[U] = z); + static fromJSON(t) { + return new h(t.width, t.height, t.widthSegments, t.heightSegments); } - function w() { - let U = l.newAttributes, z = l.enabledAttributes; - for(let q = 0, H = z.length; q < H; q++)z[q] !== U[q] && (s1.disableVertexAttribArray(q), z[q] = 0); - } - function R(U, z, q, H, ne, W, K) { - K === !0 ? s1.vertexAttribIPointer(U, z, q, ne, W) : s1.vertexAttribPointer(U, z, q, H, ne, W); - } - function I(U, z, q, H) { - if (n.isWebGL2 === !1 && (U.isInstancedMesh || H.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null) return; - x1(); - let ne = H.attributes, W = q.getAttributes(), K = z.defaultAttributeValues; - for(let D in W){ - let G = W[D]; - if (G.location >= 0) { - let he = ne[D]; - if (he === void 0 && (D === "instanceMatrix" && U.instanceMatrix && (he = U.instanceMatrix), D === "instanceColor" && U.instanceColor && (he = U.instanceColor)), he !== void 0) { - let fe = he.normalized, _e = he.itemSize, we = t.get(he); - if (we === void 0) continue; - let Ee = we.buffer, Te = we.type, Ye = we.bytesPerElement, it = n.isWebGL2 === !0 && (Te === s1.INT || Te === s1.UNSIGNED_INT || he.gpuType === dd); - if (he.isInterleavedBufferAttribute) { - let Ce = he.data, L = Ce.stride, oe = he.offset; - if (Ce.isInstancedInterleavedBuffer) { - for(let X = 0; X < G.locationSize; X++)b(G.location + X, Ce.meshPerAttribute); - U.isInstancedMesh !== !0 && H._maxInstanceCount === void 0 && (H._maxInstanceCount = Ce.meshPerAttribute * Ce.count); - } else for(let X = 0; X < G.locationSize; X++)y1(G.location + X); - s1.bindBuffer(s1.ARRAY_BUFFER, Ee); - for(let X = 0; X < G.locationSize; X++)R(G.location + X, _e / G.locationSize, Te, fe, L * Ye, (oe + _e / G.locationSize * X) * Ye, it); - } else { - if (he.isInstancedBufferAttribute) { - for(let Ce = 0; Ce < G.locationSize; Ce++)b(G.location + Ce, he.meshPerAttribute); - U.isInstancedMesh !== !0 && H._maxInstanceCount === void 0 && (H._maxInstanceCount = he.meshPerAttribute * he.count); - } else for(let Ce = 0; Ce < G.locationSize; Ce++)y1(G.location + Ce); - s1.bindBuffer(s1.ARRAY_BUFFER, Ee); - for(let Ce = 0; Ce < G.locationSize; Ce++)R(G.location + Ce, _e / G.locationSize, Te, fe, _e * Ye, _e / G.locationSize * Ce * Ye, it); - } - } else if (K !== void 0) { - let fe = K[D]; - if (fe !== void 0) switch(fe.length){ - case 2: - s1.vertexAttrib2fv(G.location, fe); - break; - case 3: - s1.vertexAttrib3fv(G.location, fe); - break; - case 4: - s1.vertexAttrib4fv(G.location, fe); - break; - default: - s1.vertexAttrib1fv(G.location, fe); - } - } +}, Yr = class h extends L { + constructor(t = .5, e = 1, i = 32, s = 1, n = 0, r = Math.PI * 2){ + super(), this.type = "RingGeometry", this.parameters = { + innerRadius: t, + outerRadius: e, + thetaSegments: i, + phiSegments: s, + thetaStart: n, + thetaLength: r + }, i = Math.max(3, i), s = Math.max(1, s); + let o = [], a = [], l = [], c = [], u = t, d = (e - t) / s, p = new w, f = new T; + for(let m = 0; m <= s; m++){ + for(let y1 = 0; y1 <= i; y1++){ + let g = n + y1 / i * r; + p.x = u * Math.cos(g), p.y = u * Math.sin(g), a.push(p.x, p.y, p.z), l.push(0, 0, 1), f.x = (p.x / e + 1) / 2, f.y = (p.y / e + 1) / 2, c.push(f.x, f.y); } + u += d; } - w(); - } - function M() { - Y(); - for(let U in o){ - let z = o[U]; - for(let q in z){ - let H = z[q]; - for(let ne in H)m(H[ne].object), delete H[ne]; - delete z[q]; + for(let m = 0; m < s; m++){ + let y1 = m * (i + 1); + for(let g = 0; g < i; g++){ + let x1 = g + y1, b = x1, M = x1 + i + 1, _ = x1 + i + 2, v = x1 + 1; + o.push(b, M, v), o.push(M, _, v); } - delete o[U]; - } - } - function T(U) { - if (o[U.id] === void 0) return; - let z = o[U.id]; - for(let q in z){ - let H = z[q]; - for(let ne in H)m(H[ne].object), delete H[ne]; - delete z[q]; - } - delete o[U.id]; - } - function O(U) { - for(let z in o){ - let q = o[z]; - if (q[U.id] === void 0) continue; - let H = q[U.id]; - for(let ne in H)m(H[ne].object), delete H[ne]; - delete q[U.id]; } + this.setIndex(o), this.setAttribute("position", new E(a, 3)), this.setAttribute("normal", new E(l, 3)), this.setAttribute("uv", new E(c, 2)); } - function Y() { - $(), h = !0, l !== c && (l = c, f(l.object)); - } - function $() { - c.geometry = null, c.program = null, c.wireframe = !1; - } - return { - setup: u, - reset: Y, - resetDefaultState: $, - dispose: M, - releaseStatesOfGeometry: T, - releaseStatesOfProgram: O, - initAttributes: x1, - enableAttribute: y1, - disableUnusedAttributes: w - }; -} -function i_(s1, e, t, n) { - let i = n.isWebGL2, r; - function a(l) { - r = l; + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - function o(l, h) { - s1.drawArrays(r, l, h), t.update(h, r, 1); + static fromJSON(t) { + return new h(t.innerRadius, t.outerRadius, t.thetaSegments, t.phiSegments, t.thetaStart, t.thetaLength); } - function c(l, h, u) { - if (u === 0) return; - let d, f; - if (i) d = s1, f = "drawArraysInstanced"; - else if (d = e.get("ANGLE_instanced_arrays"), f = "drawArraysInstancedANGLE", d === null) { - console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); - return; +}, $r = class h extends L { + constructor(t = new Me([ + new T(0, .5), + new T(-.5, -.5), + new T(.5, -.5) + ]), e = 12){ + super(), this.type = "ShapeGeometry", this.parameters = { + shapes: t, + curveSegments: e + }; + let i = [], s = [], n = [], r = [], o = 0, a = 0; + if (Array.isArray(t) === !1) l(t); + else for(let c = 0; c < t.length; c++)l(t[c]), this.addGroup(o, a, c), o += a, a = 0; + this.setIndex(i), this.setAttribute("position", new E(s, 3)), this.setAttribute("normal", new E(n, 3)), this.setAttribute("uv", new E(r, 2)); + function l(c) { + let u = s.length / 3, d = c.extractPoints(e), p = d.shape, f = d.holes; + he.isClockWise(p) === !1 && (p = p.reverse()); + for(let y1 = 0, g = f.length; y1 < g; y1++){ + let x1 = f[y1]; + he.isClockWise(x1) === !0 && (f[y1] = x1.reverse()); + } + let m = he.triangulateShape(p, f); + for(let y1 = 0, g = f.length; y1 < g; y1++){ + let x1 = f[y1]; + p = p.concat(x1); + } + for(let y1 = 0, g = p.length; y1 < g; y1++){ + let x1 = p[y1]; + s.push(x1.x, x1.y, 0), n.push(0, 0, 1), r.push(x1.x, x1.y); + } + for(let y1 = 0, g = m.length; y1 < g; y1++){ + let x1 = m[y1], b = x1[0] + u, M = x1[1] + u, _ = x1[2] + u; + i.push(b, M, _), a += 3; + } } - d[f](r, l, h, u), t.update(h, r, u); } - this.setMode = a, this.render = o, this.renderInstances = c; -} -function s_(s1, e, t) { - let n; - function i() { - if (n !== void 0) return n; - if (e.has("EXT_texture_filter_anisotropic") === !0) { - let R = e.get("EXT_texture_filter_anisotropic"); - n = s1.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT); - } else n = 0; - return n; + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - function r(R) { - if (R === "highp") { - if (s1.getShaderPrecisionFormat(s1.VERTEX_SHADER, s1.HIGH_FLOAT).precision > 0 && s1.getShaderPrecisionFormat(s1.FRAGMENT_SHADER, s1.HIGH_FLOAT).precision > 0) return "highp"; - R = "mediump"; - } - return R === "mediump" && s1.getShaderPrecisionFormat(s1.VERTEX_SHADER, s1.MEDIUM_FLOAT).precision > 0 && s1.getShaderPrecisionFormat(s1.FRAGMENT_SHADER, s1.MEDIUM_FLOAT).precision > 0 ? "mediump" : "lowp"; + toJSON() { + let t = super.toJSON(), e = this.parameters.shapes; + return fd(e, t); } - let a = typeof WebGL2RenderingContext < "u" && s1.constructor.name === "WebGL2RenderingContext", o = t.precision !== void 0 ? t.precision : "highp", c = r(o); - c !== o && (console.warn("THREE.WebGLRenderer:", o, "not supported, using", c, "instead."), o = c); - let l = a || e.has("WEBGL_draw_buffers"), h = t.logarithmicDepthBuffer === !0, u = s1.getParameter(s1.MAX_TEXTURE_IMAGE_UNITS), d = s1.getParameter(s1.MAX_VERTEX_TEXTURE_IMAGE_UNITS), f = s1.getParameter(s1.MAX_TEXTURE_SIZE), m = s1.getParameter(s1.MAX_CUBE_MAP_TEXTURE_SIZE), _ = s1.getParameter(s1.MAX_VERTEX_ATTRIBS), g = s1.getParameter(s1.MAX_VERTEX_UNIFORM_VECTORS), p = s1.getParameter(s1.MAX_VARYING_VECTORS), v = s1.getParameter(s1.MAX_FRAGMENT_UNIFORM_VECTORS), x1 = d > 0, y1 = a || e.has("OES_texture_float"), b = x1 && y1, w = a ? s1.getParameter(s1.MAX_SAMPLES) : 0; - return { - isWebGL2: a, - drawBuffers: l, - getMaxAnisotropy: i, - getMaxPrecision: r, - precision: o, - logarithmicDepthBuffer: h, - maxTextures: u, - maxVertexTextures: d, - maxTextureSize: f, - maxCubemapSize: m, - maxAttributes: _, - maxVertexUniforms: g, - maxVaryings: p, - maxFragmentUniforms: v, - vertexTextures: x1, - floatFragmentTextures: y1, - floatVertexTextures: b, - maxSamples: w - }; -} -function r_(s1) { - let e = this, t = null, n = 0, i = !1, r = !1, a = new mn, o = new He, c = { - value: null, - needsUpdate: !1 - }; - this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(u, d) { - let f = u.length !== 0 || d || n !== 0 || i; - return i = d, n = u.length, f; - }, this.beginShadows = function() { - r = !0, h(null); - }, this.endShadows = function() { - r = !1; - }, this.setGlobalState = function(u, d) { - t = h(u, d, 0); - }, this.setState = function(u, d, f) { - let m = u.clippingPlanes, _ = u.clipIntersection, g = u.clipShadows, p = s1.get(u); - if (!i || m === null || m.length === 0 || r && !g) r ? h(null) : l(); - else { - let v = r ? 0 : n, x1 = v * 4, y1 = p.clippingState || null; - c.value = y1, y1 = h(m, d, x1, f); - for(let b = 0; b !== x1; ++b)y1[b] = t[b]; - p.clippingState = y1, this.numIntersection = _ ? this.numPlanes : 0, this.numPlanes += v; + static fromJSON(t, e) { + let i = []; + for(let s = 0, n = t.shapes.length; s < n; s++){ + let r = e[t.shapes[s]]; + i.push(r); } - }; - function l() { - c.value !== t && (c.value = t, c.needsUpdate = n > 0), e.numPlanes = n, e.numIntersection = 0; + return new h(i, t.curveSegments); } - function h(u, d, f, m) { - let _ = u !== null ? u.length : 0, g = null; - if (_ !== 0) { - if (g = c.value, m !== !0 || g === null) { - let p = f + _ * 4, v = d.matrixWorldInverse; - o.getNormalMatrix(v), (g === null || g.length < p) && (g = new Float32Array(p)); - for(let x1 = 0, y1 = f; x1 !== _; ++x1, y1 += 4)a.copy(u[x1]).applyMatrix4(v, o), a.normal.toArray(g, y1), g[y1 + 3] = a.constant; - } - c.value = g, c.needsUpdate = !0; - } - return e.numPlanes = _, e.numIntersection = 0, g; +}; +function fd(h, t) { + if (t.shapes = [], Array.isArray(h)) for(let e = 0, i = h.length; e < i; e++){ + let s = h[e]; + t.shapes.push(s.uuid); } + else t.shapes.push(h.uuid); + return t; } -function a_(s1) { - let e = new WeakMap; - function t(a, o) { - return o === Ir ? a.mapping = zn : o === Ur && (a.mapping = ci), a; - } - function n(a) { - if (a && a.isTexture && a.isRenderTargetTexture === !1) { - let o = a.mapping; - if (o === Ir || o === Ur) if (e.has(a)) { - let c = e.get(a).texture; - return t(c, a.mapping); - } else { - let c = a.image; - if (c && c.height > 0) { - let l = new xo(c.height / 2); - return l.fromEquirectangularTexture(s1, a), e.set(a, l), a.addEventListener("dispose", i), t(l.texture, a.mapping); - } else return null; +var mn = class h extends L { + constructor(t = 1, e = 32, i = 16, s = 0, n = Math.PI * 2, r = 0, o = Math.PI){ + super(), this.type = "SphereGeometry", this.parameters = { + radius: t, + widthSegments: e, + heightSegments: i, + phiStart: s, + phiLength: n, + thetaStart: r, + thetaLength: o + }, e = Math.max(3, Math.floor(e)), i = Math.max(2, Math.floor(i)); + let a = Math.min(r + o, Math.PI), l = 0, c = [], u = new w, d = new w, p = [], f = [], m = [], y1 = []; + for(let g = 0; g <= i; g++){ + let x1 = [], b = g / i, M = 0; + g === 0 && r === 0 ? M = .5 / e : g === i && a === Math.PI && (M = -.5 / e); + for(let _ = 0; _ <= e; _++){ + let v = _ / e; + u.x = -t * Math.cos(s + v * n) * Math.sin(r + b * o), u.y = t * Math.cos(r + b * o), u.z = t * Math.sin(s + v * n) * Math.sin(r + b * o), f.push(u.x, u.y, u.z), d.copy(u).normalize(), m.push(d.x, d.y, d.z), y1.push(v + M, 1 - b), x1.push(l++); } + c.push(x1); } - return a; - } - function i(a) { - let o = a.target; - o.removeEventListener("dispose", i); - let c = e.get(o); - c !== void 0 && (e.delete(o), c.dispose()); - } - function r() { - e = new WeakMap; - } - return { - get: n, - dispose: r - }; -} -var Ls = class extends Cs { - constructor(e = -1, t = 1, n = 1, i = -1, r = .1, a = 2e3){ - super(), this.isOrthographicCamera = !0, this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = n, this.bottom = i, this.near = r, this.far = a, this.updateProjectionMatrix(); - } - copy(e, t) { - return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = e.view === null ? null : Object.assign({}, e.view), this; - } - setViewOffset(e, t, n, i, r, a) { - this.view === null && (this.view = { - enabled: !0, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix(); - } - clearViewOffset() { - this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - let 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, r = n - e, a = n + e, o = i + t, c = i - t; - if (this.view !== null && this.view.enabled) { - let l = (this.right - this.left) / this.view.fullWidth / this.zoom, h = (this.top - this.bottom) / this.view.fullHeight / this.zoom; - r += l * this.view.offsetX, a = r + l * this.view.width, o -= h * this.view.offsetY, c = o - h * this.view.height; + for(let g = 0; g < i; g++)for(let x1 = 0; x1 < e; x1++){ + let b = c[g][x1 + 1], M = c[g][x1], _ = c[g + 1][x1], v = c[g + 1][x1 + 1]; + (g !== 0 || r > 0) && p.push(b, M, v), (g !== i - 1 || a < Math.PI) && p.push(M, _, v); } - this.projectionMatrix.makeOrthographic(r, a, o, c, this.near, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(e) { - let 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; - } -}, Hi = 4, hh = [ - .125, - .215, - .35, - .446, - .526, - .582 -], ei = 20, $a = new Ls, uh = new pe, Ka = null, jn = (1 + Math.sqrt(5)) / 2, Li = 1 / jn, dh = [ - new A(1, 1, 1), - new A(-1, 1, 1), - new A(1, 1, -1), - new A(-1, 1, -1), - new A(0, jn, Li), - new A(0, jn, -Li), - new A(Li, 0, jn), - new A(-Li, 0, jn), - new A(jn, Li, 0), - new A(-jn, Li, 0) -], Kr = class { - 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) { - Ka = this._renderer.getRenderTarget(), this._setSize(256); - let r = this._allocateTargets(); - return r.depthBuffer = !0, this._sceneToCubeUV(e, n, i, r), t > 0 && this._blur(r, 0, 0, t), this._applyPMREM(r), this._cleanup(r), r; - } - fromEquirectangular(e, t = null) { - return this._fromTexture(e, t); - } - fromCubemap(e, t = null) { - return this._fromTexture(e, t); - } - compileCubemapShader() { - this._cubemapMaterial === null && (this._cubemapMaterial = mh(), this._compileMaterial(this._cubemapMaterial)); - } - compileEquirectangularShader() { - this._equirectMaterial === null && (this._equirectMaterial = ph(), 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(); + this.setIndex(p), this.setAttribute("position", new E(f, 3)), this.setAttribute("normal", new E(m, 3)), this.setAttribute("uv", new E(y1, 2)); } - _cleanup(e) { - this._renderer.setRenderTarget(Ka), e.scissorTest = !1, lr(e, 0, 0, e.width, e.height); + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - _fromTexture(e, t) { - e.mapping === zn || e.mapping === ci ? this._setSize(e.image.length === 0 ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), Ka = this._renderer.getRenderTarget(); - let n = t || this._allocateTargets(); - return this._textureToCubeUV(e, n), this._applyPMREM(n), this._cleanup(n), n; + static fromJSON(t) { + return new h(t.radius, t.widthSegments, t.heightSegments, t.phiStart, t.phiLength, t.thetaStart, t.thetaLength); } - _allocateTargets() { - let e = 3 * Math.max(this._cubeSize, 112), t = 4 * this._cubeSize, n = { - magFilter: mt, - minFilter: mt, - generateMipmaps: !1, - type: Ts, - format: Wt, - colorSpace: Mn, - depthBuffer: !1 - }, i = fh(e, t, n); - if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) { - this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = fh(e, t, n); - let { _lodMax: r } = this; - ({ sizeLods: this._sizeLods , lodPlanes: this._lodPlanes , sigmas: this._sigmas } = o_(r)), this._blurMaterial = c_(r, e, t); - } - return i; - } - _compileMaterial(e) { - let t = new Mt(this._lodPlanes[0], e); - this._renderer.compile(t, $a); - } - _sceneToCubeUV(e, t, n, i) { - let o = new yt(90, 1, t, n), c = [ - 1, - -1, - 1, +}, Qr = class h extends We { + constructor(t = 1, e = 0){ + let i = [ 1, 1, - 1 - ], l = [ 1, + -1, + -1, 1, + -1, 1, -1, + 1, -1, -1 - ], h = this._renderer, u = h.autoClear, d = h.toneMapping; - h.getClearColor(uh), h.toneMapping = Nn, h.autoClear = !1; - let f = new Sn({ - name: "PMREM.Background", - side: Ft, - depthWrite: !1, - depthTest: !1 - }), m = new Mt(new Ji, f), _ = !1, g = e.background; - g ? g.isColor && (f.color.copy(g), e.background = null, _ = !0) : (f.color.copy(uh), _ = !0); - for(let p = 0; p < 6; p++){ - let v = p % 3; - v === 0 ? (o.up.set(0, c[p], 0), o.lookAt(l[p], 0, 0)) : v === 1 ? (o.up.set(0, 0, c[p]), o.lookAt(0, l[p], 0)) : (o.up.set(0, c[p], 0), o.lookAt(0, 0, l[p])); - let x1 = this._cubeSize; - lr(i, v * x1, p > 2 ? x1 : 0, x1, x1), h.setRenderTarget(i), _ && h.render(m, o), h.render(e, o); - } - m.geometry.dispose(), m.material.dispose(), h.toneMapping = d, h.autoClear = u, e.background = g; - } - _textureToCubeUV(e, t) { - let n = this._renderer, i = e.mapping === zn || e.mapping === ci; - i ? (this._cubemapMaterial === null && (this._cubemapMaterial = mh()), this._cubemapMaterial.uniforms.flipEnvMap.value = e.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = ph()); - let r = i ? this._cubemapMaterial : this._equirectMaterial, a = new Mt(this._lodPlanes[0], r), o = r.uniforms; - o.envMap.value = e; - let c = this._cubeSize; - lr(t, 0, 0, 3 * c, 2 * c), n.setRenderTarget(t), n.render(a, $a); - } - _applyPMREM(e) { - let t = this._renderer, n = t.autoClear; - t.autoClear = !1; - for(let i = 1; i < this._lodPlanes.length; i++){ - let r = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]), a = dh[(i - 1) % dh.length]; - this._blur(e, i - 1, i, r, a); - } - t.autoClear = n; - } - _blur(e, t, n, i, r) { - let a = this._pingPongRenderTarget; - this._halfBlur(e, a, t, n, i, "latitudinal", r), this._halfBlur(a, e, n, n, i, "longitudinal", r); - } - _halfBlur(e, t, n, i, r, a, o) { - let c = this._renderer, l = this._blurMaterial; - a !== "latitudinal" && a !== "longitudinal" && console.error("blur direction must be either latitudinal or longitudinal!"); - let h = 3, u = new Mt(this._lodPlanes[i], l), d = l.uniforms, f = this._sizeLods[n] - 1, m = isFinite(r) ? Math.PI / (2 * f) : 2 * Math.PI / (2 * ei - 1), _ = r / m, g = isFinite(r) ? 1 + Math.floor(h * _) : ei; - g > ei && console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ei}`); - let p = [], v = 0; - for(let R = 0; R < ei; ++R){ - let I = R / _, M = Math.exp(-I * I / 2); - p.push(M), R === 0 ? v += M : R < g && (v += 2 * M); - } - for(let R = 0; R < p.length; R++)p[R] = p[R] / v; - d.envMap.value = e.texture, d.samples.value = g, d.weights.value = p, d.latitudinal.value = a === "latitudinal", o && (d.poleAxis.value = o); - let { _lodMax: x1 } = this; - d.dTheta.value = m, d.mipInt.value = x1 - n; - let y1 = this._sizeLods[i], b = 3 * y1 * (i > x1 - Hi ? i - x1 + Hi : 0), w = 4 * (this._cubeSize - y1); - lr(t, b, w, 3 * y1, 2 * y1), c.setRenderTarget(t), c.render(u, $a); + ], s = [ + 2, + 1, + 0, + 0, + 3, + 2, + 1, + 3, + 0, + 2, + 3, + 1 + ]; + super(i, s, t, e), this.type = "TetrahedronGeometry", this.parameters = { + radius: t, + detail: e + }; } -}; -function o_(s1) { - let e = [], t = [], n = [], i = s1, r = s1 - Hi + 1 + hh.length; - for(let a = 0; a < r; a++){ - let o = Math.pow(2, i); - t.push(o); - let c = 1 / o; - a > s1 - Hi ? c = hh[a - s1 + Hi - 1] : a === 0 && (c = 0), n.push(c); - let l = 1 / (o - 2), h = -l, u = 1 + l, d = [ - h, - h, - u, - h, - u, - u, - h, - h, - u, - u, - h, - u - ], f = 6, m = 6, _ = 3, g = 2, p = 1, v = new Float32Array(_ * m * f), x1 = new Float32Array(g * m * f), y1 = new Float32Array(p * m * f); - for(let w = 0; w < f; w++){ - let R = w % 3 * 2 / 3 - 1, I = w > 2 ? 0 : -1, M = [ - R, - I, - 0, - R + 2 / 3, - I, - 0, - R + 2 / 3, - I + 1, - 0, - R, - I, - 0, - R + 2 / 3, - I + 1, - 0, - R, - I + 1, - 0 - ]; - v.set(M, _ * m * w), x1.set(d, g * m * w); - let T = [ - w, - w, - w, - w, - w, - w - ]; - y1.set(T, p * m * w); + static fromJSON(t) { + return new h(t.radius, t.detail); + } +}, jr = class h extends L { + constructor(t = 1, e = .4, i = 12, s = 48, n = Math.PI * 2){ + super(), this.type = "TorusGeometry", this.parameters = { + radius: t, + tube: e, + radialSegments: i, + tubularSegments: s, + arc: n + }, i = Math.floor(i), s = Math.floor(s); + let r = [], o = [], a = [], l = [], c = new w, u = new w, d = new w; + for(let p = 0; p <= i; p++)for(let f = 0; f <= s; f++){ + let m = f / s * n, y1 = p / i * Math.PI * 2; + u.x = (t + e * Math.cos(y1)) * Math.cos(m), u.y = (t + e * Math.cos(y1)) * Math.sin(m), u.z = e * Math.sin(y1), o.push(u.x, u.y, u.z), c.x = t * Math.cos(m), c.y = t * Math.sin(m), d.subVectors(u, c).normalize(), a.push(d.x, d.y, d.z), l.push(f / s), l.push(p / i); + } + for(let p = 1; p <= i; p++)for(let f = 1; f <= s; f++){ + let m = (s + 1) * p + f - 1, y1 = (s + 1) * (p - 1) + f - 1, g = (s + 1) * (p - 1) + f, x1 = (s + 1) * p + f; + r.push(m, y1, x1), r.push(y1, g, x1); } - let b = new Ge; - b.setAttribute("position", new et(v, _)), b.setAttribute("uv", new et(x1, g)), b.setAttribute("faceIndex", new et(y1, p)), e.push(b), i > Hi && i--; + this.setIndex(r), this.setAttribute("position", new E(o, 3)), this.setAttribute("normal", new E(a, 3)), this.setAttribute("uv", new E(l, 2)); } - return { - lodPlanes: e, - sizeLods: t, - sigmas: n - }; -} -function fh(s1, e, t) { - let n = new qt(s1, e, t); - return n.texture.mapping = Vs, n.texture.name = "PMREM.cubeUv", n.scissorTest = !0, n; -} -function lr(s1, e, t, n, i) { - s1.viewport.set(e, t, n, i), s1.scissor.set(e, t, n, i); -} -function c_(s1, e, t) { - let n = new Float32Array(ei), i = new A(0, 1, 0); - return new jt({ - name: "SphericalGaussianBlur", - defines: { - n: ei, - CUBEUV_TEXEL_WIDTH: 1 / e, - CUBEUV_TEXEL_HEIGHT: 1 / t, - CUBEUV_MAX_MIP: `${s1}.0` - }, - uniforms: { - envMap: { - value: null - }, - samples: { - value: 1 - }, - weights: { - value: n - }, - latitudinal: { - value: !1 - }, - dTheta: { - value: 0 - }, - mipInt: { - value: 0 - }, - poleAxis: { - value: i + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.radius, t.tube, t.radialSegments, t.tubularSegments, t.arc); + } +}, Kr = class h extends L { + constructor(t = 1, e = .4, i = 64, s = 8, n = 2, r = 3){ + super(), this.type = "TorusKnotGeometry", this.parameters = { + radius: t, + tube: e, + tubularSegments: i, + radialSegments: s, + p: n, + q: r + }, i = Math.floor(i), s = Math.floor(s); + let o = [], a = [], l = [], c = [], u = new w, d = new w, p = new w, f = new w, m = new w, y1 = new w, g = new w; + for(let b = 0; b <= i; ++b){ + let M = b / i * n * Math.PI * 2; + x1(M, n, r, t, p), x1(M + .01, n, r, t, f), y1.subVectors(f, p), g.addVectors(f, p), m.crossVectors(y1, g), g.crossVectors(m, y1), m.normalize(), g.normalize(); + for(let _ = 0; _ <= s; ++_){ + let v = _ / s * Math.PI * 2, S = -e * Math.cos(v), A = e * Math.sin(v); + u.x = p.x + (S * g.x + A * m.x), u.y = p.y + (S * g.y + A * m.y), u.z = p.z + (S * g.z + A * m.z), a.push(u.x, u.y, u.z), d.subVectors(u, p).normalize(), l.push(d.x, d.y, d.z), c.push(b / i), c.push(_ / s); } - }, - vertexShader: Zc(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `, - blending: Dn, - depthTest: !1, - depthWrite: !1 - }); -} -function ph() { - return new jt({ - name: "EquirectangularToCubeUV", - uniforms: { - envMap: { - value: null + } + for(let b = 1; b <= i; b++)for(let M = 1; M <= s; M++){ + let _ = (s + 1) * (b - 1) + (M - 1), v = (s + 1) * b + (M - 1), S = (s + 1) * b + M, A = (s + 1) * (b - 1) + M; + o.push(_, v, A), o.push(v, S, A); + } + this.setIndex(o), this.setAttribute("position", new E(a, 3)), this.setAttribute("normal", new E(l, 3)), this.setAttribute("uv", new E(c, 2)); + function x1(b, M, _, v, S) { + let A = Math.cos(b), I = Math.sin(b), C = _ / M * b, k = Math.cos(C); + S.x = v * (2 + k) * .5 * A, S.y = v * (2 + k) * I * .5, S.z = v * Math.sin(C) * .5; + } + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + static fromJSON(t) { + return new h(t.radius, t.tube, t.tubularSegments, t.radialSegments, t.p, t.q); + } +}, to = class h extends L { + constructor(t = new cn(new w(-1, -1, 0), new w(-1, 1, 0), new w(1, 1, 0)), e = 64, i = 1, s = 8, n = !1){ + super(), this.type = "TubeGeometry", this.parameters = { + path: t, + tubularSegments: e, + radius: i, + radialSegments: s, + closed: n + }; + let r = t.computeFrenetFrames(e, n); + this.tangents = r.tangents, this.normals = r.normals, this.binormals = r.binormals; + let o = new w, a = new w, l = new T, c = new w, u = [], d = [], p = [], f = []; + m(), this.setIndex(f), this.setAttribute("position", new E(u, 3)), this.setAttribute("normal", new E(d, 3)), this.setAttribute("uv", new E(p, 2)); + function m() { + for(let b = 0; b < e; b++)y1(b); + y1(n === !1 ? e : 0), x1(), g(); + } + function y1(b) { + c = t.getPointAt(b / e, c); + let M = r.normals[b], _ = r.binormals[b]; + for(let v = 0; v <= s; v++){ + let S = v / s * Math.PI * 2, A = Math.sin(S), I = -Math.cos(S); + a.x = I * M.x + A * _.x, a.y = I * M.y + A * _.y, a.z = I * M.z + A * _.z, a.normalize(), d.push(a.x, a.y, a.z), o.x = c.x + i * a.x, o.y = c.y + i * a.y, o.z = c.z + i * a.z, u.push(o.x, o.y, o.z); } - }, - vertexShader: Zc(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `, - blending: Dn, - depthTest: !1, - depthWrite: !1 - }); -} -function mh() { - return new jt({ - name: "CubemapToCubeUV", - uniforms: { - envMap: { - value: null - }, - flipEnvMap: { - value: -1 + } + function g() { + for(let b = 1; b <= e; b++)for(let M = 1; M <= s; M++){ + let _ = (s + 1) * (b - 1) + (M - 1), v = (s + 1) * b + (M - 1), S = (s + 1) * b + M, A = (s + 1) * (b - 1) + M; + f.push(_, v, A), f.push(v, S, A); } - }, - vertexShader: Zc(), - fragmentShader: ` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `, - blending: Dn, - depthTest: !1, - depthWrite: !1 - }); -} -function Zc() { - return ` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `; -} -function l_(s1) { - let e = new WeakMap, t = null; - function n(o) { - if (o && o.isTexture) { - let c = o.mapping, l = c === Ir || c === Ur, h = c === zn || c === ci; - if (l || h) if (o.isRenderTargetTexture && o.needsPMREMUpdate === !0) { - o.needsPMREMUpdate = !1; - let u = e.get(o); - return t === null && (t = new Kr(s1)), u = l ? t.fromEquirectangular(o, u) : t.fromCubemap(o, u), e.set(o, u), u.texture; + } + function x1() { + for(let b = 0; b <= e; b++)for(let M = 0; M <= s; M++)l.x = b / e, l.y = M / s, p.push(l.x, l.y); + } + } + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; + } + toJSON() { + let t = super.toJSON(); + return t.path = this.parameters.path.toJSON(), t; + } + static fromJSON(t) { + return new h(new dn[t.path.type]().fromJSON(t.path), t.tubularSegments, t.radius, t.radialSegments, t.closed); + } +}, eo = class extends L { + constructor(t = null){ + if (super(), this.type = "WireframeGeometry", this.parameters = { + geometry: t + }, t !== null) { + let e = [], i = new Set, s = new w, n = new w; + if (t.index !== null) { + let r = t.attributes.position, o = t.index, a = t.groups; + a.length === 0 && (a = [ + { + start: 0, + count: o.count, + materialIndex: 0 + } + ]); + for(let l = 0, c = a.length; l < c; ++l){ + let u = a[l], d = u.start, p = u.count; + for(let f = d, m = d + p; f < m; f += 3)for(let y1 = 0; y1 < 3; y1++){ + let g = o.getX(f + y1), x1 = o.getX(f + (y1 + 1) % 3); + s.fromBufferAttribute(r, g), n.fromBufferAttribute(r, x1), ph(s, n, i) === !0 && (e.push(s.x, s.y, s.z), e.push(n.x, n.y, n.z)); + } + } } else { - if (e.has(o)) return e.get(o).texture; - { - let u = o.image; - if (l && u && u.height > 0 || h && u && i(u)) { - t === null && (t = new Kr(s1)); - let d = l ? t.fromEquirectangular(o) : t.fromCubemap(o); - return e.set(o, d), o.addEventListener("dispose", r), d.texture; - } else return null; + let r = t.attributes.position; + for(let o = 0, a = r.count / 3; o < a; o++)for(let l = 0; l < 3; l++){ + let c = 3 * o + l, u = 3 * o + (l + 1) % 3; + s.fromBufferAttribute(r, c), n.fromBufferAttribute(r, u), ph(s, n, i) === !0 && (e.push(s.x, s.y, s.z), e.push(n.x, n.y, n.z)); } } + this.setAttribute("position", new E(e, 3)); } - return o; } - function i(o) { - let c = 0, l = 6; - for(let h = 0; h < l; h++)o[h] !== void 0 && c++; - return c === l; + copy(t) { + return super.copy(t), this.parameters = Object.assign({}, t.parameters), this; } - function r(o) { - let c = o.target; - c.removeEventListener("dispose", r); - let l = e.get(c); - l !== void 0 && (e.delete(c), l.dispose()); +}; +function ph(h, t, e) { + let i = `${h.x},${h.y},${h.z}-${t.x},${t.y},${t.z}`, s = `${t.x},${t.y},${t.z}-${h.x},${h.y},${h.z}`; + return e.has(i) === !0 || e.has(s) === !0 ? !1 : (e.add(i), e.add(s), !0); +} +var fh = Object.freeze({ + __proto__: null, + BoxGeometry: Ks, + CapsuleGeometry: Dr, + CircleGeometry: Lr, + ConeGeometry: Ur, + CylinderGeometry: $i, + DodecahedronGeometry: Wr, + EdgesGeometry: Hr, + ExtrudeGeometry: Xr, + IcosahedronGeometry: Jr, + LatheGeometry: pn, + OctahedronGeometry: fn, + PlaneGeometry: Zr, + PolyhedronGeometry: We, + RingGeometry: Yr, + ShapeGeometry: $r, + SphereGeometry: mn, + TetrahedronGeometry: Qr, + TorusGeometry: jr, + TorusKnotGeometry: Kr, + TubeGeometry: to, + WireframeGeometry: eo +}), io = class extends ct { + constructor(t){ + super(), this.isShadowMaterial = !0, this.type = "ShadowMaterial", this.color = new P(0), this.transparent = !0, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.fog = t.fog, this; + } +}, so = class extends qi { + constructor(t){ + super(t), this.isRawShaderMaterial = !0, this.type = "RawShaderMaterial"; + } +}, yn = class extends ct { + constructor(t){ + super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = { + STANDARD: "" + }, this.color = new P(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 P(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Xt, this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(t); } - function a() { - e = new WeakMap, t !== null && (t.dispose(), t = null); + copy(t) { + return super.copy(t), this.defines = { + STANDARD: "" + }, this.color.copy(t.color), this.roughness = t.roughness, this.metalness = t.metalness, this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.roughnessMap = t.roughnessMap, this.metalnessMap = t.metalnessMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapRotation.copy(t.envMapRotation), this.envMapIntensity = t.envMapIntensity, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.flatShading = t.flatShading, this.fog = t.fog, this; } - return { - get: n, - dispose: a - }; +}, no = class extends yn { + constructor(t){ + super(), this.isMeshPhysicalMaterial = !0, this.defines = { + STANDARD: "", + PHYSICAL: "" + }, this.type = "MeshPhysicalMaterial", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new T(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, "reflectivity", { + get: function() { + return N(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1); + }, + set: function(e) { + this.ior = (1 + .4 * e) / (1 - .4 * e); + } + }), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [ + 100, + 400 + ], this.iridescenceThicknessMap = null, this.sheenColor = new P(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 P(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new P(1, 1, 1), this.specularColorMap = null, this._anisotropy = 0, this._clearcoat = 0, this._dispersion = 0, this._iridescence = 0, this._sheen = 0, this._transmission = 0, this.setValues(t); + } + get anisotropy() { + return this._anisotropy; + } + set anisotropy(t) { + this._anisotropy > 0 != t > 0 && this.version++, this._anisotropy = t; + } + get clearcoat() { + return this._clearcoat; + } + set clearcoat(t) { + this._clearcoat > 0 != t > 0 && this.version++, this._clearcoat = t; + } + get iridescence() { + return this._iridescence; + } + set iridescence(t) { + this._iridescence > 0 != t > 0 && this.version++, this._iridescence = t; + } + get dispersion() { + return this._dispersion; + } + set dispersion(t) { + this._dispersion > 0 != t > 0 && this.version++, this._dispersion = t; + } + get sheen() { + return this._sheen; + } + set sheen(t) { + this._sheen > 0 != t > 0 && this.version++, this._sheen = t; + } + get transmission() { + return this._transmission; + } + set transmission(t) { + this._transmission > 0 != t > 0 && this.version++, this._transmission = t; + } + copy(t) { + return super.copy(t), this.defines = { + STANDARD: "", + PHYSICAL: "" + }, this.anisotropy = t.anisotropy, this.anisotropyRotation = t.anisotropyRotation, this.anisotropyMap = t.anisotropyMap, this.clearcoat = t.clearcoat, this.clearcoatMap = t.clearcoatMap, this.clearcoatRoughness = t.clearcoatRoughness, this.clearcoatRoughnessMap = t.clearcoatRoughnessMap, this.clearcoatNormalMap = t.clearcoatNormalMap, this.clearcoatNormalScale.copy(t.clearcoatNormalScale), this.dispersion = t.dispersion, this.ior = t.ior, this.iridescence = t.iridescence, this.iridescenceMap = t.iridescenceMap, this.iridescenceIOR = t.iridescenceIOR, this.iridescenceThicknessRange = [ + ...t.iridescenceThicknessRange + ], this.iridescenceThicknessMap = t.iridescenceThicknessMap, this.sheen = t.sheen, this.sheenColor.copy(t.sheenColor), this.sheenColorMap = t.sheenColorMap, this.sheenRoughness = t.sheenRoughness, this.sheenRoughnessMap = t.sheenRoughnessMap, this.transmission = t.transmission, this.transmissionMap = t.transmissionMap, this.thickness = t.thickness, this.thicknessMap = t.thicknessMap, this.attenuationDistance = t.attenuationDistance, this.attenuationColor.copy(t.attenuationColor), this.specularIntensity = t.specularIntensity, this.specularIntensityMap = t.specularIntensityMap, this.specularColor.copy(t.specularColor), this.specularColorMap = t.specularColorMap, this; + } +}, ro = class extends ct { + constructor(t){ + super(), this.isMeshPhongMaterial = !0, this.type = "MeshPhongMaterial", this.color = new P(16777215), this.specular = new P(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new P(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Xt, this.combine = Do, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.specular.copy(t.specular), this.shininess = t.shininess, this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapRotation.copy(t.envMapRotation), this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.flatShading = t.flatShading, this.fog = t.fog, this; + } +}, oo = class extends ct { + constructor(t){ + super(), this.isMeshToonMaterial = !0, this.defines = { + TOON: "" + }, this.type = "MeshToonMaterial", this.color = new P(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new P(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.gradientMap = t.gradientMap, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.alphaMap = t.alphaMap, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.fog = t.fog, this; + } +}, ao = class extends ct { + constructor(t){ + super(), this.isMeshNormalMaterial = !0, this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.flatShading = !1, this.setValues(t); + } + copy(t) { + return super.copy(t), this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.flatShading = t.flatShading, this; + } +}, ho = class extends ct { + constructor(t){ + super(), this.isMeshLambertMaterial = !0, this.type = "MeshLambertMaterial", this.color = new P(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new P(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Xt, this.combine = Do, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.color.copy(t.color), this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapRotation.copy(t.envMapRotation), this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.flatShading = t.flatShading, this.fog = t.fog, this; + } +}, lo = class extends ct { + constructor(t){ + super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = Jc, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(t); + } + copy(t) { + return super.copy(t), this.depthPacking = t.depthPacking, this.map = t.map, this.alphaMap = t.alphaMap, this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this; + } +}, co = class extends ct { + constructor(t){ + super(), this.isMeshDistanceMaterial = !0, this.type = "MeshDistanceMaterial", this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.map = t.map, this.alphaMap = t.alphaMap, this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this; + } +}, uo = class extends ct { + constructor(t){ + super(), this.isMeshMatcapMaterial = !0, this.defines = { + MATCAP: "" + }, this.type = "MeshMatcapMaterial", this.color = new P(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = _i, this.normalScale = new T(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.flatShading = !1, this.fog = !0, this.setValues(t); + } + copy(t) { + return super.copy(t), this.defines = { + MATCAP: "" + }, this.color.copy(t.color), this.matcap = t.matcap, this.map = t.map, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.alphaMap = t.alphaMap, this.flatShading = t.flatShading, this.fog = t.fog, this; + } +}, po = class extends mt { + constructor(t){ + super(), this.isLineDashedMaterial = !0, this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(t); + } + copy(t) { + return super.copy(t), this.scale = t.scale, this.dashSize = t.dashSize, this.gapSize = t.gapSize, this; + } +}; +function Ve(h, t, e) { + return !h || !e && h.constructor === t ? h : typeof t.BYTES_PER_ELEMENT == "number" ? new t(h) : Array.prototype.slice.call(h); +} +function Pl(h) { + return ArrayBuffer.isView(h) && !(h instanceof DataView); +} +function Ol(h) { + function t(s, n) { + return h[s] - h[n]; + } + let e = h.length, i = new Array(e); + for(let s = 0; s !== e; ++s)i[s] = s; + return i.sort(t), i; +} +function fo(h, t, e) { + let i = h.length, s = new h.constructor(i); + for(let n = 0, r = 0; r !== i; ++n){ + let o = e[n] * t; + for(let a = 0; a !== t; ++a)s[r++] = h[o + a]; + } + return s; +} +function Xo(h, t, e, i) { + let s = 1, n = h[0]; + for(; n !== void 0 && n[i] === void 0;)n = h[s++]; + if (n === void 0) return; + let r = n[i]; + if (r !== void 0) if (Array.isArray(r)) do r = n[i], r !== void 0 && (t.push(n.time), e.push.apply(e, r)), n = h[s++]; + while (n !== void 0) + else if (r.toArray !== void 0) do r = n[i], r !== void 0 && (t.push(n.time), r.toArray(e, e.length)), n = h[s++]; + while (n !== void 0) + else do r = n[i], r !== void 0 && (t.push(n.time), e.push(r)), n = h[s++]; + while (n !== void 0) +} +function md(h, t, e, i, s = 30) { + let n = h.clone(); + n.name = t; + let r = []; + for(let a = 0; a < n.tracks.length; ++a){ + let l = n.tracks[a], c = l.getValueSize(), u = [], d = []; + for(let p = 0; p < l.times.length; ++p){ + let f = l.times[p] * s; + if (!(f < e || f >= i)) { + u.push(l.times[p]); + for(let m = 0; m < c; ++m)d.push(l.values[p * c + m]); + } + } + u.length !== 0 && (l.times = Ve(u, l.times.constructor), l.values = Ve(d, l.values.constructor), r.push(l)); + } + n.tracks = r; + let o = 1 / 0; + for(let a = 0; a < n.tracks.length; ++a)o > n.tracks[a].times[0] && (o = n.tracks[a].times[0]); + for(let a = 0; a < n.tracks.length; ++a)n.tracks[a].shift(-1 * o); + return n.resetDuration(), n; +} +function yd(h, t = 0, e = h, i = 30) { + i <= 0 && (i = 30); + let s = e.tracks.length, n = t / i; + for(let r = 0; r < s; ++r){ + let o = e.tracks[r], a = o.ValueTypeName; + if (a === "bool" || a === "string") continue; + let l = h.tracks.find(function(g) { + return g.name === o.name && g.ValueTypeName === a; + }); + if (l === void 0) continue; + let c = 0, u = o.getValueSize(); + o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (c = u / 3); + let d = 0, p = l.getValueSize(); + l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = p / 3); + let f = o.times.length - 1, m; + if (n <= o.times[0]) { + let g = c, x1 = u - c; + m = o.values.slice(g, x1); + } else if (n >= o.times[f]) { + let g = f * u + c, x1 = g + u - c; + m = o.values.slice(g, x1); + } else { + let g = o.createInterpolant(), x1 = c, b = u - c; + g.evaluate(n), m = g.resultBuffer.slice(x1, b); + } + a === "quaternion" && new bt().fromArray(m).normalize().conjugate().toArray(m); + let y1 = l.times.length; + for(let g = 0; g < y1; ++g){ + let x1 = g * p + d; + if (a === "quaternion") bt.multiplyQuaternionsFlat(l.values, x1, m, 0, l.values, x1); + else { + let b = p - d * 2; + for(let M = 0; M < b; ++M)l.values[x1 + M] -= m[M]; + } + } + } + return h.blendMode = Cl, h; } -function h_(s1) { - let e = {}; - function t(n) { - if (e[n] !== void 0) return e[n]; - let i; - switch(n){ - case "WEBGL_depth_texture": - i = s1.getExtension("WEBGL_depth_texture") || s1.getExtension("MOZ_WEBGL_depth_texture") || s1.getExtension("WEBKIT_WEBGL_depth_texture"); +var Pf = { + convertArray: Ve, + isTypedArray: Pl, + getKeyframeOrder: Ol, + sortedArray: fo, + flattenJSON: Xo, + subclip: md, + makeClipAdditive: yd +}, yi = class { + constructor(t, e, i, s){ + this.parameterPositions = t, this._cachedIndex = 0, this.resultBuffer = s !== void 0 ? s : new e.constructor(i), this.sampleValues = e, this.valueSize = i, this.settings = null, this.DefaultSettings_ = {}; + } + evaluate(t) { + let e = this.parameterPositions, i = this._cachedIndex, s = e[i], n = e[i - 1]; + t: { + e: { + let r; + i: { + s: if (!(t < s)) { + for(let o = i + 2;;){ + if (s === void 0) { + if (t < n) break s; + return i = e.length, this._cachedIndex = i, this.copySampleValue_(i - 1); + } + if (i === o) break; + if (n = s, s = e[++i], t < s) break e; + } + r = e.length; + break i; + } + if (!(t >= n)) { + let o = e[1]; + t < o && (i = 2, n = o); + for(let a = i - 2;;){ + if (n === void 0) return this._cachedIndex = 0, this.copySampleValue_(0); + if (i === a) break; + if (s = n, n = e[--i - 1], t >= n) break e; + } + r = i, i = 0; + break i; + } + break t; + } + for(; i < r;){ + let o = i + r >>> 1; + t < e[o] ? r = o : i = o + 1; + } + if (s = e[i], n = e[i - 1], n === void 0) return this._cachedIndex = 0, this.copySampleValue_(0); + if (s === void 0) return i = e.length, this._cachedIndex = i, this.copySampleValue_(i - 1); + } + this._cachedIndex = i, this.intervalChanged_(i, n, s); + } + return this.interpolate_(i, n, t, s); + } + getSettings_() { + return this.settings || this.DefaultSettings_; + } + copySampleValue_(t) { + let e = this.resultBuffer, i = this.sampleValues, s = this.valueSize, n = t * s; + for(let r = 0; r !== s; ++r)e[r] = i[n + r]; + return e; + } + interpolate_() { + throw new Error("call to abstract method"); + } + intervalChanged_() {} +}, mo = class extends yi { + constructor(t, e, i, s){ + super(t, e, i, s), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = { + endingStart: hi, + endingEnd: hi + }; + } + intervalChanged_(t, e, i) { + let s = this.parameterPositions, n = t - 2, r = t + 1, o = s[n], a = s[r]; + if (o === void 0) switch(this.getSettings_().endingStart){ + case li: + n = t, o = 2 * e - i; break; - case "EXT_texture_filter_anisotropic": - i = s1.getExtension("EXT_texture_filter_anisotropic") || s1.getExtension("MOZ_EXT_texture_filter_anisotropic") || s1.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); + case Xs: + n = s.length - 2, o = e + s[n] - s[n + 1]; break; - case "WEBGL_compressed_texture_s3tc": - i = s1.getExtension("WEBGL_compressed_texture_s3tc") || s1.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || s1.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); + default: + n = t, o = i; + } + if (a === void 0) switch(this.getSettings_().endingEnd){ + case li: + r = t, a = 2 * i - e; break; - case "WEBGL_compressed_texture_pvrtc": - i = s1.getExtension("WEBGL_compressed_texture_pvrtc") || s1.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); + case Xs: + r = 1, a = i + s[1] - s[0]; break; default: - i = s1.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) { - let i = t(n); - return i === null && console.warn("THREE.WebGLRenderer: " + n + " extension not supported."), i; + r = t - 1, a = e; } - }; -} -function u_(s1, e, t, n) { - let i = {}, r = new WeakMap; - function a(u) { - let d = u.target; - d.index !== null && e.remove(d.index); - for(let m in d.attributes)e.remove(d.attributes[m]); - for(let m in d.morphAttributes){ - let _ = d.morphAttributes[m]; - for(let g = 0, p = _.length; g < p; g++)e.remove(_[g]); - } - d.removeEventListener("dispose", a), delete i[d.id]; - let f = r.get(d); - f && (e.remove(f), r.delete(d)), n.releaseStatesOfGeometry(d), d.isInstancedBufferGeometry === !0 && delete d._maxInstanceCount, t.memory.geometries--; + let l = (i - e) * .5, c = this.valueSize; + this._weightPrev = l / (e - o), this._weightNext = l / (a - i), this._offsetPrev = n * c, this._offsetNext = r * c; } - function o(u, d) { - return i[d.id] === !0 || (d.addEventListener("dispose", a), i[d.id] = !0, t.memory.geometries++), d; + interpolate_(t, e, i, s) { + let n = this.resultBuffer, r = this.sampleValues, o = this.valueSize, a = t * o, l = a - o, c = this._offsetPrev, u = this._offsetNext, d = this._weightPrev, p = this._weightNext, f = (i - e) / (s - e), m = f * f, y1 = m * f, g = -d * y1 + 2 * d * m - d * f, x1 = (1 + d) * y1 + (-1.5 - 2 * d) * m + (-.5 + d) * f + 1, b = (-1 - p) * y1 + (1.5 + p) * m + .5 * f, M = p * y1 - p * m; + for(let _ = 0; _ !== o; ++_)n[_] = g * r[c + _] + x1 * r[l + _] + b * r[a + _] + M * r[u + _]; + return n; } - function c(u) { - let d = u.attributes; - for(let m in d)e.update(d[m], s1.ARRAY_BUFFER); - let f = u.morphAttributes; - for(let m in f){ - let _ = f[m]; - for(let g = 0, p = _.length; g < p; g++)e.update(_[g], s1.ARRAY_BUFFER); - } +}, gn = class extends yi { + constructor(t, e, i, s){ + super(t, e, i, s); } - function l(u) { - let d = [], f = u.index, m = u.attributes.position, _ = 0; - if (f !== null) { - let v = f.array; - _ = f.version; - for(let x1 = 0, y1 = v.length; x1 < y1; x1 += 3){ - let b = v[x1 + 0], w = v[x1 + 1], R = v[x1 + 2]; - d.push(b, w, w, R, R, b); - } - } else if (m !== void 0) { - let v = m.array; - _ = m.version; - for(let x1 = 0, y1 = v.length / 3 - 1; x1 < y1; x1 += 3){ - let b = x1 + 0, w = x1 + 1, R = x1 + 2; - d.push(b, w, w, R, R, b); - } - } else return; - let g = new (Md(d) ? Jr : Zr)(d, 1); - g.version = _; - let p = r.get(u); - p && e.remove(p), r.set(u, g); - } - function h(u) { - let d = r.get(u); - if (d) { - let f = u.index; - f !== null && d.version < f.version && l(u); - } else l(u); - return r.get(u); + interpolate_(t, e, i, s) { + let n = this.resultBuffer, r = this.sampleValues, o = this.valueSize, a = t * o, l = a - o, c = (i - e) / (s - e), u = 1 - c; + for(let d = 0; d !== o; ++d)n[d] = r[l + d] * u + r[a + d] * c; + return n; } - return { - get: o, - update: c, - getWireframeAttribute: h - }; -} -function d_(s1, e, t, n) { - let i = n.isWebGL2, r; - function a(d) { - r = d; +}, yo = class extends yi { + constructor(t, e, i, s){ + super(t, e, i, s); } - let o, c; - function l(d) { - o = d.type, c = d.bytesPerElement; + interpolate_(t) { + return this.copySampleValue_(t - 1); } - function h(d, f) { - s1.drawElements(r, f, o, d * c), t.update(f, r, 1); +}, kt = class { + constructor(t, e, i, s){ + if (t === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined"); + if (e === void 0 || e.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + t); + this.name = t, this.times = Ve(e, this.TimeBufferType), this.values = Ve(i, this.ValueBufferType), this.setInterpolation(s || this.DefaultInterpolation); } - function u(d, f, m) { - if (m === 0) return; - let _, g; - if (i) _ = s1, g = "drawElementsInstanced"; - else if (_ = e.get("ANGLE_instanced_arrays"), g = "drawElementsInstancedANGLE", _ === null) { - console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); - return; + static toJSON(t) { + let e = t.constructor, i; + if (e.toJSON !== this.toJSON) i = e.toJSON(t); + else { + i = { + name: t.name, + times: Ve(t.times, Array), + values: Ve(t.values, Array) + }; + let s = t.getInterpolation(); + s !== t.DefaultInterpolation && (i.interpolation = s); } - _[g](r, f, o, d * c, m), t.update(f, r, m); + return i.type = t.ValueTypeName, i; } - this.setMode = a, this.setIndex = l, this.render = h, this.renderInstances = u; -} -function f_(s1) { - let e = { - geometries: 0, - textures: 0 - }, t = { - frame: 0, - calls: 0, - triangles: 0, - points: 0, - lines: 0 - }; - function n(r, a, o) { - switch(t.calls++, a){ - case s1.TRIANGLES: - t.triangles += o * (r / 3); + InterpolantFactoryMethodDiscrete(t) { + return new yo(this.times, this.values, this.getValueSize(), t); + } + InterpolantFactoryMethodLinear(t) { + return new gn(this.times, this.values, this.getValueSize(), t); + } + InterpolantFactoryMethodSmooth(t) { + return new mo(this.times, this.values, this.getValueSize(), t); + } + setInterpolation(t) { + let e; + switch(t){ + case Gs: + e = this.InterpolantFactoryMethodDiscrete; break; - case s1.LINES: - t.lines += o * (r / 2); + case mr: + e = this.InterpolantFactoryMethodLinear; break; - case s1.LINE_STRIP: - t.lines += o * (r - 1); + case zn: + e = this.InterpolantFactoryMethodSmooth; break; - case s1.LINE_LOOP: - t.lines += o * r; + } + if (e === void 0) { + let i = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; + if (this.createInterpolant === void 0) if (t !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation); + else throw new Error(i); + return console.warn("THREE.KeyframeTrack:", i), this; + } + return this.createInterpolant = e, this; + } + getInterpolation() { + switch(this.createInterpolant){ + case this.InterpolantFactoryMethodDiscrete: + return Gs; + case this.InterpolantFactoryMethodLinear: + return mr; + case this.InterpolantFactoryMethodSmooth: + return zn; + } + } + getValueSize() { + return this.values.length / this.times.length; + } + shift(t) { + if (t !== 0) { + let e = this.times; + for(let i = 0, s = e.length; i !== s; ++i)e[i] += t; + } + return this; + } + scale(t) { + if (t !== 1) { + let e = this.times; + for(let i = 0, s = e.length; i !== s; ++i)e[i] *= t; + } + return this; + } + trim(t, e) { + let i = this.times, s = i.length, n = 0, r = s - 1; + for(; n !== s && i[n] < t;)++n; + for(; r !== -1 && i[r] > e;)--r; + if (++r, n !== 0 || r !== s) { + n >= r && (r = Math.max(r, 1), n = r - 1); + let o = this.getValueSize(); + this.times = i.slice(n, r), this.values = this.values.slice(n * o, r * o); + } + return this; + } + validate() { + let t = !0, e = this.getValueSize(); + e - Math.floor(e) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), t = !1); + let i = this.times, s = this.values, n = i.length; + n === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), t = !1); + let r = null; + for(let o = 0; o !== n; o++){ + let a = i[o]; + if (typeof a == "number" && isNaN(a)) { + console.error("THREE.KeyframeTrack: Time is not a valid number.", this, o, a), t = !1; break; - case s1.POINTS: - t.points += o * r; + } + if (r !== null && r > a) { + console.error("THREE.KeyframeTrack: Out of order keys.", this, o, a, r), t = !1; break; - default: - console.error("THREE.WebGLInfo: Unknown draw mode:", a); + } + r = a; + } + if (s !== void 0 && Pl(s)) for(let o = 0, a = s.length; o !== a; ++o){ + let l = s[o]; + if (isNaN(l)) { + console.error("THREE.KeyframeTrack: Value is not a valid number.", this, o, l), t = !1; break; + } } + return t; } - function i() { - t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0; - } - return { - memory: e, - render: t, - programs: null, - autoReset: !0, - reset: i, - update: n - }; -} -function p_(s1, e) { - return s1[0] - e[0]; -} -function m_(s1, e) { - return Math.abs(e[1]) - Math.abs(s1[1]); -} -function g_(s1, e, t) { - let n = {}, i = new Float32Array(8), r = new WeakMap, a = new je, o = []; - for(let l = 0; l < 8; l++)o[l] = [ - l, - 0 - ]; - function c(l, h, u) { - let d = l.morphTargetInfluences; - if (e.isWebGL2 === !0) { - let f = h.morphAttributes.position || h.morphAttributes.normal || h.morphAttributes.color, m = f !== void 0 ? f.length : 0, _ = r.get(h); - if (_ === void 0 || _.count !== m) { - let U = function() { - Y.dispose(), r.delete(h), h.removeEventListener("dispose", U); - }; - _ !== void 0 && _.texture.dispose(); - let v = h.morphAttributes.position !== void 0, x1 = h.morphAttributes.normal !== void 0, y1 = h.morphAttributes.color !== void 0, b = h.morphAttributes.position || [], w = h.morphAttributes.normal || [], R = h.morphAttributes.color || [], I = 0; - v === !0 && (I = 1), x1 === !0 && (I = 2), y1 === !0 && (I = 3); - let M = h.attributes.position.count * I, T = 1; - M > e.maxTextureSize && (T = Math.ceil(M / e.maxTextureSize), M = e.maxTextureSize); - let O = new Float32Array(M * T * 4 * m), Y = new As(O, M, T, m); - Y.type = xn, Y.needsUpdate = !0; - let $ = I * 4; - for(let z = 0; z < m; z++){ - let q = b[z], H = w[z], ne = R[z], W = M * T * 4 * z; - for(let K = 0; K < q.count; K++){ - let D = K * $; - v === !0 && (a.fromBufferAttribute(q, K), O[W + D + 0] = a.x, O[W + D + 1] = a.y, O[W + D + 2] = a.z, O[W + D + 3] = 0), x1 === !0 && (a.fromBufferAttribute(H, K), O[W + D + 4] = a.x, O[W + D + 5] = a.y, O[W + D + 6] = a.z, O[W + D + 7] = 0), y1 === !0 && (a.fromBufferAttribute(ne, K), O[W + D + 8] = a.x, O[W + D + 9] = a.y, O[W + D + 10] = a.z, O[W + D + 11] = ne.itemSize === 4 ? a.w : 1); + optimize() { + let t = this.times.slice(), e = this.values.slice(), i = this.getValueSize(), s = this.getInterpolation() === zn, n = t.length - 1, r = 1; + for(let o = 1; o < n; ++o){ + let a = !1, l = t[o], c = t[o + 1]; + if (l !== c && (o !== 1 || l !== t[0])) if (s) a = !0; + else { + let u = o * i, d = u - i, p = u + i; + for(let f = 0; f !== i; ++f){ + let m = e[u + f]; + if (m !== e[d + f] || m !== e[p + f]) { + a = !0; + break; } } - _ = { - count: m, - texture: Y, - size: new Z(M, T) - }, r.set(h, _), h.addEventListener("dispose", U); - } - let g = 0; - for(let v = 0; v < d.length; v++)g += d[v]; - let p = h.morphTargetsRelative ? 1 : 1 - g; - u.getUniforms().setValue(s1, "morphTargetBaseInfluence", p), u.getUniforms().setValue(s1, "morphTargetInfluences", d), u.getUniforms().setValue(s1, "morphTargetsTexture", _.texture, t), u.getUniforms().setValue(s1, "morphTargetsTextureSize", _.size); - } else { - let f = d === void 0 ? 0 : d.length, m = n[h.id]; - if (m === void 0 || m.length !== f) { - m = []; - for(let x1 = 0; x1 < f; x1++)m[x1] = [ - x1, - 0 - ]; - n[h.id] = m; } - for(let x1 = 0; x1 < f; x1++){ - let y1 = m[x1]; - y1[0] = x1, y1[1] = d[x1]; + if (a) { + if (o !== r) { + t[r] = t[o]; + let u = o * i, d = r * i; + for(let p = 0; p !== i; ++p)e[d + p] = e[u + p]; + } + ++r; } - m.sort(m_); - for(let x1 = 0; x1 < 8; x1++)x1 < f && m[x1][1] ? (o[x1][0] = m[x1][0], o[x1][1] = m[x1][1]) : (o[x1][0] = Number.MAX_SAFE_INTEGER, o[x1][1] = 0); - o.sort(p_); - let _ = h.morphAttributes.position, g = h.morphAttributes.normal, p = 0; - for(let x1 = 0; x1 < 8; x1++){ - let y1 = o[x1], b = y1[0], w = y1[1]; - b !== Number.MAX_SAFE_INTEGER && w ? (_ && h.getAttribute("morphTarget" + x1) !== _[b] && h.setAttribute("morphTarget" + x1, _[b]), g && h.getAttribute("morphNormal" + x1) !== g[b] && h.setAttribute("morphNormal" + x1, g[b]), i[x1] = w, p += w) : (_ && h.hasAttribute("morphTarget" + x1) === !0 && h.deleteAttribute("morphTarget" + x1), g && h.hasAttribute("morphNormal" + x1) === !0 && h.deleteAttribute("morphNormal" + x1), i[x1] = 0); + } + if (n > 0) { + t[r] = t[n]; + for(let o = n * i, a = r * i, l = 0; l !== i; ++l)e[a + l] = e[o + l]; + ++r; + } + return r !== t.length ? (this.times = t.slice(0, r), this.values = e.slice(0, r * i)) : (this.times = t, this.values = e), this; + } + clone() { + let t = this.times.slice(), e = this.values.slice(), i = this.constructor, s = new i(this.name, t, e); + return s.createInterpolant = this.createInterpolant, s; + } +}; +kt.prototype.TimeBufferType = Float32Array; +kt.prototype.ValueBufferType = Float32Array; +kt.prototype.DefaultInterpolation = mr; +var ve = class extends kt { + constructor(t, e, i){ + super(t, e, i); + } +}; +ve.prototype.ValueTypeName = "bool"; +ve.prototype.ValueBufferType = Array; +ve.prototype.DefaultInterpolation = Gs; +ve.prototype.InterpolantFactoryMethodLinear = void 0; +ve.prototype.InterpolantFactoryMethodSmooth = void 0; +var xn = class extends kt { +}; +xn.prototype.ValueTypeName = "color"; +var gi = class extends kt { +}; +gi.prototype.ValueTypeName = "number"; +var go = class extends yi { + constructor(t, e, i, s){ + super(t, e, i, s); + } + interpolate_(t, e, i, s) { + let n = this.resultBuffer, r = this.sampleValues, o = this.valueSize, a = (i - e) / (s - e), l = t * o; + for(let c = l + o; l !== c; l += 4)bt.slerpFlat(n, 0, r, l - o, r, l, a); + return n; + } +}, xi = class extends kt { + InterpolantFactoryMethodLinear(t) { + return new go(this.times, this.values, this.getValueSize(), t); + } +}; +xi.prototype.ValueTypeName = "quaternion"; +xi.prototype.InterpolantFactoryMethodSmooth = void 0; +var Ae = class extends kt { + constructor(t, e, i){ + super(t, e, i); + } +}; +Ae.prototype.ValueTypeName = "string"; +Ae.prototype.ValueBufferType = Array; +Ae.prototype.DefaultInterpolation = Gs; +Ae.prototype.InterpolantFactoryMethodLinear = void 0; +Ae.prototype.InterpolantFactoryMethodSmooth = void 0; +var bi = class extends kt { +}; +bi.prototype.ValueTypeName = "vector"; +var wi = class { + constructor(t = "", e = -1, i = [], s = Ho){ + this.name = t, this.tracks = i, this.duration = e, this.blendMode = s, this.uuid = It(), this.duration < 0 && this.resetDuration(); + } + static parse(t) { + let e = [], i = t.tracks, s = 1 / (t.fps || 1); + for(let r = 0, o = i.length; r !== o; ++r)e.push(xd(i[r]).scale(s)); + let n = new this(t.name, t.duration, e, t.blendMode); + return n.uuid = t.uuid, n; + } + static toJSON(t) { + let e = [], i = t.tracks, s = { + name: t.name, + duration: t.duration, + tracks: e, + uuid: t.uuid, + blendMode: t.blendMode + }; + for(let n = 0, r = i.length; n !== r; ++n)e.push(kt.toJSON(i[n])); + return s; + } + static CreateFromMorphTargetSequence(t, e, i, s) { + let n = e.length, r = []; + for(let o = 0; o < n; o++){ + let a = [], l = []; + a.push((o + n - 1) % n, o, (o + 1) % n), l.push(0, 1, 0); + let c = Ol(a); + a = fo(a, 1, c), l = fo(l, 1, c), !s && a[0] === 0 && (a.push(n), l.push(l[0])), r.push(new gi(".morphTargetInfluences[" + e[o].name + "]", a, l).scale(1 / i)); + } + return new this(t, -1, r); + } + static findByName(t, e) { + let i = t; + if (!Array.isArray(t)) { + let s = t; + i = s.geometry && s.geometry.animations || s.animations; + } + for(let s = 0; s < i.length; s++)if (i[s].name === e) return i[s]; + return null; + } + static CreateClipsFromMorphTargetSequences(t, e, i) { + let s = {}, n = /^([\w-]*?)([\d]+)$/; + for(let o = 0, a = t.length; o < a; o++){ + let l = t[o], c = l.name.match(n); + if (c && c.length > 1) { + let u = c[1], d = s[u]; + d || (s[u] = d = []), d.push(l); } - let v = h.morphTargetsRelative ? 1 : 1 - p; - u.getUniforms().setValue(s1, "morphTargetBaseInfluence", v), u.getUniforms().setValue(s1, "morphTargetInfluences", i); } + let r = []; + for(let o in s)r.push(this.CreateFromMorphTargetSequence(o, s[o], e, i)); + return r; } - return { - update: c - }; -} -function __(s1, e, t, n) { - let i = new WeakMap; - function r(c) { - let l = n.render.frame, h = c.geometry, u = e.get(c, h); - if (i.get(u) !== l && (e.update(u), i.set(u, l)), c.isInstancedMesh && (c.hasEventListener("dispose", o) === !1 && c.addEventListener("dispose", o), i.get(c) !== l && (t.update(c.instanceMatrix, s1.ARRAY_BUFFER), c.instanceColor !== null && t.update(c.instanceColor, s1.ARRAY_BUFFER), i.set(c, l))), c.isSkinnedMesh) { - let d = c.skeleton; - i.get(d) !== l && (d.update(), i.set(d, l)); + static parseAnimation(t, e) { + if (!t) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; + let i = function(u, d, p, f, m) { + if (p.length !== 0) { + let y1 = [], g = []; + Xo(p, y1, g, f), y1.length !== 0 && m.push(new u(d, y1, g)); + } + }, s = [], n = t.name || "default", r = t.fps || 30, o = t.blendMode, a = t.length || -1, l = t.hierarchy || []; + for(let u = 0; u < l.length; u++){ + let d = l[u].keys; + if (!(!d || d.length === 0)) if (d[0].morphTargets) { + let p = {}, f; + for(f = 0; f < d.length; f++)if (d[f].morphTargets) for(let m = 0; m < d[f].morphTargets.length; m++)p[d[f].morphTargets[m]] = -1; + for(let m in p){ + let y1 = [], g = []; + for(let x1 = 0; x1 !== d[f].morphTargets.length; ++x1){ + let b = d[f]; + y1.push(b.time), g.push(b.morphTarget === m ? 1 : 0); + } + s.push(new gi(".morphTargetInfluence[" + m + "]", y1, g)); + } + a = p.length * r; + } else { + let p = ".bones[" + e[u].name + "]"; + i(bi, p + ".position", d, "pos", s), i(xi, p + ".quaternion", d, "rot", s), i(bi, p + ".scale", d, "scl", s); + } } - return u; + return s.length === 0 ? null : new this(n, a, s, o); } - function a() { - i = new WeakMap; + resetDuration() { + let t = this.tracks, e = 0; + for(let i = 0, s = t.length; i !== s; ++i){ + let n = this.tracks[i]; + e = Math.max(e, n.times[n.times.length - 1]); + } + return this.duration = e, this; } - function o(c) { - let l = c.target; - l.removeEventListener("dispose", o), t.remove(l.instanceMatrix), l.instanceColor !== null && t.remove(l.instanceColor); + trim() { + for(let t = 0; t < this.tracks.length; t++)this.tracks[t].trim(0, this.duration); + return this; } - return { - update: r, - dispose: a - }; -} -var Td = new St, wd = new As, Ad = new qr, Rd = new Ki, gh = [], _h = [], xh = new Float32Array(16), vh = new Float32Array(9), yh = new Float32Array(4); -function as(s1, e, t) { - let n = s1[0]; - if (n <= 0 || n > 0) return s1; - let i = e * t, r = gh[i]; - if (r === void 0 && (r = new Float32Array(i), gh[i] = r), e !== 0) { - n.toArray(r, 0); - for(let a = 1, o = 0; a !== e; ++a)o += t, s1[a].toArray(r, o); + validate() { + let t = !0; + for(let e = 0; e < this.tracks.length; e++)t = t && this.tracks[e].validate(); + return t; } - return r; -} -function gt(s1, e) { - if (s1.length !== e.length) return !1; - for(let t = 0, n = s1.length; t < n; t++)if (s1[t] !== e[t]) return !1; - return !0; -} -function _t(s1, e) { - for(let t = 0, n = e.length; t < n; t++)s1[t] = e[t]; -} -function ya(s1, e) { - let t = _h[e]; - t === void 0 && (t = new Int32Array(e), _h[e] = t); - for(let n = 0; n !== e; ++n)t[n] = s1.allocateTextureUnit(); - return t; -} -function x_(s1, e) { - let t = this.cache; - t[0] !== e && (s1.uniform1f(this.addr, e), t[0] = e); -} -function v_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (s1.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); - else { - if (gt(t, e)) return; - s1.uniform2fv(this.addr, e), _t(t, e); + optimize() { + for(let t = 0; t < this.tracks.length; t++)this.tracks[t].optimize(); + return this; } -} -function y_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (s1.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) && (s1.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b); - else { - if (gt(t, e)) return; - s1.uniform3fv(this.addr, e), _t(t, e); + clone() { + let t = []; + for(let e = 0; e < this.tracks.length; e++)t.push(this.tracks[e].clone()); + return new this.constructor(this.name, this.duration, t, this.blendMode); + } + toJSON() { + return this.constructor.toJSON(this); } -} -function M_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (s1.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 (gt(t, e)) return; - s1.uniform4fv(this.addr, e), _t(t, e); +}; +function gd(h) { + switch(h.toLowerCase()){ + case "scalar": + case "double": + case "float": + case "number": + case "integer": + return gi; + case "vector": + case "vector2": + case "vector3": + case "vector4": + return bi; + case "color": + return xn; + case "quaternion": + return xi; + case "bool": + case "boolean": + return ve; + case "string": + return Ae; } + throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + h); } -function S_(s1, e) { - let t = this.cache, n = e.elements; - if (n === void 0) { - if (gt(t, e)) return; - s1.uniformMatrix2fv(this.addr, !1, e), _t(t, e); - } else { - if (gt(t, n)) return; - yh.set(n), s1.uniformMatrix2fv(this.addr, !1, yh), _t(t, n); +function xd(h) { + if (h.type === void 0) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); + let t = gd(h.type); + if (h.times === void 0) { + let e = [], i = []; + Xo(h.keys, e, i, "value"), h.times = e, h.values = i; } + return t.parse !== void 0 ? t.parse(h) : new t(h.name, h.times, h.values, h.interpolation); } -function b_(s1, e) { - let t = this.cache, n = e.elements; - if (n === void 0) { - if (gt(t, e)) return; - s1.uniformMatrix3fv(this.addr, !1, e), _t(t, e); - } else { - if (gt(t, n)) return; - vh.set(n), s1.uniformMatrix3fv(this.addr, !1, vh), _t(t, n); +var we = { + enabled: !1, + files: {}, + add: function(h, t) { + this.enabled !== !1 && (this.files[h] = t); + }, + get: function(h) { + if (this.enabled !== !1) return this.files[h]; + }, + remove: function(h) { + delete this.files[h]; + }, + clear: function() { + this.files = {}; } -} -function E_(s1, e) { - let t = this.cache, n = e.elements; - if (n === void 0) { - if (gt(t, e)) return; - s1.uniformMatrix4fv(this.addr, !1, e), _t(t, e); - } else { - if (gt(t, n)) return; - xh.set(n), s1.uniformMatrix4fv(this.addr, !1, xh), _t(t, n); +}, bn = class { + constructor(t, e, i){ + let s = this, n = !1, r = 0, o = 0, a, l = []; + this.onStart = void 0, this.onLoad = t, this.onProgress = e, this.onError = i, this.itemStart = function(c) { + o++, n === !1 && s.onStart !== void 0 && s.onStart(c, r, o), n = !0; + }, this.itemEnd = function(c) { + r++, s.onProgress !== void 0 && s.onProgress(c, r, o), r === o && (n = !1, s.onLoad !== void 0 && s.onLoad()); + }, this.itemError = function(c) { + s.onError !== void 0 && s.onError(c); + }, this.resolveURL = function(c) { + return a ? a(c) : c; + }, this.setURLModifier = function(c) { + return a = c, this; + }, this.addHandler = function(c, u) { + return l.push(c, u), this; + }, this.removeHandler = function(c) { + let u = l.indexOf(c); + return u !== -1 && l.splice(u, 2), this; + }, this.getHandler = function(c) { + for(let u = 0, d = l.length; u < d; u += 2){ + let p = l[u], f = l[u + 1]; + if (p.global && (p.lastIndex = 0), p.test(c)) return f; + } + return null; + }; } -} -function T_(s1, e) { - let t = this.cache; - t[0] !== e && (s1.uniform1i(this.addr, e), t[0] = e); -} -function w_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (s1.uniform2i(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); - else { - if (gt(t, e)) return; - s1.uniform2iv(this.addr, e), _t(t, e); +}, bd = new bn, wt = class { + constructor(t){ + this.manager = t !== void 0 ? t : bd, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}; } -} -function A_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (s1.uniform3i(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z); - else { - if (gt(t, e)) return; - s1.uniform3iv(this.addr, e), _t(t, e); + load() {} + loadAsync(t, e) { + let i = this; + return new Promise(function(s, n) { + i.load(t, s, e, n); + }); } -} -function R_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (s1.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 (gt(t, e)) return; - s1.uniform4iv(this.addr, e), _t(t, e); + parse() {} + setCrossOrigin(t) { + return this.crossOrigin = t, this; } -} -function C_(s1, e) { - let t = this.cache; - t[0] !== e && (s1.uniform1ui(this.addr, e), t[0] = e); -} -function P_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (s1.uniform2ui(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); - else { - if (gt(t, e)) return; - s1.uniform2uiv(this.addr, e), _t(t, e); + setWithCredentials(t) { + return this.withCredentials = t, this; } -} -function L_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (s1.uniform3ui(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z); - else { - if (gt(t, e)) return; - s1.uniform3uiv(this.addr, e), _t(t, e); + setPath(t) { + return this.path = t, this; } -} -function I_(s1, e) { - let t = this.cache; - if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (s1.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 (gt(t, e)) return; - s1.uniform4uiv(this.addr, e), _t(t, e); + setResourcePath(t) { + return this.resourcePath = t, this; } -} -function U_(s1, e, t) { - let n = this.cache, i = t.allocateTextureUnit(); - n[0] !== i && (s1.uniform1i(this.addr, i), n[0] = i), t.setTexture2D(e || Td, i); -} -function D_(s1, e, t) { - let n = this.cache, i = t.allocateTextureUnit(); - n[0] !== i && (s1.uniform1i(this.addr, i), n[0] = i), t.setTexture3D(e || Ad, i); -} -function N_(s1, e, t) { - let n = this.cache, i = t.allocateTextureUnit(); - n[0] !== i && (s1.uniform1i(this.addr, i), n[0] = i), t.setTextureCube(e || Rd, i); -} -function O_(s1, e, t) { - let n = this.cache, i = t.allocateTextureUnit(); - n[0] !== i && (s1.uniform1i(this.addr, i), n[0] = i), t.setTexture2DArray(e || wd, i); -} -function F_(s1) { - switch(s1){ - case 5126: - return x_; - case 35664: - return v_; - case 35665: - return y_; - case 35666: - return M_; - case 35674: - return S_; - case 35675: - return b_; - case 35676: - return E_; - case 5124: - case 35670: - return T_; - case 35667: - case 35671: - return w_; - case 35668: - case 35672: - return A_; - case 35669: - case 35673: - return R_; - case 5125: - return C_; - case 36294: - return P_; - case 36295: - return L_; - case 36296: - return I_; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return U_; - case 35679: - case 36299: - case 36307: - return D_; - case 35680: - case 36300: - case 36308: - case 36293: - return N_; - case 36289: - case 36303: - case 36311: - case 36292: - return O_; + setRequestHeader(t) { + return this.requestHeader = t, this; } -} -function B_(s1, e) { - s1.uniform1fv(this.addr, e); -} -function z_(s1, e) { - let t = as(e, this.size, 2); - s1.uniform2fv(this.addr, t); -} -function V_(s1, e) { - let t = as(e, this.size, 3); - s1.uniform3fv(this.addr, t); -} -function k_(s1, e) { - let t = as(e, this.size, 4); - s1.uniform4fv(this.addr, t); -} -function H_(s1, e) { - let t = as(e, this.size, 4); - s1.uniformMatrix2fv(this.addr, !1, t); -} -function G_(s1, e) { - let t = as(e, this.size, 9); - s1.uniformMatrix3fv(this.addr, !1, t); -} -function W_(s1, e) { - let t = as(e, this.size, 16); - s1.uniformMatrix4fv(this.addr, !1, t); -} -function X_(s1, e) { - s1.uniform1iv(this.addr, e); -} -function q_(s1, e) { - s1.uniform2iv(this.addr, e); -} -function Y_(s1, e) { - s1.uniform3iv(this.addr, e); -} -function Z_(s1, e) { - s1.uniform4iv(this.addr, e); -} -function J_(s1, e) { - s1.uniform1uiv(this.addr, e); -} -function $_(s1, e) { - s1.uniform2uiv(this.addr, e); -} -function K_(s1, e) { - s1.uniform3uiv(this.addr, e); -} -function Q_(s1, e) { - s1.uniform4uiv(this.addr, e); -} -function j_(s1, e, t) { - let n = this.cache, i = e.length, r = ya(t, i); - gt(n, r) || (s1.uniform1iv(this.addr, r), _t(n, r)); - for(let a = 0; a !== i; ++a)t.setTexture2D(e[a] || Td, r[a]); -} -function e0(s1, e, t) { - let n = this.cache, i = e.length, r = ya(t, i); - gt(n, r) || (s1.uniform1iv(this.addr, r), _t(n, r)); - for(let a = 0; a !== i; ++a)t.setTexture3D(e[a] || Ad, r[a]); -} -function t0(s1, e, t) { - let n = this.cache, i = e.length, r = ya(t, i); - gt(n, r) || (s1.uniform1iv(this.addr, r), _t(n, r)); - for(let a = 0; a !== i; ++a)t.setTextureCube(e[a] || Rd, r[a]); -} -function n0(s1, e, t) { - let n = this.cache, i = e.length, r = ya(t, i); - gt(n, r) || (s1.uniform1iv(this.addr, r), _t(n, r)); - for(let a = 0; a !== i; ++a)t.setTexture2DArray(e[a] || wd, r[a]); -} -function i0(s1) { - switch(s1){ - case 5126: - return B_; - case 35664: - return z_; - case 35665: - return V_; - case 35666: - return k_; - case 35674: - return H_; - case 35675: - return G_; - case 35676: - return W_; - case 5124: - case 35670: - return X_; - case 35667: - case 35671: - return q_; - case 35668: - case 35672: - return Y_; - case 35669: - case 35673: - return Z_; - case 5125: - return J_; - case 36294: - return $_; - case 36295: - return K_; - case 36296: - return Q_; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return j_; - case 35679: - case 36299: - case 36307: - return e0; - case 35680: - case 36300: - case 36308: - case 36293: - return t0; - case 36289: - case 36303: - case 36311: - case 36292: - return n0; +}; +wt.DEFAULT_MATERIAL_NAME = "__DEFAULT"; +var se = {}, xo = class extends Error { + constructor(t, e){ + super(t), this.response = e; + } +}, Jt = class extends wt { + constructor(t){ + super(t); + } + load(t, e, i, s) { + t === void 0 && (t = ""), this.path !== void 0 && (t = this.path + t), t = this.manager.resolveURL(t); + let n = we.get(t); + if (n !== void 0) return this.manager.itemStart(t), setTimeout(()=>{ + e && e(n), this.manager.itemEnd(t); + }, 0), n; + if (se[t] !== void 0) { + se[t].push({ + onLoad: e, + onProgress: i, + onError: s + }); + return; + } + se[t] = [], se[t].push({ + onLoad: e, + onProgress: i, + onError: s + }); + let r = new Request(t, { + headers: new Headers(this.requestHeader), + credentials: this.withCredentials ? "include" : "same-origin" + }), o = this.mimeType, a = this.responseType; + fetch(r).then((l)=>{ + if (l.status === 200 || l.status === 0) { + if (l.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || l.body === void 0 || l.body.getReader === void 0) return l; + let c = se[t], u = l.body.getReader(), d = l.headers.get("X-File-Size") || l.headers.get("Content-Length"), p = d ? parseInt(d) : 0, f = p !== 0, m = 0, y1 = new ReadableStream({ + start (g) { + x1(); + function x1() { + u.read().then(({ done: b , value: M })=>{ + if (b) g.close(); + else { + m += M.byteLength; + let _ = new ProgressEvent("progress", { + lengthComputable: f, + loaded: m, + total: p + }); + for(let v = 0, S = c.length; v < S; v++){ + let A = c[v]; + A.onProgress && A.onProgress(_); + } + g.enqueue(M), x1(); + } + }, (b)=>{ + g.error(b); + }); + } + } + }); + return new Response(y1); + } else throw new xo(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l); + }).then((l)=>{ + switch(a){ + case "arraybuffer": + return l.arrayBuffer(); + case "blob": + return l.blob(); + case "document": + return l.text().then((c)=>new DOMParser().parseFromString(c, o)); + case "json": + return l.json(); + default: + if (o === void 0) return l.text(); + { + let u = /charset="?([^;"\s]*)"?/i.exec(o), d = u && u[1] ? u[1].toLowerCase() : void 0, p = new TextDecoder(d); + return l.arrayBuffer().then((f)=>p.decode(f)); + } + } + }).then((l)=>{ + we.add(t, l); + let c = se[t]; + delete se[t]; + for(let u = 0, d = c.length; u < d; u++){ + let p = c[u]; + p.onLoad && p.onLoad(l); + } + }).catch((l)=>{ + let c = se[t]; + if (c === void 0) throw this.manager.itemError(t), l; + delete se[t]; + for(let u = 0, d = c.length; u < d; u++){ + let p = c[u]; + p.onError && p.onError(l); + } + this.manager.itemError(t); + }).finally(()=>{ + this.manager.itemEnd(t); + }), this.manager.itemStart(t); } -} -var vo = class { - constructor(e, t, n){ - this.id = e, this.addr = n, this.cache = [], this.setValue = F_(t.type); + setResponseType(t) { + return this.responseType = t, this; } -}, yo = class { - constructor(e, t, n){ - this.id = e, this.addr = n, this.cache = [], this.size = t.size, this.setValue = i0(t.type); + setMimeType(t) { + return this.mimeType = t, this; } -}, Mo = class { - constructor(e){ - this.id = e, this.seq = [], this.map = {}; +}, mh = class extends wt { + constructor(t){ + super(t); } - setValue(e, t, n) { - let i = this.seq; - for(let r = 0, a = i.length; r !== a; ++r){ - let o = i[r]; - o.setValue(e, t[o.id], n); - } + load(t, e, i, s) { + let n = this, r = new Jt(this.manager); + r.setPath(this.path), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(t, function(o) { + try { + e(n.parse(JSON.parse(o))); + } catch (a) { + s ? s(a) : console.error(a), n.manager.itemError(t); + } + }, i, s); } -}, Qa = /(\w+)(\])?(\[|\.)?/g; -function Mh(s1, e) { - s1.seq.push(e), s1.map[e.id] = e; -} -function s0(s1, e, t) { - let n = s1.name, i = n.length; - for(Qa.lastIndex = 0;;){ - let r = Qa.exec(n), a = Qa.lastIndex, o = r[1], c = r[2] === "]", l = r[3]; - if (c && (o = o | 0), l === void 0 || l === "[" && a + 2 === i) { - Mh(t, l === void 0 ? new vo(o, s1, e) : new yo(o, s1, e)); - break; - } else { - let u = t.map[o]; - u === void 0 && (u = new Mo(o), Mh(t, u)), t = u; + parse(t) { + let e = []; + for(let i = 0; i < t.length; i++){ + let s = wi.parse(t[i]); + e.push(s); } + return e; } -} -var qi = class { - constructor(e, t){ - this.seq = [], this.map = {}; - let n = e.getProgramParameter(t, e.ACTIVE_UNIFORMS); - for(let i = 0; i < n; ++i){ - let r = e.getActiveUniform(t, i), a = e.getUniformLocation(t, r.name); - s0(r, a, this); - } +}, yh = class extends wt { + constructor(t){ + super(t); } - setValue(e, t, n, i) { - let r = this.map[t]; - r !== void 0 && r.setValue(e, n, i); + load(t, e, i, s) { + let n = this, r = [], o = new Zi, a = new Jt(this.manager); + a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(n.withCredentials); + let l = 0; + function c(u) { + a.load(t[u], function(d) { + let p = n.parse(d, !0); + r[u] = { + width: p.width, + height: p.height, + format: p.format, + mipmaps: p.mipmaps + }, l += 1, l === 6 && (p.mipmapCount === 1 && (o.minFilter = Et), o.image = r, o.format = p.format, o.needsUpdate = !0, e && e(o)); + }, i, s); + } + if (Array.isArray(t)) for(let u = 0, d = t.length; u < d; ++u)c(u); + else a.load(t, function(u) { + let d = n.parse(u, !0); + if (d.isCubemap) { + let p = d.mipmaps.length / d.mipmapCount; + for(let f = 0; f < p; f++){ + r[f] = { + mipmaps: [] + }; + for(let m = 0; m < d.mipmapCount; m++)r[f].mipmaps.push(d.mipmaps[f * d.mipmapCount + m]), r[f].format = d.format, r[f].width = d.width, r[f].height = d.height; + } + o.image = r; + } else o.image.width = d.width, o.image.height = d.height, o.mipmaps = d.mipmaps; + d.mipmapCount === 1 && (o.minFilter = Et), o.format = d.format, o.needsUpdate = !0, e && e(o); + }, i, s); + return o; } - setOptional(e, t, n) { - let i = t[n]; - i !== void 0 && this.setValue(e, n, i); +}, Mi = class extends wt { + constructor(t){ + super(t); } - static upload(e, t, n, i) { - for(let r = 0, a = t.length; r !== a; ++r){ - let o = t[r], c = n[o.id]; - c.needsUpdate !== !1 && o.setValue(e, c.value, i); + load(t, e, i, s) { + this.path !== void 0 && (t = this.path + t), t = this.manager.resolveURL(t); + let n = this, r = we.get(t); + if (r !== void 0) return n.manager.itemStart(t), setTimeout(function() { + e && e(r), n.manager.itemEnd(t); + }, 0), r; + let o = Ys("img"); + function a() { + c(), we.add(t, this), e && e(this), n.manager.itemEnd(t); + } + function l(u) { + c(), s && s(u), n.manager.itemError(t), n.manager.itemEnd(t); } + function c() { + o.removeEventListener("load", a, !1), o.removeEventListener("error", l, !1); + } + return o.addEventListener("load", a, !1), o.addEventListener("error", l, !1), t.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), n.manager.itemStart(t), o.src = t, o; } - static seqWithValue(e, t) { - let n = []; - for(let i = 0, r = e.length; i !== r; ++i){ - let a = e[i]; - a.id in t && n.push(a); +}, gh = class extends wt { + constructor(t){ + super(t); + } + load(t, e, i, s) { + let n = new Xi; + n.colorSpace = Bt; + let r = new Mi(this.manager); + r.setCrossOrigin(this.crossOrigin), r.setPath(this.path); + let o = 0; + function a(l) { + r.load(t[l], function(c) { + n.images[l] = c, o++, o === 6 && (n.needsUpdate = !0, e && e(n)); + }, void 0, s); } + for(let l = 0; l < t.length; ++l)a(l); return n; } -}; -function Sh(s1, e, t) { - let n = s1.createShader(e); - return s1.shaderSource(n, t), s1.compileShader(n), n; -} -var r0 = 0; -function a0(s1, e) { - let t = s1.split(` -`), n = [], i = Math.max(e - 6, 0), r = Math.min(e + 6, t.length); - for(let a = i; a < r; a++){ - let o = a + 1; - n.push(`${o === e ? ">" : " "} ${o}: ${t[a]}`); - } - return n.join(` -`); -} -function o0(s1) { - let e = Qe.getPrimaries(Qe.workingColorSpace), t = Qe.getPrimaries(s1), n; - switch(e === t ? n = "" : e === kr && t === Vr ? n = "LinearDisplayP3ToLinearSRGB" : e === Vr && t === kr && (n = "LinearSRGBToLinearDisplayP3"), s1){ - case Mn: - case va: - return [ - n, - "LinearTransferOETF" - ]; - case vt: - case qc: - return [ - n, - "sRGBTransferOETF" - ]; - default: - return console.warn("THREE.WebGLProgram: Unsupported color space:", s1), [ - n, - "LinearTransferOETF" - ]; +}, xh = class extends wt { + constructor(t){ + super(t); } -} -function bh(s1, e, t) { - let n = s1.getShaderParameter(e, s1.COMPILE_STATUS), i = s1.getShaderInfoLog(e).trim(); - if (n && i === "") return ""; - let r = /ERROR: 0:(\d+)/.exec(i); - if (r) { - let a = parseInt(r[1]); - return t.toUpperCase() + ` - -` + i + ` - -` + a0(s1.getShaderSource(e), a); - } else return i; -} -function c0(s1, e) { - let t = o0(e); - return `vec4 ${s1}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`; -} -function l0(s1, e) { - let t; - switch(e){ - case df: - t = "Linear"; - break; - case ff: - t = "Reinhard"; - break; - case pf: - t = "OptimizedCineon"; - break; - case mf: - t = "ACESFilmic"; - break; - case gf: - t = "Custom"; - break; - default: - console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), t = "Linear"; + load(t, e, i, s) { + let n = this, r = new Lt, o = new Jt(this.manager); + return o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(n.withCredentials), o.load(t, function(a) { + let l; + try { + l = n.parse(a); + } catch (c) { + if (s !== void 0) s(c); + else { + console.error(c); + return; + } + } + l.image !== void 0 ? r.image = l.image : l.data !== void 0 && (r.image.width = l.width, r.image.height = l.height, r.image.data = l.data), r.wrapS = l.wrapS !== void 0 ? l.wrapS : Ht, r.wrapT = l.wrapT !== void 0 ? l.wrapT : Ht, r.magFilter = l.magFilter !== void 0 ? l.magFilter : Et, r.minFilter = l.minFilter !== void 0 ? l.minFilter : Et, r.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.colorSpace !== void 0 && (r.colorSpace = l.colorSpace), l.flipY !== void 0 && (r.flipY = l.flipY), l.format !== void 0 && (r.format = l.format), l.type !== void 0 && (r.type = l.type), l.mipmaps !== void 0 && (r.mipmaps = l.mipmaps, r.minFilter = vn), l.mipmapCount === 1 && (r.minFilter = Et), l.generateMipmaps !== void 0 && (r.generateMipmaps = l.generateMipmaps), r.needsUpdate = !0, e && e(r, l); + }, i, s), r; } - return "vec3 " + s1 + "( vec3 color ) { return " + t + "ToneMapping( color ); }"; -} -function h0(s1) { - return [ - s1.extensionDerivatives || s1.envMapCubeUVHeight || s1.bumpMap || s1.normalMapTangentSpace || s1.clearcoatNormalMap || s1.flatShading || s1.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "", - (s1.extensionFragDepth || s1.logarithmicDepthBuffer) && s1.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", - s1.extensionDrawBuffers && s1.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", - (s1.extensionShaderTextureLOD || s1.envMap || s1.transmission) && s1.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : "" - ].filter(vs).join(` -`); -} -function u0(s1) { - let e = []; - for(let t in s1){ - let n = s1[t]; - n !== !1 && e.push("#define " + t + " " + n); +}, bh = class extends wt { + constructor(t){ + super(t); } - return e.join(` -`); -} -function d0(s1, e) { - let t = {}, n = s1.getProgramParameter(e, s1.ACTIVE_ATTRIBUTES); - for(let i = 0; i < n; i++){ - let r = s1.getActiveAttrib(e, i), a = r.name, o = 1; - r.type === s1.FLOAT_MAT2 && (o = 2), r.type === s1.FLOAT_MAT3 && (o = 3), r.type === s1.FLOAT_MAT4 && (o = 4), t[a] = { - type: r.type, - location: s1.getAttribLocation(e, a), - locationSize: o - }; + load(t, e, i, s) { + let n = new lt, r = new Mi(this.manager); + return r.setCrossOrigin(this.crossOrigin), r.setPath(this.path), r.load(t, function(o) { + n.image = o, n.needsUpdate = !0, e !== void 0 && e(n); + }, i, s), n; } - return t; -} -function vs(s1) { - return s1 !== ""; -} -function Eh(s1, e) { - let t = e.numSpotLightShadows + e.numSpotLightMaps - e.numSpotLightShadowsWithMaps; - return s1.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 Th(s1, e) { - return s1.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection); -} -var f0 = /^[ \t]*#include +<([\w\d./]+)>/gm; -function So(s1) { - return s1.replace(f0, m0); -} -var p0 = new Map([ - [ - "encodings_fragment", - "colorspace_fragment" - ], - [ - "encodings_pars_fragment", - "colorspace_pars_fragment" - ], - [ - "output_fragment", - "opaque_fragment" - ] -]); -function m0(s1, e) { - let t = ke[e]; - if (t === void 0) { - let n = p0.get(e); - if (n !== void 0) t = ke[n], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', e, n); - else throw new Error("Can not resolve #include <" + e + ">"); +}, ce = class extends G { + constructor(t, e = 1){ + super(), this.isLight = !0, this.type = "Light", this.color = new P(t), this.intensity = e; } - return So(t); -} -var g0 = /#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 wh(s1) { - return s1.replace(g0, _0); -} -function _0(s1, e, t, n) { - let i = ""; - for(let r = parseInt(e); r < parseInt(t); r++)i += n.replace(/\[\s*i\s*\]/g, "[ " + r + " ]").replace(/UNROLLED_LOOP_INDEX/g, r); - return i; -} -function Ah(s1) { - let e = "precision " + s1.precision + ` float; -precision ` + s1.precision + " int;"; - return s1.precision === "highp" ? e += ` -#define HIGH_PRECISION` : s1.precision === "mediump" ? e += ` -#define MEDIUM_PRECISION` : s1.precision === "lowp" && (e += ` -#define LOW_PRECISION`), e; -} -function x0(s1) { - let e = "SHADOWMAP_TYPE_BASIC"; - return s1.shadowMapType === cd ? e = "SHADOWMAP_TYPE_PCF" : s1.shadowMapType === Gd ? e = "SHADOWMAP_TYPE_PCF_SOFT" : s1.shadowMapType === pn && (e = "SHADOWMAP_TYPE_VSM"), e; -} -function v0(s1) { - let e = "ENVMAP_TYPE_CUBE"; - if (s1.envMap) switch(s1.envMapMode){ - case zn: - case ci: - e = "ENVMAP_TYPE_CUBE"; - break; - case Vs: - e = "ENVMAP_TYPE_CUBE_UV"; - break; + dispose() {} + copy(t, e) { + return super.copy(t, e), this.color.copy(t.color), this.intensity = t.intensity, this; } - return e; -} -function y0(s1) { - let e = "ENVMAP_MODE_REFLECTION"; - if (s1.envMap) switch(s1.envMapMode){ - case ci: - e = "ENVMAP_MODE_REFRACTION"; - break; + toJSON(t) { + let e = super.toJSON(t); + return e.object.color = this.color.getHex(), e.object.intensity = this.intensity, this.groundColor !== void 0 && (e.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (e.object.distance = this.distance), this.angle !== void 0 && (e.object.angle = this.angle), this.decay !== void 0 && (e.object.decay = this.decay), this.penumbra !== void 0 && (e.object.penumbra = this.penumbra), this.shadow !== void 0 && (e.object.shadow = this.shadow.toJSON()), this.target !== void 0 && (e.object.target = this.target.uuid), e; } - return e; -} -function M0(s1) { - let e = "ENVMAP_BLENDING_NONE"; - if (s1.envMap) switch(s1.combine){ - case xa: - e = "ENVMAP_BLENDING_MULTIPLY"; - break; - case hf: - e = "ENVMAP_BLENDING_MIX"; - break; - case uf: - e = "ENVMAP_BLENDING_ADD"; - break; +}, bo = class extends ce { + constructor(t, e, i){ + super(t, i), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(G.DEFAULT_UP), this.updateMatrix(), this.groundColor = new P(e); } - return e; -} -function S0(s1) { - let e = s1.envMapCubeUVHeight; - if (e === null) return null; - let 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 b0(s1, e, t, n) { - let i = s1.getContext(), r = t.defines, a = t.vertexShader, o = t.fragmentShader, c = x0(t), l = v0(t), h = y0(t), u = M0(t), d = S0(t), f = t.isWebGL2 ? "" : h0(t), m = u0(r), _ = i.createProgram(), g, p, v = t.glslVersion ? "#version " + t.glslVersion + ` -` : ""; - t.isRawShaderMaterial ? (g = [ - "#define SHADER_TYPE " + t.shaderType, - "#define SHADER_NAME " + t.shaderName, - m - ].filter(vs).join(` -`), g.length > 0 && (g += ` -`), p = [ - f, - "#define SHADER_TYPE " + t.shaderType, - "#define SHADER_NAME " + t.shaderName, - m - ].filter(vs).join(` -`), p.length > 0 && (p += ` -`)) : (g = [ - Ah(t), - "#define SHADER_TYPE " + t.shaderType, - "#define SHADER_NAME " + t.shaderName, - m, - t.instancing ? "#define USE_INSTANCING" : "", - t.instancingColor ? "#define USE_INSTANCING_COLOR" : "", - t.useFog && t.fog ? "#define USE_FOG" : "", - t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", - t.map ? "#define USE_MAP" : "", - t.envMap ? "#define USE_ENVMAP" : "", - t.envMap ? "#define " + h : "", - t.lightMap ? "#define USE_LIGHTMAP" : "", - t.aoMap ? "#define USE_AOMAP" : "", - t.bumpMap ? "#define USE_BUMPMAP" : "", - t.normalMap ? "#define USE_NORMALMAP" : "", - t.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - t.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - t.displacementMap ? "#define USE_DISPLACEMENTMAP" : "", - t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - t.anisotropy ? "#define USE_ANISOTROPY" : "", - t.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - t.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - t.specularMap ? "#define USE_SPECULARMAP" : "", - t.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - t.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - t.metalnessMap ? "#define USE_METALNESSMAP" : "", - t.alphaMap ? "#define USE_ALPHAMAP" : "", - t.alphaHash ? "#define USE_ALPHAHASH" : "", - t.transmission ? "#define USE_TRANSMISSION" : "", - t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - t.thicknessMap ? "#define USE_THICKNESSMAP" : "", - t.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - t.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - t.mapUv ? "#define MAP_UV " + t.mapUv : "", - t.alphaMapUv ? "#define ALPHAMAP_UV " + t.alphaMapUv : "", - t.lightMapUv ? "#define LIGHTMAP_UV " + t.lightMapUv : "", - t.aoMapUv ? "#define AOMAP_UV " + t.aoMapUv : "", - t.emissiveMapUv ? "#define EMISSIVEMAP_UV " + t.emissiveMapUv : "", - t.bumpMapUv ? "#define BUMPMAP_UV " + t.bumpMapUv : "", - t.normalMapUv ? "#define NORMALMAP_UV " + t.normalMapUv : "", - t.displacementMapUv ? "#define DISPLACEMENTMAP_UV " + t.displacementMapUv : "", - t.metalnessMapUv ? "#define METALNESSMAP_UV " + t.metalnessMapUv : "", - t.roughnessMapUv ? "#define ROUGHNESSMAP_UV " + t.roughnessMapUv : "", - t.anisotropyMapUv ? "#define ANISOTROPYMAP_UV " + t.anisotropyMapUv : "", - t.clearcoatMapUv ? "#define CLEARCOATMAP_UV " + t.clearcoatMapUv : "", - t.clearcoatNormalMapUv ? "#define CLEARCOAT_NORMALMAP_UV " + t.clearcoatNormalMapUv : "", - t.clearcoatRoughnessMapUv ? "#define CLEARCOAT_ROUGHNESSMAP_UV " + t.clearcoatRoughnessMapUv : "", - t.iridescenceMapUv ? "#define IRIDESCENCEMAP_UV " + t.iridescenceMapUv : "", - t.iridescenceThicknessMapUv ? "#define IRIDESCENCE_THICKNESSMAP_UV " + t.iridescenceThicknessMapUv : "", - t.sheenColorMapUv ? "#define SHEEN_COLORMAP_UV " + t.sheenColorMapUv : "", - t.sheenRoughnessMapUv ? "#define SHEEN_ROUGHNESSMAP_UV " + t.sheenRoughnessMapUv : "", - t.specularMapUv ? "#define SPECULARMAP_UV " + t.specularMapUv : "", - t.specularColorMapUv ? "#define SPECULAR_COLORMAP_UV " + t.specularColorMapUv : "", - t.specularIntensityMapUv ? "#define SPECULAR_INTENSITYMAP_UV " + t.specularIntensityMapUv : "", - t.transmissionMapUv ? "#define TRANSMISSIONMAP_UV " + t.transmissionMapUv : "", - t.thicknessMapUv ? "#define THICKNESSMAP_UV " + t.thicknessMapUv : "", - t.vertexTangents && t.flatShading === !1 ? "#define USE_TANGENT" : "", - t.vertexColors ? "#define USE_COLOR" : "", - t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - t.vertexUv1s ? "#define USE_UV1" : "", - t.vertexUv2s ? "#define USE_UV2" : "", - t.vertexUv3s ? "#define USE_UV3" : "", - t.pointsUvs ? "#define USE_POINTS_UV" : "", - t.flatShading ? "#define FLAT_SHADED" : "", - t.skinning ? "#define USE_SKINNING" : "", - t.morphTargets ? "#define USE_MORPHTARGETS" : "", - t.morphNormals && t.flatShading === !1 ? "#define USE_MORPHNORMALS" : "", - t.morphColors && t.isWebGL2 ? "#define USE_MORPHCOLORS" : "", - t.morphTargetsCount > 0 && t.isWebGL2 ? "#define MORPHTARGETS_TEXTURE" : "", - t.morphTargetsCount > 0 && t.isWebGL2 ? "#define MORPHTARGETS_TEXTURE_STRIDE " + t.morphTextureStride : "", - t.morphTargetsCount > 0 && t.isWebGL2 ? "#define MORPHTARGETS_COUNT " + t.morphTargetsCount : "", - t.doubleSided ? "#define DOUBLE_SIDED" : "", - t.flipSided ? "#define FLIP_SIDED" : "", - t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - t.shadowMapEnabled ? "#define " + c : "", - t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", - t.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - t.useLegacyLights ? "#define LEGACY_LIGHTS" : "", - t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", - "uniform mat4 modelMatrix;", - "uniform mat4 modelViewMatrix;", - "uniform mat4 projectionMatrix;", - "uniform mat4 viewMatrix;", - "uniform mat3 normalMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - "#ifdef USE_INSTANCING", - " attribute mat4 instanceMatrix;", - "#endif", - "#ifdef USE_INSTANCING_COLOR", - " attribute vec3 instanceColor;", - "#endif", - "attribute vec3 position;", - "attribute vec3 normal;", - "attribute vec2 uv;", - "#ifdef USE_UV1", - " attribute vec2 uv1;", - "#endif", - "#ifdef USE_UV2", - " attribute vec2 uv2;", - "#endif", - "#ifdef USE_UV3", - " attribute vec2 uv3;", - "#endif", - "#ifdef USE_TANGENT", - " attribute vec4 tangent;", - "#endif", - "#if defined( USE_COLOR_ALPHA )", - " attribute vec4 color;", - "#elif defined( USE_COLOR )", - " attribute vec3 color;", - "#endif", - "#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )", - " attribute vec3 morphTarget0;", - " attribute vec3 morphTarget1;", - " attribute vec3 morphTarget2;", - " attribute vec3 morphTarget3;", - " #ifdef USE_MORPHNORMALS", - " attribute vec3 morphNormal0;", - " attribute vec3 morphNormal1;", - " attribute vec3 morphNormal2;", - " attribute vec3 morphNormal3;", - " #else", - " attribute vec3 morphTarget4;", - " attribute vec3 morphTarget5;", - " attribute vec3 morphTarget6;", - " attribute vec3 morphTarget7;", - " #endif", - "#endif", - "#ifdef USE_SKINNING", - " attribute vec4 skinIndex;", - " attribute vec4 skinWeight;", - "#endif", - ` -` - ].filter(vs).join(` -`), p = [ - f, - Ah(t), - "#define SHADER_TYPE " + t.shaderType, - "#define SHADER_NAME " + t.shaderName, - m, - t.useFog && t.fog ? "#define USE_FOG" : "", - t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", - t.map ? "#define USE_MAP" : "", - t.matcap ? "#define USE_MATCAP" : "", - t.envMap ? "#define USE_ENVMAP" : "", - t.envMap ? "#define " + l : "", - t.envMap ? "#define " + h : "", - t.envMap ? "#define " + u : "", - d ? "#define CUBEUV_TEXEL_WIDTH " + d.texelWidth : "", - d ? "#define CUBEUV_TEXEL_HEIGHT " + d.texelHeight : "", - d ? "#define CUBEUV_MAX_MIP " + d.maxMip + ".0" : "", - t.lightMap ? "#define USE_LIGHTMAP" : "", - t.aoMap ? "#define USE_AOMAP" : "", - t.bumpMap ? "#define USE_BUMPMAP" : "", - t.normalMap ? "#define USE_NORMALMAP" : "", - t.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - t.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - t.anisotropy ? "#define USE_ANISOTROPY" : "", - t.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - t.clearcoat ? "#define USE_CLEARCOAT" : "", - t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - t.iridescence ? "#define USE_IRIDESCENCE" : "", - t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - t.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - t.specularMap ? "#define USE_SPECULARMAP" : "", - t.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - t.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - t.metalnessMap ? "#define USE_METALNESSMAP" : "", - t.alphaMap ? "#define USE_ALPHAMAP" : "", - t.alphaTest ? "#define USE_ALPHATEST" : "", - t.alphaHash ? "#define USE_ALPHAHASH" : "", - t.sheen ? "#define USE_SHEEN" : "", - t.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - t.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - t.transmission ? "#define USE_TRANSMISSION" : "", - t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - t.thicknessMap ? "#define USE_THICKNESSMAP" : "", - t.vertexTangents && t.flatShading === !1 ? "#define USE_TANGENT" : "", - t.vertexColors || t.instancingColor ? "#define USE_COLOR" : "", - t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - t.vertexUv1s ? "#define USE_UV1" : "", - t.vertexUv2s ? "#define USE_UV2" : "", - t.vertexUv3s ? "#define USE_UV3" : "", - t.pointsUvs ? "#define USE_POINTS_UV" : "", - t.gradientMap ? "#define USE_GRADIENTMAP" : "", - t.flatShading ? "#define FLAT_SHADED" : "", - t.doubleSided ? "#define DOUBLE_SIDED" : "", - t.flipSided ? "#define FLIP_SIDED" : "", - t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - t.shadowMapEnabled ? "#define " + c : "", - t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", - t.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - t.useLegacyLights ? "#define LEGACY_LIGHTS" : "", - t.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", - t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", - "uniform mat4 viewMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - t.toneMapping !== Nn ? "#define TONE_MAPPING" : "", - t.toneMapping !== Nn ? ke.tonemapping_pars_fragment : "", - t.toneMapping !== Nn ? l0("toneMapping", t.toneMapping) : "", - t.dithering ? "#define DITHERING" : "", - t.opaque ? "#define OPAQUE" : "", - ke.colorspace_pars_fragment, - c0("linearToOutputTexel", t.outputColorSpace), - t.useDepthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", - ` -` - ].filter(vs).join(` -`)), a = So(a), a = Eh(a, t), a = Th(a, t), o = So(o), o = Eh(o, t), o = Th(o, t), a = wh(a), o = wh(o), t.isWebGL2 && t.isRawShaderMaterial !== !0 && (v = `#version 300 es -`, g = [ - "precision mediump sampler2DArray;", - "#define attribute in", - "#define varying out", - "#define texture2D texture" - ].join(` -`) + ` -` + g, p = [ - "#define varying in", - t.glslVersion === Ol ? "" : "layout(location = 0) out highp vec4 pc_fragColor;", - t.glslVersion === Ol ? "" : "#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(` -`) + ` -` + p); - let x1 = v + g + a, y1 = v + p + o, b = Sh(i, i.VERTEX_SHADER, x1), w = Sh(i, i.FRAGMENT_SHADER, y1); - if (i.attachShader(_, b), i.attachShader(_, w), t.index0AttributeName !== void 0 ? i.bindAttribLocation(_, 0, t.index0AttributeName) : t.morphTargets === !0 && i.bindAttribLocation(_, 0, "position"), i.linkProgram(_), s1.debug.checkShaderErrors) { - let M = i.getProgramInfoLog(_).trim(), T = i.getShaderInfoLog(b).trim(), O = i.getShaderInfoLog(w).trim(), Y = !0, $ = !0; - if (i.getProgramParameter(_, i.LINK_STATUS) === !1) if (Y = !1, typeof s1.debug.onShaderError == "function") s1.debug.onShaderError(i, _, b, w); - else { - let U = bh(i, b, "vertex"), z = bh(i, w, "fragment"); - console.error("THREE.WebGLProgram: Shader Error " + i.getError() + " - VALIDATE_STATUS " + i.getProgramParameter(_, i.VALIDATE_STATUS) + ` - -Program Info Log: ` + M + ` -` + U + ` -` + z); - } - else M !== "" ? console.warn("THREE.WebGLProgram: Program Info Log:", M) : (T === "" || O === "") && ($ = !1); - $ && (this.diagnostics = { - runnable: Y, - programLog: M, - vertexShader: { - log: T, - prefix: g - }, - fragmentShader: { - log: O, - prefix: p - } - }); + copy(t, e) { + return super.copy(t, e), this.groundColor.copy(t.groundColor), this; + } +}, hr = new D, wh = new w, Mh = new w, ts = class { + constructor(t){ + this.camera = t, this.intensity = 1, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new T(512, 512), this.map = null, this.mapPass = null, this.matrix = new D, this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new sn, this._frameExtents = new T(1, 1), this._viewportCount = 1, this._viewports = [ + new ot(0, 0, 1, 1) + ]; + } + getViewportCount() { + return this._viewportCount; + } + getFrustum() { + return this._frustum; + } + updateMatrices(t) { + let e = this.camera, i = this.matrix; + wh.setFromMatrixPosition(t.matrixWorld), e.position.copy(wh), Mh.setFromMatrixPosition(t.target.matrixWorld), e.lookAt(Mh), e.updateMatrixWorld(), hr.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse), this._frustum.setFromProjectionMatrix(hr), i.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), i.multiply(hr); + } + getViewport(t) { + return this._viewports[t]; } - i.deleteShader(b), i.deleteShader(w); - let R; - this.getUniforms = function() { - return R === void 0 && (R = new qi(i, _)), R; - }; - let I; - return this.getAttributes = function() { - return I === void 0 && (I = d0(i, _)), I; - }, this.destroy = function() { - n.releaseStatesOfProgram(this), i.deleteProgram(_), this.program = void 0; - }, this.type = t.shaderType, this.name = t.shaderName, this.id = r0++, this.cacheKey = e, this.usedTimes = 1, this.program = _, this.vertexShader = b, this.fragmentShader = w, this; -} -var E0 = 0, bo = class { + getFrameExtents() { + return this._frameExtents; + } + dispose() { + this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose(); + } + copy(t) { + return this.camera = t.camera.clone(), this.intensity = t.intensity, this.bias = t.bias, this.radius = t.radius, this.mapSize.copy(t.mapSize), this; + } + clone() { + return new this.constructor().copy(this); + } + toJSON() { + let t = {}; + return this.intensity !== 1 && (t.intensity = this.intensity), this.bias !== 0 && (t.bias = this.bias), this.normalBias !== 0 && (t.normalBias = this.normalBias), this.radius !== 1 && (t.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (t.mapSize = this.mapSize.toArray()), t.camera = this.camera.toJSON(!1).object, delete t.camera.matrix, t; + } +}, wo = class extends ts { constructor(){ - this.shaderCache = new Map, this.materialCache = new Map; + super(new vt(50, 1, .5, 500)), this.isSpotLightShadow = !0, this.focus = 1; } - update(e) { - let t = e.vertexShader, n = e.fragmentShader, i = this._getShaderStage(t), r = this._getShaderStage(n), a = this._getShaderCacheForMaterial(e); - return a.has(i) === !1 && (a.add(i), i.usedTimes++), a.has(r) === !1 && (a.add(r), r.usedTimes++), this; + updateMatrices(t) { + let e = this.camera, i = Ui * 2 * t.angle * this.focus, s = this.mapSize.width / this.mapSize.height, n = t.distance || e.far; + (i !== e.fov || s !== e.aspect || n !== e.far) && (e.fov = i, e.aspect = s, e.far = n, e.updateProjectionMatrix()), super.updateMatrices(t); } - remove(e) { - let t = this.materialCache.get(e); - for (let n of t)n.usedTimes--, n.usedTimes === 0 && this.shaderCache.delete(n.code); - return this.materialCache.delete(e), this; + copy(t) { + return super.copy(t), this.focus = t.focus, this; } - getVertexShaderID(e) { - return this._getShaderStage(e.vertexShader).id; +}, Mo = class extends ce { + constructor(t, e, i = 0, s = Math.PI / 3, n = 0, r = 2){ + super(t, e), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(G.DEFAULT_UP), this.updateMatrix(), this.target = new G, this.distance = i, this.angle = s, this.penumbra = n, this.decay = r, this.map = null, this.shadow = new wo; + } + get power() { + return this.intensity * Math.PI; } - getFragmentShaderID(e) { - return this._getShaderStage(e.fragmentShader).id; + set power(t) { + this.intensity = t / Math.PI; } dispose() { - this.shaderCache.clear(), this.materialCache.clear(); + this.shadow.dispose(); } - _getShaderCacheForMaterial(e) { - let t = this.materialCache, n = t.get(e); - return n === void 0 && (n = new Set, t.set(e, n)), n; + copy(t, e) { + return super.copy(t, e), this.distance = t.distance, this.angle = t.angle, this.penumbra = t.penumbra, this.decay = t.decay, this.target = t.target.clone(), this.shadow = t.shadow.clone(), this; } - _getShaderStage(e) { - let t = this.shaderCache, n = t.get(e); - return n === void 0 && (n = new Eo(e), t.set(e, n)), n; +}, _h = new D, Pi = new w, lr = new w, _o = class extends ts { + constructor(){ + super(new vt(90, 1, .5, 500)), this.isPointLightShadow = !0, this._frameExtents = new T(4, 2), this._viewportCount = 6, this._viewports = [ + new ot(2, 1, 1, 1), + new ot(0, 1, 1, 1), + new ot(3, 1, 1, 1), + new ot(1, 1, 1, 1), + new ot(3, 0, 1, 1), + new ot(1, 0, 1, 1) + ], this._cubeDirections = [ + new w(1, 0, 0), + new w(-1, 0, 0), + new w(0, 0, 1), + new w(0, 0, -1), + new w(0, 1, 0), + new w(0, -1, 0) + ], this._cubeUps = [ + new w(0, 1, 0), + new w(0, 1, 0), + new w(0, 1, 0), + new w(0, 1, 0), + new w(0, 0, 1), + new w(0, 0, -1) + ]; } -}, Eo = class { - constructor(e){ - this.id = E0++, this.code = e, this.usedTimes = 0; + updateMatrices(t, e = 0) { + let i = this.camera, s = this.matrix, n = t.distance || i.far; + n !== i.far && (i.far = n, i.updateProjectionMatrix()), Pi.setFromMatrixPosition(t.matrixWorld), i.position.copy(Pi), lr.copy(i.position), lr.add(this._cubeDirections[e]), i.up.copy(this._cubeUps[e]), i.lookAt(lr), i.updateMatrixWorld(), s.makeTranslation(-Pi.x, -Pi.y, -Pi.z), _h.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse), this._frustum.setFromProjectionMatrix(_h); } -}; -function T0(s1, e, t, n, i, r, a) { - let o = new Rs, c = new bo, l = [], h = i.isWebGL2, u = i.logarithmicDepthBuffer, d = i.vertexTextures, f = i.precision, m = { - MeshDepthMaterial: "depth", - MeshDistanceMaterial: "distanceRGBA", - MeshNormalMaterial: "normal", - MeshBasicMaterial: "basic", - MeshLambertMaterial: "lambert", - MeshPhongMaterial: "phong", - MeshToonMaterial: "toon", - MeshStandardMaterial: "physical", - MeshPhysicalMaterial: "physical", - MeshMatcapMaterial: "matcap", - LineBasicMaterial: "basic", - LineDashedMaterial: "dashed", - PointsMaterial: "points", - ShadowMaterial: "shadow", - SpriteMaterial: "sprite" - }; - function _(M) { - return M === 0 ? "uv" : `uv${M}`; - } - function g(M, T, O, Y, $) { - let U = Y.fog, z = $.geometry, q = M.isMeshStandardMaterial ? Y.environment : null, H = (M.isMeshStandardMaterial ? t : e).get(M.envMap || q), ne = H && H.mapping === Vs ? H.image.height : null, W = m[M.type]; - M.precision !== null && (f = i.getMaxPrecision(M.precision), f !== M.precision && console.warn("THREE.WebGLProgram.getParameters:", M.precision, "not supported, using", f, "instead.")); - let K = z.morphAttributes.position || z.morphAttributes.normal || z.morphAttributes.color, D = K !== void 0 ? K.length : 0, G = 0; - z.morphAttributes.position !== void 0 && (G = 1), z.morphAttributes.normal !== void 0 && (G = 2), z.morphAttributes.color !== void 0 && (G = 3); - let he, fe, _e, we; - if (W) { - let tt = nn[W]; - he = tt.vertexShader, fe = tt.fragmentShader; - } else he = M.vertexShader, fe = M.fragmentShader, c.update(M), _e = c.getVertexShaderID(M), we = c.getFragmentShaderID(M); - let Ee = s1.getRenderTarget(), Te = $.isInstancedMesh === !0, Ye = !!M.map, it = !!M.matcap, Ce = !!H, L = !!M.aoMap, oe = !!M.lightMap, X = !!M.bumpMap, ie = !!M.normalMap, J = !!M.displacementMap, Se = !!M.emissiveMap, me = !!M.metalnessMap, ye = !!M.roughnessMap, Ne = M.anisotropy > 0, qe = M.clearcoat > 0, rt = M.iridescence > 0, C = M.sheen > 0, S = M.transmission > 0, B = Ne && !!M.anisotropyMap, ee = qe && !!M.clearcoatMap, j = qe && !!M.clearcoatNormalMap, te = qe && !!M.clearcoatRoughnessMap, Me = rt && !!M.iridescenceMap, re = rt && !!M.iridescenceThicknessMap, de = C && !!M.sheenColorMap, Le = C && !!M.sheenRoughnessMap, Ze = !!M.specularMap, se = !!M.specularColorMap, $e = !!M.specularIntensityMap, Oe = S && !!M.transmissionMap, Ie = S && !!M.thicknessMap, Re = !!M.gradientMap, P = !!M.alphaMap, ce = M.alphaTest > 0, ae = !!M.alphaHash, ge = !!M.extensions, ue = !!z.attributes.uv1, Q = !!z.attributes.uv2, be = !!z.attributes.uv3, Fe = Nn; - return M.toneMapped && (Ee === null || Ee.isXRRenderTarget === !0) && (Fe = s1.toneMapping), { - isWebGL2: h, - shaderID: W, - shaderType: M.type, - shaderName: M.name, - vertexShader: he, - fragmentShader: fe, - defines: M.defines, - customVertexShaderID: _e, - customFragmentShaderID: we, - isRawShaderMaterial: M.isRawShaderMaterial === !0, - glslVersion: M.glslVersion, - precision: f, - instancing: Te, - instancingColor: Te && $.instanceColor !== null, - supportsVertexTextures: d, - outputColorSpace: Ee === null ? s1.outputColorSpace : Ee.isXRRenderTarget === !0 ? Ee.texture.colorSpace : Mn, - map: Ye, - matcap: it, - envMap: Ce, - envMapMode: Ce && H.mapping, - envMapCubeUVHeight: ne, - aoMap: L, - lightMap: oe, - bumpMap: X, - normalMap: ie, - displacementMap: d && J, - emissiveMap: Se, - normalMapObjectSpace: ie && M.normalMapType === Lf, - normalMapTangentSpace: ie && M.normalMapType === mi, - metalnessMap: me, - roughnessMap: ye, - anisotropy: Ne, - anisotropyMap: B, - clearcoat: qe, - clearcoatMap: ee, - clearcoatNormalMap: j, - clearcoatRoughnessMap: te, - iridescence: rt, - iridescenceMap: Me, - iridescenceThicknessMap: re, - sheen: C, - sheenColorMap: de, - sheenRoughnessMap: Le, - specularMap: Ze, - specularColorMap: se, - specularIntensityMap: $e, - transmission: S, - transmissionMap: Oe, - thicknessMap: Ie, - gradientMap: Re, - opaque: M.transparent === !1 && M.blending === Wi, - alphaMap: P, - alphaTest: ce, - alphaHash: ae, - combine: M.combine, - mapUv: Ye && _(M.map.channel), - aoMapUv: L && _(M.aoMap.channel), - lightMapUv: oe && _(M.lightMap.channel), - bumpMapUv: X && _(M.bumpMap.channel), - normalMapUv: ie && _(M.normalMap.channel), - displacementMapUv: J && _(M.displacementMap.channel), - emissiveMapUv: Se && _(M.emissiveMap.channel), - metalnessMapUv: me && _(M.metalnessMap.channel), - roughnessMapUv: ye && _(M.roughnessMap.channel), - anisotropyMapUv: B && _(M.anisotropyMap.channel), - clearcoatMapUv: ee && _(M.clearcoatMap.channel), - clearcoatNormalMapUv: j && _(M.clearcoatNormalMap.channel), - clearcoatRoughnessMapUv: te && _(M.clearcoatRoughnessMap.channel), - iridescenceMapUv: Me && _(M.iridescenceMap.channel), - iridescenceThicknessMapUv: re && _(M.iridescenceThicknessMap.channel), - sheenColorMapUv: de && _(M.sheenColorMap.channel), - sheenRoughnessMapUv: Le && _(M.sheenRoughnessMap.channel), - specularMapUv: Ze && _(M.specularMap.channel), - specularColorMapUv: se && _(M.specularColorMap.channel), - specularIntensityMapUv: $e && _(M.specularIntensityMap.channel), - transmissionMapUv: Oe && _(M.transmissionMap.channel), - thicknessMapUv: Ie && _(M.thicknessMap.channel), - alphaMapUv: P && _(M.alphaMap.channel), - vertexTangents: !!z.attributes.tangent && (ie || Ne), - vertexColors: M.vertexColors, - vertexAlphas: M.vertexColors === !0 && !!z.attributes.color && z.attributes.color.itemSize === 4, - vertexUv1s: ue, - vertexUv2s: Q, - vertexUv3s: be, - pointsUvs: $.isPoints === !0 && !!z.attributes.uv && (Ye || P), - fog: !!U, - useFog: M.fog === !0, - fogExp2: U && U.isFogExp2, - flatShading: M.flatShading === !0, - sizeAttenuation: M.sizeAttenuation === !0, - logarithmicDepthBuffer: u, - skinning: $.isSkinnedMesh === !0, - morphTargets: z.morphAttributes.position !== void 0, - morphNormals: z.morphAttributes.normal !== void 0, - morphColors: z.morphAttributes.color !== void 0, - morphTargetsCount: D, - morphTextureStride: G, - numDirLights: T.directional.length, - numPointLights: T.point.length, - numSpotLights: T.spot.length, - numSpotLightMaps: T.spotLightMap.length, - numRectAreaLights: T.rectArea.length, - numHemiLights: T.hemi.length, - numDirLightShadows: T.directionalShadowMap.length, - numPointLightShadows: T.pointShadowMap.length, - numSpotLightShadows: T.spotShadowMap.length, - numSpotLightShadowsWithMaps: T.numSpotLightShadowsWithMaps, - numLightProbes: T.numLightProbes, - numClippingPlanes: a.numPlanes, - numClipIntersection: a.numIntersection, - dithering: M.dithering, - shadowMapEnabled: s1.shadowMap.enabled && O.length > 0, - shadowMapType: s1.shadowMap.type, - toneMapping: Fe, - useLegacyLights: s1._useLegacyLights, - decodeVideoTexture: Ye && M.map.isVideoTexture === !0 && Qe.getTransfer(M.map.colorSpace) === nt, - premultipliedAlpha: M.premultipliedAlpha, - doubleSided: M.side === gn, - flipSided: M.side === Ft, - useDepthPacking: M.depthPacking >= 0, - depthPacking: M.depthPacking || 0, - index0AttributeName: M.index0AttributeName, - extensionDerivatives: ge && M.extensions.derivatives === !0, - extensionFragDepth: ge && M.extensions.fragDepth === !0, - extensionDrawBuffers: ge && M.extensions.drawBuffers === !0, - extensionShaderTextureLOD: ge && M.extensions.shaderTextureLOD === !0, - rendererExtensionFragDepth: h || n.has("EXT_frag_depth"), - rendererExtensionDrawBuffers: h || n.has("WEBGL_draw_buffers"), - rendererExtensionShaderTextureLod: h || n.has("EXT_shader_texture_lod"), - customProgramCacheKey: M.customProgramCacheKey() - }; +}, vo = class extends ce { + constructor(t, e, i = 0, s = 2){ + super(t, e), this.isPointLight = !0, this.type = "PointLight", this.distance = i, this.decay = s, this.shadow = new _o; } - function p(M) { - let T = []; - if (M.shaderID ? T.push(M.shaderID) : (T.push(M.customVertexShaderID), T.push(M.customFragmentShaderID)), M.defines !== void 0) for(let O in M.defines)T.push(O), T.push(M.defines[O]); - return M.isRawShaderMaterial === !1 && (v(T, M), x1(T, M), T.push(s1.outputColorSpace)), T.push(M.customProgramCacheKey), T.join(); - } - function v(M, T) { - M.push(T.precision), M.push(T.outputColorSpace), M.push(T.envMapMode), M.push(T.envMapCubeUVHeight), M.push(T.mapUv), M.push(T.alphaMapUv), M.push(T.lightMapUv), M.push(T.aoMapUv), M.push(T.bumpMapUv), M.push(T.normalMapUv), M.push(T.displacementMapUv), M.push(T.emissiveMapUv), M.push(T.metalnessMapUv), M.push(T.roughnessMapUv), M.push(T.anisotropyMapUv), M.push(T.clearcoatMapUv), M.push(T.clearcoatNormalMapUv), M.push(T.clearcoatRoughnessMapUv), M.push(T.iridescenceMapUv), M.push(T.iridescenceThicknessMapUv), M.push(T.sheenColorMapUv), M.push(T.sheenRoughnessMapUv), M.push(T.specularMapUv), M.push(T.specularColorMapUv), M.push(T.specularIntensityMapUv), M.push(T.transmissionMapUv), M.push(T.thicknessMapUv), M.push(T.combine), M.push(T.fogExp2), M.push(T.sizeAttenuation), M.push(T.morphTargetsCount), M.push(T.morphAttributeCount), M.push(T.numDirLights), M.push(T.numPointLights), M.push(T.numSpotLights), M.push(T.numSpotLightMaps), M.push(T.numHemiLights), M.push(T.numRectAreaLights), M.push(T.numDirLightShadows), M.push(T.numPointLightShadows), M.push(T.numSpotLightShadows), M.push(T.numSpotLightShadowsWithMaps), M.push(T.numLightProbes), M.push(T.shadowMapType), M.push(T.toneMapping), M.push(T.numClippingPlanes), M.push(T.numClipIntersection), M.push(T.depthPacking); - } - function x1(M, T) { - o.disableAll(), T.isWebGL2 && o.enable(0), T.supportsVertexTextures && o.enable(1), T.instancing && o.enable(2), T.instancingColor && o.enable(3), T.matcap && o.enable(4), T.envMap && o.enable(5), T.normalMapObjectSpace && o.enable(6), T.normalMapTangentSpace && o.enable(7), T.clearcoat && o.enable(8), T.iridescence && o.enable(9), T.alphaTest && o.enable(10), T.vertexColors && o.enable(11), T.vertexAlphas && o.enable(12), T.vertexUv1s && o.enable(13), T.vertexUv2s && o.enable(14), T.vertexUv3s && o.enable(15), T.vertexTangents && o.enable(16), T.anisotropy && o.enable(17), M.push(o.mask), o.disableAll(), T.fog && o.enable(0), T.useFog && o.enable(1), T.flatShading && o.enable(2), T.logarithmicDepthBuffer && o.enable(3), T.skinning && o.enable(4), T.morphTargets && o.enable(5), T.morphNormals && o.enable(6), T.morphColors && o.enable(7), T.premultipliedAlpha && o.enable(8), T.shadowMapEnabled && o.enable(9), T.useLegacyLights && o.enable(10), T.doubleSided && o.enable(11), T.flipSided && o.enable(12), T.useDepthPacking && o.enable(13), T.dithering && o.enable(14), T.transmission && o.enable(15), T.sheen && o.enable(16), T.opaque && o.enable(17), T.pointsUvs && o.enable(18), T.decodeVideoTexture && o.enable(19), M.push(o.mask); - } - function y1(M) { - let T = m[M.type], O; - if (T) { - let Y = nn[T]; - O = xp.clone(Y.uniforms); - } else O = M.uniforms; - return O; - } - function b(M, T) { - let O; - for(let Y = 0, $ = l.length; Y < $; Y++){ - let U = l[Y]; - if (U.cacheKey === T) { - O = U, ++O.usedTimes; - break; - } - } - return O === void 0 && (O = new b0(s1, T, M, r), l.push(O)), O; + get power() { + return this.intensity * 4 * Math.PI; + } + set power(t) { + this.intensity = t / (4 * Math.PI); + } + dispose() { + this.shadow.dispose(); + } + copy(t, e) { + return super.copy(t, e), this.distance = t.distance, this.decay = t.decay, this.shadow = t.shadow.clone(), this; + } +}, wn = class extends Gi { + constructor(t = -1, e = 1, i = 1, s = -1, n = .1, r = 2e3){ + super(), this.isOrthographicCamera = !0, this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = t, this.right = e, this.top = i, this.bottom = s, this.near = n, this.far = r, this.updateProjectionMatrix(); + } + copy(t, e) { + return super.copy(t, e), this.left = t.left, this.right = t.right, this.top = t.top, this.bottom = t.bottom, this.near = t.near, this.far = t.far, this.zoom = t.zoom, this.view = t.view === null ? null : Object.assign({}, t.view), this; + } + setViewOffset(t, e, i, s, n, 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 = t, this.view.fullHeight = e, this.view.offsetX = i, this.view.offsetY = s, this.view.width = n, this.view.height = r, this.updateProjectionMatrix(); } - function w(M) { - if (--M.usedTimes === 0) { - let T = l.indexOf(M); - l[T] = l[l.length - 1], l.pop(), M.destroy(); + clearViewOffset() { + this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); + } + updateProjectionMatrix() { + let t = (this.right - this.left) / (2 * this.zoom), e = (this.top - this.bottom) / (2 * this.zoom), i = (this.right + this.left) / 2, s = (this.top + this.bottom) / 2, n = i - t, r = i + t, o = s + e, a = s - e; + if (this.view !== null && this.view.enabled) { + let l = (this.right - this.left) / this.view.fullWidth / this.zoom, c = (this.top - this.bottom) / this.view.fullHeight / this.zoom; + n += l * this.view.offsetX, r = n + l * this.view.width, o -= c * this.view.offsetY, a = o - c * this.view.height; } + this.projectionMatrix.makeOrthographic(n, r, o, a, this.near, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } - function R(M) { - c.remove(M); + toJSON(t) { + let e = super.toJSON(t); + return e.object.zoom = this.zoom, e.object.left = this.left, e.object.right = this.right, e.object.top = this.top, e.object.bottom = this.bottom, e.object.near = this.near, e.object.far = this.far, this.view !== null && (e.object.view = Object.assign({}, this.view)), e; } - function I() { - c.dispose(); +}, Ao = class extends ts { + constructor(){ + super(new wn(-5, 5, 5, -5, .5, 500)), this.isDirectionalLightShadow = !0; } - return { - getParameters: g, - getProgramCacheKey: p, - getUniforms: y1, - acquireProgram: b, - releaseProgram: w, - releaseShaderCache: R, - programs: l, - dispose: I - }; -} -function w0() { - let s1 = new WeakMap; - function e(r) { - let a = s1.get(r); - return a === void 0 && (a = {}, s1.set(r, a)), a; +}, So = class extends ce { + constructor(t, e){ + super(t, e), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(G.DEFAULT_UP), this.updateMatrix(), this.target = new G, this.shadow = new Ao; } - function t(r) { - s1.delete(r); + dispose() { + this.shadow.dispose(); } - function n(r, a, o) { - s1.get(r)[a] = o; + copy(t) { + return super.copy(t), this.target = t.target.clone(), this.shadow = t.shadow.clone(), this; } - function i() { - s1 = new WeakMap; +}, To = class extends ce { + constructor(t, e){ + super(t, e), this.isAmbientLight = !0, this.type = "AmbientLight"; } - return { - get: e, - remove: t, - update: n, - dispose: i - }; -} -function A0(s1, e) { - return s1.groupOrder !== e.groupOrder ? s1.groupOrder - e.groupOrder : s1.renderOrder !== e.renderOrder ? s1.renderOrder - e.renderOrder : s1.material.id !== e.material.id ? s1.material.id - e.material.id : s1.z !== e.z ? s1.z - e.z : s1.id - e.id; -} -function Rh(s1, e) { - return s1.groupOrder !== e.groupOrder ? s1.groupOrder - e.groupOrder : s1.renderOrder !== e.renderOrder ? s1.renderOrder - e.renderOrder : s1.z !== e.z ? e.z - s1.z : s1.id - e.id; -} -function Ch() { - let s1 = [], e = 0, t = [], n = [], i = []; - function r() { - e = 0, t.length = 0, n.length = 0, i.length = 0; - } - function a(u, d, f, m, _, g) { - let p = s1[e]; - return p === void 0 ? (p = { - id: u.id, - object: u, - geometry: d, - material: f, - groupOrder: m, - renderOrder: u.renderOrder, - z: _, - group: g - }, s1[e] = p) : (p.id = u.id, p.object = u, p.geometry = d, p.material = f, p.groupOrder = m, p.renderOrder = u.renderOrder, p.z = _, p.group = g), e++, p; - } - function o(u, d, f, m, _, g) { - let p = a(u, d, f, m, _, g); - f.transmission > 0 ? n.push(p) : f.transparent === !0 ? i.push(p) : t.push(p); - } - function c(u, d, f, m, _, g) { - let p = a(u, d, f, m, _, g); - f.transmission > 0 ? n.unshift(p) : f.transparent === !0 ? i.unshift(p) : t.unshift(p); - } - function l(u, d) { - t.length > 1 && t.sort(u || A0), n.length > 1 && n.sort(d || Rh), i.length > 1 && i.sort(d || Rh); +}, Io = class extends ce { + constructor(t, e, i = 10, s = 10){ + super(t, e), this.isRectAreaLight = !0, this.type = "RectAreaLight", this.width = i, this.height = s; } - function h() { - for(let u = e, d = s1.length; u < d; u++){ - let f = s1[u]; - if (f.id === null) break; - f.id = null, f.object = null, f.geometry = null, f.material = null, f.group = null; - } + get power() { + return this.intensity * this.width * this.height * Math.PI; } - return { - opaque: t, - transmissive: n, - transparent: i, - init: r, - push: o, - unshift: c, - finish: h, - sort: l - }; -} -function R0() { - let s1 = new WeakMap; - function e(n, i) { - let r = s1.get(n), a; - return r === void 0 ? (a = new Ch, s1.set(n, [ - a - ])) : i >= r.length ? (a = new Ch, r.push(a)) : a = r[i], a; + set power(t) { + this.intensity = t / (this.width * this.height * Math.PI); } - function t() { - s1 = new WeakMap; + copy(t) { + return super.copy(t), this.width = t.width, this.height = t.height, this; } - return { - get: e, - dispose: t - }; -} -function C0() { - let s1 = {}; - return { - get: function(e) { - if (s1[e.id] !== void 0) return s1[e.id]; - let t; - switch(e.type){ - case "DirectionalLight": - t = { - direction: new A, - color: new pe - }; - break; - case "SpotLight": - t = { - position: new A, - direction: new A, - color: new pe, - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0 - }; + toJSON(t) { + let e = super.toJSON(t); + return e.object.width = this.width, e.object.height = this.height, e; + } +}, Co = class { + constructor(){ + this.isSphericalHarmonics3 = !0, this.coefficients = []; + for(let t = 0; t < 9; t++)this.coefficients.push(new w); + } + set(t) { + for(let e = 0; e < 9; e++)this.coefficients[e].copy(t[e]); + return this; + } + zero() { + for(let t = 0; t < 9; t++)this.coefficients[t].set(0, 0, 0); + return this; + } + getAt(t, e) { + let i = t.x, s = t.y, n = t.z, r = this.coefficients; + return e.copy(r[0]).multiplyScalar(.282095), e.addScaledVector(r[1], .488603 * s), e.addScaledVector(r[2], .488603 * n), e.addScaledVector(r[3], .488603 * i), e.addScaledVector(r[4], 1.092548 * (i * s)), e.addScaledVector(r[5], 1.092548 * (s * n)), e.addScaledVector(r[6], .315392 * (3 * n * n - 1)), e.addScaledVector(r[7], 1.092548 * (i * n)), e.addScaledVector(r[8], .546274 * (i * i - s * s)), e; + } + getIrradianceAt(t, e) { + let i = t.x, s = t.y, n = t.z, r = this.coefficients; + return e.copy(r[0]).multiplyScalar(.886227), e.addScaledVector(r[1], 2 * .511664 * s), e.addScaledVector(r[2], 2 * .511664 * n), e.addScaledVector(r[3], 2 * .511664 * i), e.addScaledVector(r[4], 2 * .429043 * i * s), e.addScaledVector(r[5], 2 * .429043 * s * n), e.addScaledVector(r[6], .743125 * n * n - .247708), e.addScaledVector(r[7], 2 * .429043 * i * n), e.addScaledVector(r[8], .429043 * (i * i - s * s)), e; + } + add(t) { + for(let e = 0; e < 9; e++)this.coefficients[e].add(t.coefficients[e]); + return this; + } + addScaledSH(t, e) { + for(let i = 0; i < 9; i++)this.coefficients[i].addScaledVector(t.coefficients[i], e); + return this; + } + scale(t) { + for(let e = 0; e < 9; e++)this.coefficients[e].multiplyScalar(t); + return this; + } + lerp(t, e) { + for(let i = 0; i < 9; i++)this.coefficients[i].lerp(t.coefficients[i], e); + return this; + } + equals(t) { + for(let e = 0; e < 9; e++)if (!this.coefficients[e].equals(t.coefficients[e])) return !1; + return !0; + } + copy(t) { + return this.set(t.coefficients); + } + clone() { + return new this.constructor().copy(this); + } + fromArray(t, e = 0) { + let i = this.coefficients; + for(let s = 0; s < 9; s++)i[s].fromArray(t, e + s * 3); + return this; + } + toArray(t = [], e = 0) { + let i = this.coefficients; + for(let s = 0; s < 9; s++)i[s].toArray(t, e + s * 3); + return t; + } + static getBasisAt(t, e) { + let i = t.x, s = t.y, n = t.z; + e[0] = .282095, e[1] = .488603 * s, e[2] = .488603 * n, e[3] = .488603 * i, e[4] = 1.092548 * i * s, e[5] = 1.092548 * s * n, e[6] = .315392 * (3 * n * n - 1), e[7] = 1.092548 * i * n, e[8] = .546274 * (i * i - s * s); + } +}, zo = class extends ce { + constructor(t = new Co, e = 1){ + super(void 0, e), this.isLightProbe = !0, this.sh = t; + } + copy(t) { + return super.copy(t), this.sh.copy(t.sh), this; + } + fromJSON(t) { + return this.intensity = t.intensity, this.sh.fromArray(t.sh), this; + } + toJSON(t) { + let e = super.toJSON(t); + return e.object.sh = this.sh.toArray(), e; + } +}, Fo = class h extends wt { + constructor(t){ + super(t), this.textures = {}; + } + load(t, e, i, s) { + let n = this, r = new Jt(n.manager); + r.setPath(n.path), r.setRequestHeader(n.requestHeader), r.setWithCredentials(n.withCredentials), r.load(t, function(o) { + try { + e(n.parse(JSON.parse(o))); + } catch (a) { + s ? s(a) : console.error(a), n.manager.itemError(t); + } + }, i, s); + } + parse(t) { + let e = this.textures; + function i(n) { + return e[n] === void 0 && console.warn("THREE.MaterialLoader: Undefined texture", n), e[n]; + } + let s = this.createMaterialFromType(t.type); + if (t.uuid !== void 0 && (s.uuid = t.uuid), t.name !== void 0 && (s.name = t.name), t.color !== void 0 && s.color !== void 0 && s.color.setHex(t.color), t.roughness !== void 0 && (s.roughness = t.roughness), t.metalness !== void 0 && (s.metalness = t.metalness), t.sheen !== void 0 && (s.sheen = t.sheen), t.sheenColor !== void 0 && (s.sheenColor = new P().setHex(t.sheenColor)), t.sheenRoughness !== void 0 && (s.sheenRoughness = t.sheenRoughness), t.emissive !== void 0 && s.emissive !== void 0 && s.emissive.setHex(t.emissive), t.specular !== void 0 && s.specular !== void 0 && s.specular.setHex(t.specular), t.specularIntensity !== void 0 && (s.specularIntensity = t.specularIntensity), t.specularColor !== void 0 && s.specularColor !== void 0 && s.specularColor.setHex(t.specularColor), t.shininess !== void 0 && (s.shininess = t.shininess), t.clearcoat !== void 0 && (s.clearcoat = t.clearcoat), t.clearcoatRoughness !== void 0 && (s.clearcoatRoughness = t.clearcoatRoughness), t.dispersion !== void 0 && (s.dispersion = t.dispersion), t.iridescence !== void 0 && (s.iridescence = t.iridescence), t.iridescenceIOR !== void 0 && (s.iridescenceIOR = t.iridescenceIOR), t.iridescenceThicknessRange !== void 0 && (s.iridescenceThicknessRange = t.iridescenceThicknessRange), t.transmission !== void 0 && (s.transmission = t.transmission), t.thickness !== void 0 && (s.thickness = t.thickness), t.attenuationDistance !== void 0 && (s.attenuationDistance = t.attenuationDistance), t.attenuationColor !== void 0 && s.attenuationColor !== void 0 && s.attenuationColor.setHex(t.attenuationColor), t.anisotropy !== void 0 && (s.anisotropy = t.anisotropy), t.anisotropyRotation !== void 0 && (s.anisotropyRotation = t.anisotropyRotation), t.fog !== void 0 && (s.fog = t.fog), t.flatShading !== void 0 && (s.flatShading = t.flatShading), t.blending !== void 0 && (s.blending = t.blending), t.combine !== void 0 && (s.combine = t.combine), t.side !== void 0 && (s.side = t.side), t.shadowSide !== void 0 && (s.shadowSide = t.shadowSide), t.opacity !== void 0 && (s.opacity = t.opacity), t.transparent !== void 0 && (s.transparent = t.transparent), t.alphaTest !== void 0 && (s.alphaTest = t.alphaTest), t.alphaHash !== void 0 && (s.alphaHash = t.alphaHash), t.depthFunc !== void 0 && (s.depthFunc = t.depthFunc), t.depthTest !== void 0 && (s.depthTest = t.depthTest), t.depthWrite !== void 0 && (s.depthWrite = t.depthWrite), t.colorWrite !== void 0 && (s.colorWrite = t.colorWrite), t.blendSrc !== void 0 && (s.blendSrc = t.blendSrc), t.blendDst !== void 0 && (s.blendDst = t.blendDst), t.blendEquation !== void 0 && (s.blendEquation = t.blendEquation), t.blendSrcAlpha !== void 0 && (s.blendSrcAlpha = t.blendSrcAlpha), t.blendDstAlpha !== void 0 && (s.blendDstAlpha = t.blendDstAlpha), t.blendEquationAlpha !== void 0 && (s.blendEquationAlpha = t.blendEquationAlpha), t.blendColor !== void 0 && s.blendColor !== void 0 && s.blendColor.setHex(t.blendColor), t.blendAlpha !== void 0 && (s.blendAlpha = t.blendAlpha), t.stencilWriteMask !== void 0 && (s.stencilWriteMask = t.stencilWriteMask), t.stencilFunc !== void 0 && (s.stencilFunc = t.stencilFunc), t.stencilRef !== void 0 && (s.stencilRef = t.stencilRef), t.stencilFuncMask !== void 0 && (s.stencilFuncMask = t.stencilFuncMask), t.stencilFail !== void 0 && (s.stencilFail = t.stencilFail), t.stencilZFail !== void 0 && (s.stencilZFail = t.stencilZFail), t.stencilZPass !== void 0 && (s.stencilZPass = t.stencilZPass), t.stencilWrite !== void 0 && (s.stencilWrite = t.stencilWrite), t.wireframe !== void 0 && (s.wireframe = t.wireframe), t.wireframeLinewidth !== void 0 && (s.wireframeLinewidth = t.wireframeLinewidth), t.wireframeLinecap !== void 0 && (s.wireframeLinecap = t.wireframeLinecap), t.wireframeLinejoin !== void 0 && (s.wireframeLinejoin = t.wireframeLinejoin), t.rotation !== void 0 && (s.rotation = t.rotation), t.linewidth !== void 0 && (s.linewidth = t.linewidth), t.dashSize !== void 0 && (s.dashSize = t.dashSize), t.gapSize !== void 0 && (s.gapSize = t.gapSize), t.scale !== void 0 && (s.scale = t.scale), t.polygonOffset !== void 0 && (s.polygonOffset = t.polygonOffset), t.polygonOffsetFactor !== void 0 && (s.polygonOffsetFactor = t.polygonOffsetFactor), t.polygonOffsetUnits !== void 0 && (s.polygonOffsetUnits = t.polygonOffsetUnits), t.dithering !== void 0 && (s.dithering = t.dithering), t.alphaToCoverage !== void 0 && (s.alphaToCoverage = t.alphaToCoverage), t.premultipliedAlpha !== void 0 && (s.premultipliedAlpha = t.premultipliedAlpha), t.forceSinglePass !== void 0 && (s.forceSinglePass = t.forceSinglePass), t.visible !== void 0 && (s.visible = t.visible), t.toneMapped !== void 0 && (s.toneMapped = t.toneMapped), t.userData !== void 0 && (s.userData = t.userData), t.vertexColors !== void 0 && (typeof t.vertexColors == "number" ? s.vertexColors = t.vertexColors > 0 : s.vertexColors = t.vertexColors), t.uniforms !== void 0) for(let n in t.uniforms){ + let r = t.uniforms[n]; + switch(s.uniforms[n] = {}, r.type){ + case "t": + s.uniforms[n].value = i(r.value); break; - case "PointLight": - t = { - position: new A, - color: new pe, - distance: 0, - decay: 0 - }; + case "c": + s.uniforms[n].value = new P().setHex(r.value); break; - case "HemisphereLight": - t = { - direction: new A, - skyColor: new pe, - groundColor: new pe - }; + case "v2": + s.uniforms[n].value = new T().fromArray(r.value); break; - case "RectAreaLight": - t = { - color: new pe, - position: new A, - halfWidth: new A, - halfHeight: new A - }; + case "v3": + s.uniforms[n].value = new w().fromArray(r.value); break; - } - return s1[e.id] = t, t; - } - }; -} -function P0() { - let s1 = {}; - return { - get: function(e) { - if (s1[e.id] !== void 0) return s1[e.id]; - let t; - switch(e.type){ - case "DirectionalLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Z - }; + case "v4": + s.uniforms[n].value = new ot().fromArray(r.value); break; - case "SpotLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Z - }; + case "m3": + s.uniforms[n].value = new Gt().fromArray(r.value); break; - case "PointLight": - t = { - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Z, - shadowCameraNear: 1, - shadowCameraFar: 1e3 - }; + case "m4": + s.uniforms[n].value = new D().fromArray(r.value); break; + default: + s.uniforms[n].value = r.value; } - return s1[e.id] = t, t; } - }; -} -var L0 = 0; -function I0(s1, e) { - return (e.castShadow ? 2 : 0) - (s1.castShadow ? 2 : 0) + (e.map ? 1 : 0) - (s1.map ? 1 : 0); -} -function U0(s1, e) { - let t = new C0, n = P0(), i = { - version: 0, - hash: { - directionalLength: -1, - pointLength: -1, - spotLength: -1, - rectAreaLength: -1, - hemiLength: -1, - numDirectionalShadows: -1, - numPointShadows: -1, - numSpotShadows: -1, - numSpotMaps: -1, - numLightProbes: -1 - }, - ambient: [ - 0, - 0, - 0 - ], - probe: [], - directional: [], - directionalShadow: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotLightMap: [], - spotShadow: [], - spotShadowMap: [], - spotLightMatrix: [], - rectArea: [], - rectAreaLTC1: null, - rectAreaLTC2: null, - point: [], - pointShadow: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - numSpotLightShadowsWithMaps: 0, - numLightProbes: 0 - }; - for(let h = 0; h < 9; h++)i.probe.push(new A); - let r = new A, a = new ze, o = new ze; - function c(h, u) { - let d = 0, f = 0, m = 0; - for(let Y = 0; Y < 9; Y++)i.probe[Y].set(0, 0, 0); - let _ = 0, g = 0, p = 0, v = 0, x1 = 0, y1 = 0, b = 0, w = 0, R = 0, I = 0, M = 0; - h.sort(I0); - let T = u === !0 ? Math.PI : 1; - for(let Y = 0, $ = h.length; Y < $; Y++){ - let U = h[Y], z = U.color, q = U.intensity, H = U.distance, ne = U.shadow && U.shadow.map ? U.shadow.map.texture : null; - if (U.isAmbientLight) d += z.r * q * T, f += z.g * q * T, m += z.b * q * T; - else if (U.isLightProbe) { - for(let W = 0; W < 9; W++)i.probe[W].addScaledVector(U.sh.coefficients[W], q); - M++; - } else if (U.isDirectionalLight) { - let W = t.get(U); - if (W.color.copy(U.color).multiplyScalar(U.intensity * T), U.castShadow) { - let K = U.shadow, D = n.get(U); - D.shadowBias = K.bias, D.shadowNormalBias = K.normalBias, D.shadowRadius = K.radius, D.shadowMapSize = K.mapSize, i.directionalShadow[_] = D, i.directionalShadowMap[_] = ne, i.directionalShadowMatrix[_] = U.shadow.matrix, y1++; - } - i.directional[_] = W, _++; - } else if (U.isSpotLight) { - let W = t.get(U); - W.position.setFromMatrixPosition(U.matrixWorld), W.color.copy(z).multiplyScalar(q * T), W.distance = H, W.coneCos = Math.cos(U.angle), W.penumbraCos = Math.cos(U.angle * (1 - U.penumbra)), W.decay = U.decay, i.spot[p] = W; - let K = U.shadow; - if (U.map && (i.spotLightMap[R] = U.map, R++, K.updateMatrices(U), U.castShadow && I++), i.spotLightMatrix[p] = K.matrix, U.castShadow) { - let D = n.get(U); - D.shadowBias = K.bias, D.shadowNormalBias = K.normalBias, D.shadowRadius = K.radius, D.shadowMapSize = K.mapSize, i.spotShadow[p] = D, i.spotShadowMap[p] = ne, w++; - } - p++; - } else if (U.isRectAreaLight) { - let W = t.get(U); - W.color.copy(z).multiplyScalar(q), W.halfWidth.set(U.width * .5, 0, 0), W.halfHeight.set(0, U.height * .5, 0), i.rectArea[v] = W, v++; - } else if (U.isPointLight) { - let W = t.get(U); - if (W.color.copy(U.color).multiplyScalar(U.intensity * T), W.distance = U.distance, W.decay = U.decay, U.castShadow) { - let K = U.shadow, D = n.get(U); - D.shadowBias = K.bias, D.shadowNormalBias = K.normalBias, D.shadowRadius = K.radius, D.shadowMapSize = K.mapSize, D.shadowCameraNear = K.camera.near, D.shadowCameraFar = K.camera.far, i.pointShadow[g] = D, i.pointShadowMap[g] = ne, i.pointShadowMatrix[g] = U.shadow.matrix, b++; - } - i.point[g] = W, g++; - } else if (U.isHemisphereLight) { - let W = t.get(U); - W.skyColor.copy(U.color).multiplyScalar(q * T), W.groundColor.copy(U.groundColor).multiplyScalar(q * T), i.hemi[x1] = W, x1++; - } - } - v > 0 && (e.isWebGL2 || s1.has("OES_texture_float_linear") === !0 ? (i.rectAreaLTC1 = le.LTC_FLOAT_1, i.rectAreaLTC2 = le.LTC_FLOAT_2) : s1.has("OES_texture_half_float_linear") === !0 ? (i.rectAreaLTC1 = le.LTC_HALF_1, i.rectAreaLTC2 = le.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), i.ambient[0] = d, i.ambient[1] = f, i.ambient[2] = m; - let O = i.hash; - (O.directionalLength !== _ || O.pointLength !== g || O.spotLength !== p || O.rectAreaLength !== v || O.hemiLength !== x1 || O.numDirectionalShadows !== y1 || O.numPointShadows !== b || O.numSpotShadows !== w || O.numSpotMaps !== R || O.numLightProbes !== M) && (i.directional.length = _, i.spot.length = p, i.rectArea.length = v, i.point.length = g, i.hemi.length = x1, i.directionalShadow.length = y1, i.directionalShadowMap.length = y1, i.pointShadow.length = b, i.pointShadowMap.length = b, i.spotShadow.length = w, i.spotShadowMap.length = w, i.directionalShadowMatrix.length = y1, i.pointShadowMatrix.length = b, i.spotLightMatrix.length = w + R - I, i.spotLightMap.length = R, i.numSpotLightShadowsWithMaps = I, i.numLightProbes = M, O.directionalLength = _, O.pointLength = g, O.spotLength = p, O.rectAreaLength = v, O.hemiLength = x1, O.numDirectionalShadows = y1, O.numPointShadows = b, O.numSpotShadows = w, O.numSpotMaps = R, O.numLightProbes = M, i.version = L0++); - } - function l(h, u) { - let d = 0, f = 0, m = 0, _ = 0, g = 0, p = u.matrixWorldInverse; - for(let v = 0, x1 = h.length; v < x1; v++){ - let y1 = h[v]; - if (y1.isDirectionalLight) { - let b = i.directional[d]; - b.direction.setFromMatrixPosition(y1.matrixWorld), r.setFromMatrixPosition(y1.target.matrixWorld), b.direction.sub(r), b.direction.transformDirection(p), d++; - } else if (y1.isSpotLight) { - let b = i.spot[m]; - b.position.setFromMatrixPosition(y1.matrixWorld), b.position.applyMatrix4(p), b.direction.setFromMatrixPosition(y1.matrixWorld), r.setFromMatrixPosition(y1.target.matrixWorld), b.direction.sub(r), b.direction.transformDirection(p), m++; - } else if (y1.isRectAreaLight) { - let b = i.rectArea[_]; - b.position.setFromMatrixPosition(y1.matrixWorld), b.position.applyMatrix4(p), o.identity(), a.copy(y1.matrixWorld), a.premultiply(p), o.extractRotation(a), b.halfWidth.set(y1.width * .5, 0, 0), b.halfHeight.set(0, y1.height * .5, 0), b.halfWidth.applyMatrix4(o), b.halfHeight.applyMatrix4(o), _++; - } else if (y1.isPointLight) { - let b = i.point[f]; - b.position.setFromMatrixPosition(y1.matrixWorld), b.position.applyMatrix4(p), f++; - } else if (y1.isHemisphereLight) { - let b = i.hemi[g]; - b.direction.setFromMatrixPosition(y1.matrixWorld), b.direction.transformDirection(p), g++; - } + if (t.defines !== void 0 && (s.defines = t.defines), t.vertexShader !== void 0 && (s.vertexShader = t.vertexShader), t.fragmentShader !== void 0 && (s.fragmentShader = t.fragmentShader), t.glslVersion !== void 0 && (s.glslVersion = t.glslVersion), t.extensions !== void 0) for(let n in t.extensions)s.extensions[n] = t.extensions[n]; + if (t.lights !== void 0 && (s.lights = t.lights), t.clipping !== void 0 && (s.clipping = t.clipping), t.size !== void 0 && (s.size = t.size), t.sizeAttenuation !== void 0 && (s.sizeAttenuation = t.sizeAttenuation), t.map !== void 0 && (s.map = i(t.map)), t.matcap !== void 0 && (s.matcap = i(t.matcap)), t.alphaMap !== void 0 && (s.alphaMap = i(t.alphaMap)), t.bumpMap !== void 0 && (s.bumpMap = i(t.bumpMap)), t.bumpScale !== void 0 && (s.bumpScale = t.bumpScale), t.normalMap !== void 0 && (s.normalMap = i(t.normalMap)), t.normalMapType !== void 0 && (s.normalMapType = t.normalMapType), t.normalScale !== void 0) { + let n = t.normalScale; + Array.isArray(n) === !1 && (n = [ + n, + n + ]), s.normalScale = new T().fromArray(n); } + return t.displacementMap !== void 0 && (s.displacementMap = i(t.displacementMap)), t.displacementScale !== void 0 && (s.displacementScale = t.displacementScale), t.displacementBias !== void 0 && (s.displacementBias = t.displacementBias), t.roughnessMap !== void 0 && (s.roughnessMap = i(t.roughnessMap)), t.metalnessMap !== void 0 && (s.metalnessMap = i(t.metalnessMap)), t.emissiveMap !== void 0 && (s.emissiveMap = i(t.emissiveMap)), t.emissiveIntensity !== void 0 && (s.emissiveIntensity = t.emissiveIntensity), t.specularMap !== void 0 && (s.specularMap = i(t.specularMap)), t.specularIntensityMap !== void 0 && (s.specularIntensityMap = i(t.specularIntensityMap)), t.specularColorMap !== void 0 && (s.specularColorMap = i(t.specularColorMap)), t.envMap !== void 0 && (s.envMap = i(t.envMap)), t.envMapRotation !== void 0 && s.envMapRotation.fromArray(t.envMapRotation), t.envMapIntensity !== void 0 && (s.envMapIntensity = t.envMapIntensity), t.reflectivity !== void 0 && (s.reflectivity = t.reflectivity), t.refractionRatio !== void 0 && (s.refractionRatio = t.refractionRatio), t.lightMap !== void 0 && (s.lightMap = i(t.lightMap)), t.lightMapIntensity !== void 0 && (s.lightMapIntensity = t.lightMapIntensity), t.aoMap !== void 0 && (s.aoMap = i(t.aoMap)), t.aoMapIntensity !== void 0 && (s.aoMapIntensity = t.aoMapIntensity), t.gradientMap !== void 0 && (s.gradientMap = i(t.gradientMap)), t.clearcoatMap !== void 0 && (s.clearcoatMap = i(t.clearcoatMap)), t.clearcoatRoughnessMap !== void 0 && (s.clearcoatRoughnessMap = i(t.clearcoatRoughnessMap)), t.clearcoatNormalMap !== void 0 && (s.clearcoatNormalMap = i(t.clearcoatNormalMap)), t.clearcoatNormalScale !== void 0 && (s.clearcoatNormalScale = new T().fromArray(t.clearcoatNormalScale)), t.iridescenceMap !== void 0 && (s.iridescenceMap = i(t.iridescenceMap)), t.iridescenceThicknessMap !== void 0 && (s.iridescenceThicknessMap = i(t.iridescenceThicknessMap)), t.transmissionMap !== void 0 && (s.transmissionMap = i(t.transmissionMap)), t.thicknessMap !== void 0 && (s.thicknessMap = i(t.thicknessMap)), t.anisotropyMap !== void 0 && (s.anisotropyMap = i(t.anisotropyMap)), t.sheenColorMap !== void 0 && (s.sheenColorMap = i(t.sheenColorMap)), t.sheenRoughnessMap !== void 0 && (s.sheenRoughnessMap = i(t.sheenRoughnessMap)), s; } - return { - setup: c, - setupView: l, - state: i - }; -} -function Ph(s1, e) { - let t = new U0(s1, e), n = [], i = []; - function r() { - n.length = 0, i.length = 0; + setTextures(t) { + return this.textures = t, this; + } + createMaterialFromType(t) { + return h.createMaterialFromType(t); + } + static createMaterialFromType(t) { + let e = { + ShadowMaterial: io, + SpriteMaterial: tn, + RawShaderMaterial: so, + ShaderMaterial: qi, + PointsMaterial: on, + MeshPhysicalMaterial: no, + MeshStandardMaterial: yn, + MeshPhongMaterial: ro, + MeshToonMaterial: oo, + MeshNormalMaterial: ao, + MeshLambertMaterial: ho, + MeshDepthMaterial: lo, + MeshDistanceMaterial: co, + MeshBasicMaterial: _e, + MeshMatcapMaterial: uo, + LineDashedMaterial: po, + LineBasicMaterial: mt, + Material: ct + }; + return new e[t]; } - function a(u) { - n.push(u); +}, Mn = class { + static decodeText(t) { + if (console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."), typeof TextDecoder < "u") return new TextDecoder().decode(t); + let e = ""; + for(let i = 0, s = t.length; i < s; i++)e += String.fromCharCode(t[i]); + try { + return decodeURIComponent(escape(e)); + } catch { + return e; + } } - function o(u) { - i.push(u); + static extractUrlBase(t) { + let e = t.lastIndexOf("/"); + return e === -1 ? "./" : t.slice(0, e + 1); } - function c(u) { - t.setup(n, u); + static resolveURL(t, e) { + return typeof t != "string" || t === "" ? "" : (/^https?:\/\//i.test(e) && /^\//.test(t) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(t) || /^data:.*,.*$/i.test(t) || /^blob:.*$/i.test(t) ? t : e + t); } - function l(u) { - t.setupView(n, u); +}, Bo = class extends L { + constructor(){ + super(), this.isInstancedBufferGeometry = !0, this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0; } - return { - init: r, - state: { - lightsArray: n, - shadowsArray: i, - lights: t - }, - setupLights: c, - setupLightsView: l, - pushLight: a, - pushShadow: o - }; -} -function D0(s1, e) { - let t = new WeakMap; - function n(r, a = 0) { - let o = t.get(r), c; - return o === void 0 ? (c = new Ph(s1, e), t.set(r, [ - c - ])) : a >= o.length ? (c = new Ph(s1, e), o.push(c)) : c = o[a], c; + copy(t) { + return super.copy(t), this.instanceCount = t.instanceCount, this; } - function i() { - t = new WeakMap; + toJSON() { + let t = super.toJSON(); + return t.instanceCount = this.instanceCount, t.isInstancedBufferGeometry = !0, t; } - return { - get: n, - dispose: i - }; -} -var Qr = class extends bt { - constructor(e){ - super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = Cf, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e); +}, Eo = class extends wt { + constructor(t){ + super(t); } - 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; + load(t, e, i, s) { + let n = this, r = new Jt(n.manager); + r.setPath(n.path), r.setRequestHeader(n.requestHeader), r.setWithCredentials(n.withCredentials), r.load(t, function(o) { + try { + e(n.parse(JSON.parse(o))); + } catch (a) { + s ? s(a) : console.error(a), n.manager.itemError(t); + } + }, i, s); } -}, jr = class extends bt { - 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); + parse(t) { + let e = {}, i = {}; + function s(p, f) { + if (e[f] !== void 0) return e[f]; + let y1 = p.interleavedBuffers[f], g = n(p, y1.buffer), x1 = ci(y1.type, g), b = new Ji(x1, y1.stride); + return b.uuid = y1.uuid, e[f] = b, b; + } + function n(p, f) { + if (i[f] !== void 0) return i[f]; + let y1 = p.arrayBuffers[f], g = new Uint32Array(y1).buffer; + return i[f] = g, g; + } + let r = t.isInstancedBufferGeometry ? new Bo : new L, o = t.data.index; + if (o !== void 0) { + let p = ci(o.type, o.array); + r.setIndex(new Z(p, 1)); + } + let a = t.data.attributes; + for(let p in a){ + let f = a[p], m; + if (f.isInterleavedBufferAttribute) { + let y1 = s(t.data, f.data); + m = new fi(y1, f.itemSize, f.offset, f.normalized); + } else { + let y1 = ci(f.type, f.array), g = f.isInstancedBufferAttribute ? Ue : Z; + m = new g(y1, f.itemSize, f.normalized); + } + f.name !== void 0 && (m.name = f.name), f.usage !== void 0 && m.setUsage(f.usage), r.setAttribute(p, m); + } + let l = t.data.morphAttributes; + if (l) for(let p in l){ + let f = l[p], m = []; + for(let y1 = 0, g = f.length; y1 < g; y1++){ + let x1 = f[y1], b; + if (x1.isInterleavedBufferAttribute) { + let M = s(t.data, x1.data); + b = new fi(M, x1.itemSize, x1.offset, x1.normalized); + } else { + let M = ci(x1.type, x1.array); + b = new Z(M, x1.itemSize, x1.normalized); + } + x1.name !== void 0 && (b.name = x1.name), m.push(b); + } + r.morphAttributes[p] = m; + } + t.data.morphTargetsRelative && (r.morphTargetsRelative = !0); + let u = t.data.groups || t.data.drawcalls || t.data.offsets; + if (u !== void 0) for(let p = 0, f = u.length; p !== f; ++p){ + let m = u[p]; + r.addGroup(m.start, m.count, m.materialIndex); + } + let d = t.data.boundingSphere; + if (d !== void 0) { + let p = new w; + d.center !== void 0 && p.fromArray(d.center), r.boundingSphere = new ht(p, d.radius); + } + return t.name && (r.name = t.name), t.userData && (r.userData = t.userData), r; } - 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; +}, vh = class extends wt { + constructor(t){ + super(t); } -}, N0 = `void main() { - gl_Position = vec4( position, 1.0 ); -}`, O0 = `uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`; -function F0(s1, e, t) { - let n = new Ps, i = new Z, r = new Z, a = new je, o = new Qr({ - depthPacking: Pf - }), c = new jr, l = {}, h = t.maxTextureSize, u = { - [Bn]: Ft, - [Ft]: Bn, - [gn]: gn - }, d = new jt({ - defines: { - VSM_SAMPLES: 8 - }, - uniforms: { - shadow_pass: { - value: null - }, - resolution: { - value: new Z - }, - radius: { - value: 4 - } - }, - vertexShader: N0, - fragmentShader: O0 - }), f = d.clone(); - f.defines.HORIZONTAL_PASS = 1; - let m = new Ge; - m.setAttribute("position", new et(new Float32Array([ - -1, - -1, - .5, - 3, - -1, - .5, - -1, - 3, - .5 - ]), 3)); - let _ = new Mt(m, d), g = this; - this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = cd; - let p = this.type; - this.render = function(b, w, R) { - if (g.enabled === !1 || g.autoUpdate === !1 && g.needsUpdate === !1 || b.length === 0) return; - let I = s1.getRenderTarget(), M = s1.getActiveCubeFace(), T = s1.getActiveMipmapLevel(), O = s1.state; - O.setBlending(Dn), O.buffers.color.setClear(1, 1, 1, 1), O.buffers.depth.setTest(!0), O.setScissorTest(!1); - let Y = p !== pn && this.type === pn, $ = p === pn && this.type !== pn; - for(let U = 0, z = b.length; U < z; U++){ - let q = b[U], H = q.shadow; - if (H === void 0) { - console.warn("THREE.WebGLShadowMap:", q, "has no shadow."); - continue; + load(t, e, i, s) { + let n = this, r = this.path === "" ? Mn.extractUrlBase(t) : this.path; + this.resourcePath = this.resourcePath || r; + let o = new Jt(this.manager); + o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(a) { + let l = null; + try { + l = JSON.parse(a); + } catch (u) { + s !== void 0 && s(u), console.error("THREE:ObjectLoader: Can't parse " + t + ".", u.message); + return; } - if (H.autoUpdate === !1 && H.needsUpdate === !1) continue; - i.copy(H.mapSize); - let ne = H.getFrameExtents(); - if (i.multiply(ne), r.copy(H.mapSize), (i.x > h || i.y > h) && (i.x > h && (r.x = Math.floor(h / ne.x), i.x = r.x * ne.x, H.mapSize.x = r.x), i.y > h && (r.y = Math.floor(h / ne.y), i.y = r.y * ne.y, H.mapSize.y = r.y)), H.map === null || Y === !0 || $ === !0) { - let K = this.type !== pn ? { - minFilter: pt, - magFilter: pt - } : {}; - H.map !== null && H.map.dispose(), H.map = new qt(i.x, i.y, K), H.map.texture.name = q.name + ".shadowMap", H.camera.updateProjectionMatrix(); + let c = l.metadata; + if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry") { + s !== void 0 && s(new Error("THREE.ObjectLoader: Can't load " + t)), console.error("THREE.ObjectLoader: Can't load " + t); + return; } - s1.setRenderTarget(H.map), s1.clear(); - let W = H.getViewportCount(); - for(let K = 0; K < W; K++){ - let D = H.getViewport(K); - a.set(r.x * D.x, r.y * D.y, r.x * D.z, r.y * D.w), O.viewport(a), H.updateMatrices(q, K), n = H.getFrustum(), y1(w, R, H.camera, q, this.type); + n.parse(l, e); + }, i, s); + } + async loadAsync(t, e) { + let i = this, s = this.path === "" ? Mn.extractUrlBase(t) : this.path; + this.resourcePath = this.resourcePath || s; + let n = new Jt(this.manager); + n.setPath(this.path), n.setRequestHeader(this.requestHeader), n.setWithCredentials(this.withCredentials); + let r = await n.loadAsync(t, e), o = JSON.parse(r), a = o.metadata; + if (a === void 0 || a.type === void 0 || a.type.toLowerCase() === "geometry") throw new Error("THREE.ObjectLoader: Can't load " + t); + return await i.parseAsync(o); + } + parse(t, e) { + let i = this.parseAnimations(t.animations), s = this.parseShapes(t.shapes), n = this.parseGeometries(t.geometries, s), r = this.parseImages(t.images, function() { + e !== void 0 && e(l); + }), o = this.parseTextures(t.textures, r), a = this.parseMaterials(t.materials, o), l = this.parseObject(t.object, n, a, o, i), c = this.parseSkeletons(t.skeletons, l); + if (this.bindSkeletons(l, c), this.bindLightTargets(l), e !== void 0) { + let u = !1; + for(let d in r)if (r[d].data instanceof HTMLImageElement) { + u = !0; + break; } - H.isPointLightShadow !== !0 && this.type === pn && v(H, R), H.needsUpdate = !1; + u === !1 && e(l); } - p = this.type, g.needsUpdate = !1, s1.setRenderTarget(I, M, T); - }; - function v(b, w) { - let R = e.update(_); - d.defines.VSM_SAMPLES !== b.blurSamples && (d.defines.VSM_SAMPLES = b.blurSamples, f.defines.VSM_SAMPLES = b.blurSamples, d.needsUpdate = !0, f.needsUpdate = !0), b.mapPass === null && (b.mapPass = new qt(i.x, i.y)), d.uniforms.shadow_pass.value = b.map.texture, d.uniforms.resolution.value = b.mapSize, d.uniforms.radius.value = b.radius, s1.setRenderTarget(b.mapPass), s1.clear(), s1.renderBufferDirect(w, null, R, d, _, null), f.uniforms.shadow_pass.value = b.mapPass.texture, f.uniforms.resolution.value = b.mapSize, f.uniforms.radius.value = b.radius, s1.setRenderTarget(b.map), s1.clear(), s1.renderBufferDirect(w, null, R, f, _, null); - } - function x1(b, w, R, I) { - let M = null, T = R.isPointLight === !0 ? b.customDistanceMaterial : b.customDepthMaterial; - if (T !== void 0) M = T; - else if (M = R.isPointLight === !0 ? c : o, s1.localClippingEnabled && w.clipShadows === !0 && Array.isArray(w.clippingPlanes) && w.clippingPlanes.length !== 0 || w.displacementMap && w.displacementScale !== 0 || w.alphaMap && w.alphaTest > 0 || w.map && w.alphaTest > 0) { - let O = M.uuid, Y = w.uuid, $ = l[O]; - $ === void 0 && ($ = {}, l[O] = $); - let U = $[Y]; - U === void 0 && (U = M.clone(), $[Y] = U), M = U; - } - if (M.visible = w.visible, M.wireframe = w.wireframe, I === pn ? M.side = w.shadowSide !== null ? w.shadowSide : w.side : M.side = w.shadowSide !== null ? w.shadowSide : u[w.side], M.alphaMap = w.alphaMap, M.alphaTest = w.alphaTest, M.map = w.map, M.clipShadows = w.clipShadows, M.clippingPlanes = w.clippingPlanes, M.clipIntersection = w.clipIntersection, M.displacementMap = w.displacementMap, M.displacementScale = w.displacementScale, M.displacementBias = w.displacementBias, M.wireframeLinewidth = w.wireframeLinewidth, M.linewidth = w.linewidth, R.isPointLight === !0 && M.isMeshDistanceMaterial === !0) { - let O = s1.properties.get(M); - O.light = R; - } - return M; - } - function y1(b, w, R, I, M) { - if (b.visible === !1) return; - if (b.layers.test(w.layers) && (b.isMesh || b.isLine || b.isPoints) && (b.castShadow || b.receiveShadow && M === pn) && (!b.frustumCulled || n.intersectsObject(b))) { - b.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse, b.matrixWorld); - let Y = e.update(b), $ = b.material; - if (Array.isArray($)) { - let U = Y.groups; - for(let z = 0, q = U.length; z < q; z++){ - let H = U[z], ne = $[H.materialIndex]; - if (ne && ne.visible) { - let W = x1(b, ne, I, M); - s1.renderBufferDirect(R, null, Y, W, b, H); - } + return l; + } + async parseAsync(t) { + let e = this.parseAnimations(t.animations), i = this.parseShapes(t.shapes), s = this.parseGeometries(t.geometries, i), n = await this.parseImagesAsync(t.images), r = this.parseTextures(t.textures, n), o = this.parseMaterials(t.materials, r), a = this.parseObject(t.object, s, o, r, e), l = this.parseSkeletons(t.skeletons, a); + return this.bindSkeletons(a, l), this.bindLightTargets(a), a; + } + parseShapes(t) { + let e = {}; + if (t !== void 0) for(let i = 0, s = t.length; i < s; i++){ + let n = new Me().fromJSON(t[i]); + e[n.uuid] = n; + } + return e; + } + parseSkeletons(t, e) { + let i = {}, s = {}; + if (e.traverse(function(n) { + n.isBone && (s[n.uuid] = n); + }), t !== void 0) for(let n = 0, r = t.length; n < r; n++){ + let o = new Tr().fromJSON(t[n], s); + i[o.uuid] = o; + } + return i; + } + parseGeometries(t, e) { + let i = {}; + if (t !== void 0) { + let s = new Eo; + for(let n = 0, r = t.length; n < r; n++){ + let o, a = t[n]; + switch(a.type){ + case "BufferGeometry": + case "InstancedBufferGeometry": + o = s.parse(a); + break; + default: + a.type in fh ? o = fh[a.type].fromJSON(a, e) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`); } - } else if ($.visible) { - let U = x1(b, $, I, M); - s1.renderBufferDirect(R, null, Y, U, b, null); + o.uuid = a.uuid, a.name !== void 0 && (o.name = a.name), a.userData !== void 0 && (o.userData = a.userData), i[a.uuid] = o; } } - let O = b.children; - for(let Y = 0, $ = O.length; Y < $; Y++)y1(O[Y], w, R, I, M); + return i; } -} -function B0(s1, e, t) { - let n = t.isWebGL2; - function i() { - let P = !1, ce = new je, ae = null, ge = new je(0, 0, 0, 0); - return { - setMask: function(ue) { - ae !== ue && !P && (s1.colorMask(ue, ue, ue, ue), ae = ue); - }, - setLocked: function(ue) { - P = ue; - }, - setClear: function(ue, Q, be, Fe, At) { - At === !0 && (ue *= Fe, Q *= Fe, be *= Fe), ce.set(ue, Q, be, Fe), ge.equals(ce) === !1 && (s1.clearColor(ue, Q, be, Fe), ge.copy(ce)); - }, - reset: function() { - P = !1, ae = null, ge.set(-1, 0, 0, 0); + parseMaterials(t, e) { + let i = {}, s = {}; + if (t !== void 0) { + let n = new Fo; + n.setTextures(e); + for(let r = 0, o = t.length; r < o; r++){ + let a = t[r]; + i[a.uuid] === void 0 && (i[a.uuid] = n.parse(a)), s[a.uuid] = i[a.uuid]; } - }; + } + return s; } - function r() { - let P = !1, ce = null, ae = null, ge = null; - return { - setTest: function(ue) { - ue ? Ee(s1.DEPTH_TEST) : Te(s1.DEPTH_TEST); - }, - setMask: function(ue) { - ce !== ue && !P && (s1.depthMask(ue), ce = ue); - }, - setFunc: function(ue) { - if (ae !== ue) { - switch(ue){ - case nf: - s1.depthFunc(s1.NEVER); - break; - case sf: - s1.depthFunc(s1.ALWAYS); - break; - case rf: - s1.depthFunc(s1.LESS); - break; - case uo: - s1.depthFunc(s1.LEQUAL); - break; - case af: - s1.depthFunc(s1.EQUAL); - break; - case of: - s1.depthFunc(s1.GEQUAL); - break; - case cf: - s1.depthFunc(s1.GREATER); - break; - case lf: - s1.depthFunc(s1.NOTEQUAL); - break; - default: - s1.depthFunc(s1.LEQUAL); + parseAnimations(t) { + let e = {}; + if (t !== void 0) for(let i = 0; i < t.length; i++){ + let s = t[i], n = wi.parse(s); + e[n.uuid] = n; + } + return e; + } + parseImages(t, e) { + let i = this, s = {}, n; + function r(a) { + return i.manager.itemStart(a), n.load(a, function() { + i.manager.itemEnd(a); + }, void 0, function() { + i.manager.itemError(a), i.manager.itemEnd(a); + }); + } + function o(a) { + if (typeof a == "string") { + let l = a, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : i.resourcePath + l; + return r(c); + } else return a.data ? { + data: ci(a.type, a.data), + width: a.width, + height: a.height + } : null; + } + if (t !== void 0 && t.length > 0) { + let a = new bn(e); + n = new Mi(a), n.setCrossOrigin(this.crossOrigin); + for(let l = 0, c = t.length; l < c; l++){ + let u = t[l], d = u.url; + if (Array.isArray(d)) { + let p = []; + for(let f = 0, m = d.length; f < m; f++){ + let y1 = d[f], g = o(y1); + g !== null && (g instanceof HTMLImageElement ? p.push(g) : p.push(new Lt(g.data, g.width, g.height))); } - ae = ue; + s[u.uuid] = new be(p); + } else { + let p = o(u.url); + s[u.uuid] = new be(p); } - }, - setLocked: function(ue) { - P = ue; - }, - setClear: function(ue) { - ge !== ue && (s1.clearDepth(ue), ge = ue); - }, - reset: function() { - P = !1, ce = null, ae = null, ge = null; } - }; + } + return s; } - function a() { - let P = !1, ce = null, ae = null, ge = null, ue = null, Q = null, be = null, Fe = null, At = null; - return { - setTest: function(tt) { - P || (tt ? Ee(s1.STENCIL_TEST) : Te(s1.STENCIL_TEST)); - }, - setMask: function(tt) { - ce !== tt && !P && (s1.stencilMask(tt), ce = tt); - }, - setFunc: function(tt, tn, Rt) { - (ae !== tt || ge !== tn || ue !== Rt) && (s1.stencilFunc(tt, tn, Rt), ae = tt, ge = tn, ue = Rt); - }, - setOp: function(tt, tn, Rt) { - (Q !== tt || be !== tn || Fe !== Rt) && (s1.stencilOp(tt, tn, Rt), Q = tt, be = tn, Fe = Rt); - }, - setLocked: function(tt) { - P = tt; - }, - setClear: function(tt) { - At !== tt && (s1.clearStencil(tt), At = tt); - }, - reset: function() { - P = !1, ce = null, ae = null, ge = null, ue = null, Q = null, be = null, Fe = null, At = null; + async parseImagesAsync(t) { + let e = this, i = {}, s; + async function n(r) { + if (typeof r == "string") { + let o = r, a = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(o) ? o : e.resourcePath + o; + return await s.loadAsync(a); + } else return r.data ? { + data: ci(r.type, r.data), + width: r.width, + height: r.height + } : null; + } + if (t !== void 0 && t.length > 0) { + s = new Mi(this.manager), s.setCrossOrigin(this.crossOrigin); + for(let r = 0, o = t.length; r < o; r++){ + let a = t[r], l = a.url; + if (Array.isArray(l)) { + let c = []; + for(let u = 0, d = l.length; u < d; u++){ + let p = l[u], f = await n(p); + f !== null && (f instanceof HTMLImageElement ? c.push(f) : c.push(new Lt(f.data, f.width, f.height))); + } + i[a.uuid] = new be(c); + } else { + let c = await n(a.url); + i[a.uuid] = new be(c); + } } - }; + } + return i; } - let o = new i, c = new r, l = new a, h = new WeakMap, u = new WeakMap, d = {}, f = {}, m = new WeakMap, _ = [], g = null, p = !1, v = null, x1 = null, y1 = null, b = null, w = null, R = null, I = null, M = !1, T = null, O = null, Y = null, $ = null, U = null, z = s1.getParameter(s1.MAX_COMBINED_TEXTURE_IMAGE_UNITS), q = !1, H = 0, ne = s1.getParameter(s1.VERSION); - ne.indexOf("WebGL") !== -1 ? (H = parseFloat(/^WebGL (\d)/.exec(ne)[1]), q = H >= 1) : ne.indexOf("OpenGL ES") !== -1 && (H = parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]), q = H >= 2); - let W = null, K = {}, D = s1.getParameter(s1.SCISSOR_BOX), G = s1.getParameter(s1.VIEWPORT), he = new je().fromArray(D), fe = new je().fromArray(G); - function _e(P, ce, ae, ge) { - let ue = new Uint8Array(4), Q = s1.createTexture(); - s1.bindTexture(P, Q), s1.texParameteri(P, s1.TEXTURE_MIN_FILTER, s1.NEAREST), s1.texParameteri(P, s1.TEXTURE_MAG_FILTER, s1.NEAREST); - for(let be = 0; be < ae; be++)n && (P === s1.TEXTURE_3D || P === s1.TEXTURE_2D_ARRAY) ? s1.texImage3D(ce, 0, s1.RGBA, 1, 1, ge, 0, s1.RGBA, s1.UNSIGNED_BYTE, ue) : s1.texImage2D(ce + be, 0, s1.RGBA, 1, 1, 0, s1.RGBA, s1.UNSIGNED_BYTE, ue); - return Q; - } - let we = {}; - we[s1.TEXTURE_2D] = _e(s1.TEXTURE_2D, s1.TEXTURE_2D, 1), we[s1.TEXTURE_CUBE_MAP] = _e(s1.TEXTURE_CUBE_MAP, s1.TEXTURE_CUBE_MAP_POSITIVE_X, 6), n && (we[s1.TEXTURE_2D_ARRAY] = _e(s1.TEXTURE_2D_ARRAY, s1.TEXTURE_2D_ARRAY, 1, 1), we[s1.TEXTURE_3D] = _e(s1.TEXTURE_3D, s1.TEXTURE_3D, 1, 1)), o.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), Ee(s1.DEPTH_TEST), c.setFunc(uo), J(!1), Se(rl), Ee(s1.CULL_FACE), X(Dn); - function Ee(P) { - d[P] !== !0 && (s1.enable(P), d[P] = !0); - } - function Te(P) { - d[P] !== !1 && (s1.disable(P), d[P] = !1); - } - function Ye(P, ce) { - return f[P] !== ce ? (s1.bindFramebuffer(P, ce), f[P] = ce, n && (P === s1.DRAW_FRAMEBUFFER && (f[s1.FRAMEBUFFER] = ce), P === s1.FRAMEBUFFER && (f[s1.DRAW_FRAMEBUFFER] = ce)), !0) : !1; - } - function it(P, ce) { - let ae = _, ge = !1; - if (P) if (ae = m.get(ce), ae === void 0 && (ae = [], m.set(ce, ae)), P.isWebGLMultipleRenderTargets) { - let ue = P.texture; - if (ae.length !== ue.length || ae[0] !== s1.COLOR_ATTACHMENT0) { - for(let Q = 0, be = ue.length; Q < be; Q++)ae[Q] = s1.COLOR_ATTACHMENT0 + Q; - ae.length = ue.length, ge = !0; - } - } else ae[0] !== s1.COLOR_ATTACHMENT0 && (ae[0] = s1.COLOR_ATTACHMENT0, ge = !0); - else ae[0] !== s1.BACK && (ae[0] = s1.BACK, ge = !0); - ge && (t.isWebGL2 ? s1.drawBuffers(ae) : e.get("WEBGL_draw_buffers").drawBuffersWEBGL(ae)); - } - function Ce(P) { - return g !== P ? (s1.useProgram(P), g = P, !0) : !1; - } - let L = { - [Bi]: s1.FUNC_ADD, - [Xd]: s1.FUNC_SUBTRACT, - [qd]: s1.FUNC_REVERSE_SUBTRACT - }; - if (n) L[ll] = s1.MIN, L[hl] = s1.MAX; - else { - let P = e.get("EXT_blend_minmax"); - P !== null && (L[ll] = P.MIN_EXT, L[hl] = P.MAX_EXT); - } - let oe = { - [Yd]: s1.ZERO, - [Zd]: s1.ONE, - [Jd]: s1.SRC_COLOR, - [ld]: s1.SRC_ALPHA, - [tf]: s1.SRC_ALPHA_SATURATE, - [jd]: s1.DST_COLOR, - [Kd]: s1.DST_ALPHA, - [$d]: s1.ONE_MINUS_SRC_COLOR, - [hd]: s1.ONE_MINUS_SRC_ALPHA, - [ef]: s1.ONE_MINUS_DST_COLOR, - [Qd]: s1.ONE_MINUS_DST_ALPHA - }; - function X(P, ce, ae, ge, ue, Q, be, Fe) { - if (P === Dn) { - p === !0 && (Te(s1.BLEND), p = !1); - return; + parseTextures(t, e) { + function i(n, r) { + return typeof n == "number" ? n : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", n), r[n]); } - if (p === !1 && (Ee(s1.BLEND), p = !0), P !== Wd) { - if (P !== v || Fe !== M) { - if ((x1 !== Bi || w !== Bi) && (s1.blendEquation(s1.FUNC_ADD), x1 = Bi, w = Bi), Fe) switch(P){ - case Wi: - s1.blendFuncSeparate(s1.ONE, s1.ONE_MINUS_SRC_ALPHA, s1.ONE, s1.ONE_MINUS_SRC_ALPHA); - break; - case al: - s1.blendFunc(s1.ONE, s1.ONE); - break; - case ol: - s1.blendFuncSeparate(s1.ZERO, s1.ONE_MINUS_SRC_COLOR, s1.ZERO, s1.ONE); - break; - case cl: - s1.blendFuncSeparate(s1.ZERO, s1.SRC_COLOR, s1.ZERO, s1.SRC_ALPHA); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", P); - break; - } - else switch(P){ - case Wi: - s1.blendFuncSeparate(s1.SRC_ALPHA, s1.ONE_MINUS_SRC_ALPHA, s1.ONE, s1.ONE_MINUS_SRC_ALPHA); - break; - case al: - s1.blendFunc(s1.SRC_ALPHA, s1.ONE); - break; - case ol: - s1.blendFuncSeparate(s1.ZERO, s1.ONE_MINUS_SRC_COLOR, s1.ZERO, s1.ONE); - break; - case cl: - s1.blendFunc(s1.ZERO, s1.SRC_COLOR); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", P); - break; + let s = {}; + if (t !== void 0) for(let n = 0, r = t.length; n < r; n++){ + let o = t[n]; + o.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', o.uuid), e[o.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", o.image); + let a = e[o.image], l = a.data, c; + Array.isArray(l) ? (c = new Xi, l.length === 6 && (c.needsUpdate = !0)) : (l && l.data ? c = new Lt : c = new lt, l && (c.needsUpdate = !0)), c.source = a, c.uuid = o.uuid, o.name !== void 0 && (c.name = o.name), o.mapping !== void 0 && (c.mapping = i(o.mapping, wd)), o.channel !== void 0 && (c.channel = o.channel), o.offset !== void 0 && c.offset.fromArray(o.offset), o.repeat !== void 0 && c.repeat.fromArray(o.repeat), o.center !== void 0 && c.center.fromArray(o.center), o.rotation !== void 0 && (c.rotation = o.rotation), o.wrap !== void 0 && (c.wrapS = i(o.wrap[0], Ah), c.wrapT = i(o.wrap[1], Ah)), o.format !== void 0 && (c.format = o.format), o.internalFormat !== void 0 && (c.internalFormat = o.internalFormat), o.type !== void 0 && (c.type = o.type), o.colorSpace !== void 0 && (c.colorSpace = o.colorSpace), o.minFilter !== void 0 && (c.minFilter = i(o.minFilter, Sh)), o.magFilter !== void 0 && (c.magFilter = i(o.magFilter, Sh)), o.anisotropy !== void 0 && (c.anisotropy = o.anisotropy), o.flipY !== void 0 && (c.flipY = o.flipY), o.generateMipmaps !== void 0 && (c.generateMipmaps = o.generateMipmaps), o.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = o.premultiplyAlpha), o.unpackAlignment !== void 0 && (c.unpackAlignment = o.unpackAlignment), o.compareFunction !== void 0 && (c.compareFunction = o.compareFunction), o.userData !== void 0 && (c.userData = o.userData), s[o.uuid] = c; + } + return s; + } + parseObject(t, e, i, s, n) { + let r; + function o(d) { + return e[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined geometry", d), e[d]; + } + function a(d) { + if (d !== void 0) { + if (Array.isArray(d)) { + let p = []; + for(let f = 0, m = d.length; f < m; f++){ + let y1 = d[f]; + i[y1] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", y1), p.push(i[y1]); + } + return p; } - y1 = null, b = null, R = null, I = null, v = P, M = Fe; + return i[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", d), i[d]; + } + } + function l(d) { + return s[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", d), s[d]; + } + let c, u; + switch(t.type){ + case "Scene": + r = new _r, t.background !== void 0 && (Number.isInteger(t.background) ? r.background = new P(t.background) : r.background = l(t.background)), t.environment !== void 0 && (r.environment = l(t.environment)), t.fog !== void 0 && (t.fog.type === "Fog" ? r.fog = new Mr(t.fog.color, t.fog.near, t.fog.far) : t.fog.type === "FogExp2" && (r.fog = new wr(t.fog.color, t.fog.density)), t.fog.name !== "" && (r.fog.name = t.fog.name)), t.backgroundBlurriness !== void 0 && (r.backgroundBlurriness = t.backgroundBlurriness), t.backgroundIntensity !== void 0 && (r.backgroundIntensity = t.backgroundIntensity), t.backgroundRotation !== void 0 && r.backgroundRotation.fromArray(t.backgroundRotation), t.environmentIntensity !== void 0 && (r.environmentIntensity = t.environmentIntensity), t.environmentRotation !== void 0 && r.environmentRotation.fromArray(t.environmentRotation); + break; + case "PerspectiveCamera": + r = new vt(t.fov, t.aspect, t.near, t.far), t.focus !== void 0 && (r.focus = t.focus), t.zoom !== void 0 && (r.zoom = t.zoom), t.filmGauge !== void 0 && (r.filmGauge = t.filmGauge), t.filmOffset !== void 0 && (r.filmOffset = t.filmOffset), t.view !== void 0 && (r.view = Object.assign({}, t.view)); + break; + case "OrthographicCamera": + r = new wn(t.left, t.right, t.top, t.bottom, t.near, t.far), t.zoom !== void 0 && (r.zoom = t.zoom), t.view !== void 0 && (r.view = Object.assign({}, t.view)); + break; + case "AmbientLight": + r = new To(t.color, t.intensity); + break; + case "DirectionalLight": + r = new So(t.color, t.intensity), r.target = t.target || ""; + break; + case "PointLight": + r = new vo(t.color, t.intensity, t.distance, t.decay); + break; + case "RectAreaLight": + r = new Io(t.color, t.intensity, t.width, t.height); + break; + case "SpotLight": + r = new Mo(t.color, t.intensity, t.distance, t.angle, t.penumbra, t.decay), r.target = t.target || ""; + break; + case "HemisphereLight": + r = new bo(t.color, t.groundColor, t.intensity); + break; + case "LightProbe": + r = new zo().fromJSON(t); + break; + case "SkinnedMesh": + c = o(t.geometry), u = a(t.material), r = new Sr(c, u), t.bindMode !== void 0 && (r.bindMode = t.bindMode), t.bindMatrix !== void 0 && r.bindMatrix.fromArray(t.bindMatrix), t.skeleton !== void 0 && (r.skeleton = t.skeleton); + break; + case "Mesh": + c = o(t.geometry), u = a(t.material), r = new Ct(c, u); + break; + case "InstancedMesh": + c = o(t.geometry), u = a(t.material); + let d = t.count, p = t.instanceMatrix, f = t.instanceColor; + r = new Ir(c, u, d), r.instanceMatrix = new Ue(new Float32Array(p.array), 16), f !== void 0 && (r.instanceColor = new Ue(new Float32Array(f.array), f.itemSize)); + break; + case "BatchedMesh": + c = o(t.geometry), u = a(t.material), r = new zr(t.maxInstanceCount, t.maxVertexCount, t.maxIndexCount, u), r.geometry = c, r.perObjectFrustumCulled = t.perObjectFrustumCulled, r.sortObjects = t.sortObjects, r._drawRanges = t.drawRanges, r._reservedRanges = t.reservedRanges, r._visibility = t.visibility, r._active = t.active, r._bounds = t.bounds.map((m)=>{ + let y1 = new ft; + y1.min.fromArray(m.boxMin), y1.max.fromArray(m.boxMax); + let g = new ht; + return g.radius = m.sphereRadius, g.center.fromArray(m.sphereCenter), { + boxInitialized: m.boxInitialized, + box: y1, + sphereInitialized: m.sphereInitialized, + sphere: g + }; + }), r._maxInstanceCount = t.maxInstanceCount, r._maxVertexCount = t.maxVertexCount, r._maxIndexCount = t.maxIndexCount, r._geometryInitialized = t.geometryInitialized, r._geometryCount = t.geometryCount, r._matricesTexture = l(t.matricesTexture.uuid), t.colorsTexture !== void 0 && (r._colorsTexture = l(t.colorsTexture.uuid)); + break; + case "LOD": + r = new Ar; + break; + case "Line": + r = new le(o(t.geometry), a(t.material)); + break; + case "LineLoop": + r = new Fr(o(t.geometry), a(t.material)); + break; + case "LineSegments": + r = new Wt(o(t.geometry), a(t.material)); + break; + case "PointCloud": + case "Points": + r = new Er(o(t.geometry), a(t.material)); + break; + case "Sprite": + r = new vr(a(t.material)); + break; + case "Group": + r = new Ne; + break; + case "Bone": + r = new en; + break; + default: + r = new G; + } + if (r.uuid = t.uuid, t.name !== void 0 && (r.name = t.name), t.matrix !== void 0 ? (r.matrix.fromArray(t.matrix), t.matrixAutoUpdate !== void 0 && (r.matrixAutoUpdate = t.matrixAutoUpdate), r.matrixAutoUpdate && r.matrix.decompose(r.position, r.quaternion, r.scale)) : (t.position !== void 0 && r.position.fromArray(t.position), t.rotation !== void 0 && r.rotation.fromArray(t.rotation), t.quaternion !== void 0 && r.quaternion.fromArray(t.quaternion), t.scale !== void 0 && r.scale.fromArray(t.scale)), t.up !== void 0 && r.up.fromArray(t.up), t.castShadow !== void 0 && (r.castShadow = t.castShadow), t.receiveShadow !== void 0 && (r.receiveShadow = t.receiveShadow), t.shadow && (t.shadow.intensity !== void 0 && (r.shadow.intensity = t.shadow.intensity), t.shadow.bias !== void 0 && (r.shadow.bias = t.shadow.bias), t.shadow.normalBias !== void 0 && (r.shadow.normalBias = t.shadow.normalBias), t.shadow.radius !== void 0 && (r.shadow.radius = t.shadow.radius), t.shadow.mapSize !== void 0 && r.shadow.mapSize.fromArray(t.shadow.mapSize), t.shadow.camera !== void 0 && (r.shadow.camera = this.parseObject(t.shadow.camera))), t.visible !== void 0 && (r.visible = t.visible), t.frustumCulled !== void 0 && (r.frustumCulled = t.frustumCulled), t.renderOrder !== void 0 && (r.renderOrder = t.renderOrder), t.userData !== void 0 && (r.userData = t.userData), t.layers !== void 0 && (r.layers.mask = t.layers), t.children !== void 0) { + let d = t.children; + for(let p = 0; p < d.length; p++)r.add(this.parseObject(d[p], e, i, s, n)); + } + if (t.animations !== void 0) { + let d = t.animations; + for(let p = 0; p < d.length; p++){ + let f = d[p]; + r.animations.push(n[f]); + } + } + if (t.type === "LOD") { + t.autoUpdate !== void 0 && (r.autoUpdate = t.autoUpdate); + let d = t.levels; + for(let p = 0; p < d.length; p++){ + let f = d[p], m = r.getObjectByProperty("uuid", f.object); + m !== void 0 && r.addLevel(m, f.distance, f.hysteresis); + } + } + return r; + } + bindSkeletons(t, e) { + Object.keys(e).length !== 0 && t.traverse(function(i) { + if (i.isSkinnedMesh === !0 && i.skeleton !== void 0) { + let s = e[i.skeleton]; + s === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", i.skeleton) : i.bind(s, i.bindMatrix); + } + }); + } + bindLightTargets(t) { + t.traverse(function(e) { + if (e.isDirectionalLight || e.isSpotLight) { + let i = e.target, s = t.getObjectByProperty("uuid", i); + s !== void 0 ? e.target = s : e.target = new G; + } + }); + } +}, wd = { + UVMapping: Lo, + CubeReflectionMapping: Uo, + CubeRefractionMapping: Hl, + EquirectangularReflectionMapping: ql, + EquirectangularRefractionMapping: Gl, + CubeUVReflectionMapping: Xl +}, Ah = { + RepeatWrapping: pr, + ClampToEdgeWrapping: Ht, + MirroredRepeatWrapping: fr +}, Sh = { + NearestFilter: Ut, + NearestMipmapNearestFilter: Jl, + NearestMipmapLinearFilter: Zl, + LinearFilter: Et, + LinearMipmapNearestFilter: Yl, + LinearMipmapLinearFilter: vn +}, Th = class extends wt { + constructor(t){ + super(t), 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(t) { + return this.options = t, this; + } + load(t, e, i, s) { + t === void 0 && (t = ""), this.path !== void 0 && (t = this.path + t), t = this.manager.resolveURL(t); + let n = this, r = we.get(t); + if (r !== void 0) { + if (n.manager.itemStart(t), r.then) { + r.then((l)=>{ + e && e(l), n.manager.itemEnd(t); + }).catch((l)=>{ + s && s(l); + }); + return; } - return; + return setTimeout(function() { + e && e(r), n.manager.itemEnd(t); + }, 0), r; } - ue = ue || ce, Q = Q || ae, be = be || ge, (ce !== x1 || ue !== w) && (s1.blendEquationSeparate(L[ce], L[ue]), x1 = ce, w = ue), (ae !== y1 || ge !== b || Q !== R || be !== I) && (s1.blendFuncSeparate(oe[ae], oe[ge], oe[Q], oe[be]), y1 = ae, b = ge, R = Q, I = be), v = P, M = !1; + let o = {}; + o.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", o.headers = this.requestHeader; + let a = fetch(t, o).then(function(l) { + return l.blob(); + }).then(function(l) { + return createImageBitmap(l, Object.assign(n.options, { + colorSpaceConversion: "none" + })); + }).then(function(l) { + return we.add(t, l), e && e(l), n.manager.itemEnd(t), l; + }).catch(function(l) { + s && s(l), we.remove(t), n.manager.itemError(t), n.manager.itemEnd(t); + }); + we.add(t, a), n.manager.itemStart(t); } - function ie(P, ce) { - P.side === gn ? Te(s1.CULL_FACE) : Ee(s1.CULL_FACE); - let ae = P.side === Ft; - ce && (ae = !ae), J(ae), P.blending === Wi && P.transparent === !1 ? X(Dn) : X(P.blending, P.blendEquation, P.blendSrc, P.blendDst, P.blendEquationAlpha, P.blendSrcAlpha, P.blendDstAlpha, P.premultipliedAlpha), c.setFunc(P.depthFunc), c.setTest(P.depthTest), c.setMask(P.depthWrite), o.setMask(P.colorWrite); - let ge = P.stencilWrite; - l.setTest(ge), ge && (l.setMask(P.stencilWriteMask), l.setFunc(P.stencilFunc, P.stencilRef, P.stencilFuncMask), l.setOp(P.stencilFail, P.stencilZFail, P.stencilZPass)), ye(P.polygonOffset, P.polygonOffsetFactor, P.polygonOffsetUnits), P.alphaToCoverage === !0 ? Ee(s1.SAMPLE_ALPHA_TO_COVERAGE) : Te(s1.SAMPLE_ALPHA_TO_COVERAGE); +}, Vs, _n = class { + static getContext() { + return Vs === void 0 && (Vs = new (window.AudioContext || window.webkitAudioContext)), Vs; } - function J(P) { - T !== P && (P ? s1.frontFace(s1.CW) : s1.frontFace(s1.CCW), T = P); + static setContext(t) { + Vs = t; } - function Se(P) { - P !== kd ? (Ee(s1.CULL_FACE), P !== O && (P === rl ? s1.cullFace(s1.BACK) : P === Hd ? s1.cullFace(s1.FRONT) : s1.cullFace(s1.FRONT_AND_BACK))) : Te(s1.CULL_FACE), O = P; +}, Ih = class extends wt { + constructor(t){ + super(t); } - function me(P) { - P !== Y && (q && s1.lineWidth(P), Y = P); + load(t, e, i, s) { + let n = this, r = new Jt(this.manager); + r.setResponseType("arraybuffer"), r.setPath(this.path), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(t, function(a) { + try { + let l = a.slice(0); + _n.getContext().decodeAudioData(l, function(u) { + e(u); + }).catch(o); + } catch (l) { + o(l); + } + }, i, s); + function o(a) { + s ? s(a) : console.error(a), n.manager.itemError(t); + } } - function ye(P, ce, ae) { - P ? (Ee(s1.POLYGON_OFFSET_FILL), ($ !== ce || U !== ae) && (s1.polygonOffset(ce, ae), $ = ce, U = ae)) : Te(s1.POLYGON_OFFSET_FILL); +}, Ch = new D, zh = new D, Ee = new D, Fh = class { + constructor(){ + this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new vt, this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new vt, this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = { + focus: null, + fov: null, + aspect: null, + near: null, + far: null, + zoom: null, + eyeSep: null + }; } - function Ne(P) { - P ? Ee(s1.SCISSOR_TEST) : Te(s1.SCISSOR_TEST); + update(t) { + let e = this._cache; + if (e.focus !== t.focus || e.fov !== t.fov || e.aspect !== t.aspect * this.aspect || e.near !== t.near || e.far !== t.far || e.zoom !== t.zoom || e.eyeSep !== this.eyeSep) { + e.focus = t.focus, e.fov = t.fov, e.aspect = t.aspect * this.aspect, e.near = t.near, e.far = t.far, e.zoom = t.zoom, e.eyeSep = this.eyeSep, Ee.copy(t.projectionMatrix); + let s = e.eyeSep / 2, n = s * e.near / e.focus, r = e.near * Math.tan(De * e.fov * .5) / e.zoom, o, a; + zh.elements[12] = -s, Ch.elements[12] = s, o = -r * e.aspect + n, a = r * e.aspect + n, Ee.elements[0] = 2 * e.near / (a - o), Ee.elements[8] = (a + o) / (a - o), this.cameraL.projectionMatrix.copy(Ee), o = -r * e.aspect - n, a = r * e.aspect - n, Ee.elements[0] = 2 * e.near / (a - o), Ee.elements[8] = (a + o) / (a - o), this.cameraR.projectionMatrix.copy(Ee); + } + this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(zh), this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Ch); } - function qe(P) { - P === void 0 && (P = s1.TEXTURE0 + z - 1), W !== P && (s1.activeTexture(P), W = P); +}, Bh = class extends vt { + constructor(t = []){ + super(), this.isArrayCamera = !0, this.cameras = t, this.index = 0; } - function rt(P, ce, ae) { - ae === void 0 && (W === null ? ae = s1.TEXTURE0 + z - 1 : ae = W); - let ge = K[ae]; - ge === void 0 && (ge = { - type: void 0, - texture: void 0 - }, K[ae] = ge), (ge.type !== P || ge.texture !== ce) && (W !== ae && (s1.activeTexture(ae), W = ae), s1.bindTexture(P, ce || we[P]), ge.type = P, ge.texture = ce); +}, Ro = class { + constructor(t = !0){ + this.autoStart = t, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1; } - function C() { - let P = K[W]; - P !== void 0 && P.type !== void 0 && (s1.bindTexture(P.type, null), P.type = void 0, P.texture = void 0); + start() { + this.startTime = Eh(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0; } - function S() { - try { - s1.compressedTexImage2D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + stop() { + this.getElapsedTime(), this.running = !1, this.autoStart = !1; } - function B() { - try { - s1.compressedTexImage3D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + getElapsedTime() { + return this.getDelta(), this.elapsedTime; } - function ee() { - try { - s1.texSubImage2D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); + getDelta() { + let t = 0; + if (this.autoStart && !this.running) return this.start(), 0; + if (this.running) { + let e = Eh(); + t = (e - this.oldTime) / 1e3, this.oldTime = e, this.elapsedTime += t; } + return t; } - function j() { - try { - s1.texSubImage3D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } +}; +function Eh() { + return performance.now(); +} +var Re = new w, Rh = new bt, Md = new w, ke = new w, kh = class extends G { + constructor(){ + super(), this.type = "AudioListener", this.context = _n.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new Ro; } - function te() { - try { - s1.compressedTexSubImage2D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + getInput() { + return this.gain; } - function Me() { - try { - s1.compressedTexSubImage3D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + removeFilter() { + return this.filter !== null && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this; } - function re() { - try { - s1.texStorage2D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + getFilter() { + return this.filter; } - function de() { - try { - s1.texStorage3D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + setFilter(t) { + return this.filter !== null ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = t, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this; } - function Le() { - try { - s1.texImage2D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + getMasterVolume() { + return this.gain.gain.value; } - function Ze() { - try { - s1.texImage3D.apply(s1, arguments); - } catch (P) { - console.error("THREE.WebGLState:", P); - } + setMasterVolume(t) { + return this.gain.gain.setTargetAtTime(t, this.context.currentTime, .01), this; } - function se(P) { - he.equals(P) === !1 && (s1.scissor(P.x, P.y, P.z, P.w), he.copy(P)); + updateMatrixWorld(t) { + super.updateMatrixWorld(t); + let e = this.context.listener, i = this.up; + if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(Re, Rh, Md), ke.set(0, 0, -1).applyQuaternion(Rh), e.positionX) { + let s = this.context.currentTime + this.timeDelta; + e.positionX.linearRampToValueAtTime(Re.x, s), e.positionY.linearRampToValueAtTime(Re.y, s), e.positionZ.linearRampToValueAtTime(Re.z, s), e.forwardX.linearRampToValueAtTime(ke.x, s), e.forwardY.linearRampToValueAtTime(ke.y, s), e.forwardZ.linearRampToValueAtTime(ke.z, s), e.upX.linearRampToValueAtTime(i.x, s), e.upY.linearRampToValueAtTime(i.y, s), e.upZ.linearRampToValueAtTime(i.z, s); + } else e.setPosition(Re.x, Re.y, Re.z), e.setOrientation(ke.x, ke.y, ke.z, i.x, i.y, i.z); } - function $e(P) { - fe.equals(P) === !1 && (s1.viewport(P.x, P.y, P.z, P.w), fe.copy(P)); +}, ko = class extends G { + constructor(t){ + super(), this.type = "Audio", this.listener = t, this.context = t.context, this.gain = this.context.createGain(), this.gain.connect(t.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = !1, this.filters = []; } - function Oe(P, ce) { - let ae = u.get(ce); - ae === void 0 && (ae = new WeakMap, u.set(ce, ae)); - let ge = ae.get(P); - ge === void 0 && (ge = s1.getUniformBlockIndex(ce, P.name), ae.set(P, ge)); + getOutput() { + return this.gain; } - function Ie(P, ce) { - let ge = u.get(ce).get(P); - h.get(ce) !== ge && (s1.uniformBlockBinding(ce, ge, P.__bindingPointIndex), h.set(ce, ge)); + setNodeSource(t) { + return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = t, this.connect(), this; } - function Re() { - s1.disable(s1.BLEND), s1.disable(s1.CULL_FACE), s1.disable(s1.DEPTH_TEST), s1.disable(s1.POLYGON_OFFSET_FILL), s1.disable(s1.SCISSOR_TEST), s1.disable(s1.STENCIL_TEST), s1.disable(s1.SAMPLE_ALPHA_TO_COVERAGE), s1.blendEquation(s1.FUNC_ADD), s1.blendFunc(s1.ONE, s1.ZERO), s1.blendFuncSeparate(s1.ONE, s1.ZERO, s1.ONE, s1.ZERO), s1.colorMask(!0, !0, !0, !0), s1.clearColor(0, 0, 0, 0), s1.depthMask(!0), s1.depthFunc(s1.LESS), s1.clearDepth(1), s1.stencilMask(4294967295), s1.stencilFunc(s1.ALWAYS, 0, 4294967295), s1.stencilOp(s1.KEEP, s1.KEEP, s1.KEEP), s1.clearStencil(0), s1.cullFace(s1.BACK), s1.frontFace(s1.CCW), s1.polygonOffset(0, 0), s1.activeTexture(s1.TEXTURE0), s1.bindFramebuffer(s1.FRAMEBUFFER, null), n === !0 && (s1.bindFramebuffer(s1.DRAW_FRAMEBUFFER, null), s1.bindFramebuffer(s1.READ_FRAMEBUFFER, null)), s1.useProgram(null), s1.lineWidth(1), s1.scissor(0, 0, s1.canvas.width, s1.canvas.height), s1.viewport(0, 0, s1.canvas.width, s1.canvas.height), d = {}, W = null, K = {}, f = {}, m = new WeakMap, _ = [], g = null, p = !1, v = null, x1 = null, y1 = null, b = null, w = null, R = null, I = null, M = !1, T = null, O = null, Y = null, $ = null, U = null, he.set(0, 0, s1.canvas.width, s1.canvas.height), fe.set(0, 0, s1.canvas.width, s1.canvas.height), o.reset(), c.reset(), l.reset(); + setMediaElementSource(t) { + return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(t), this.connect(), this; } - return { - buffers: { - color: o, - depth: c, - stencil: l - }, - enable: Ee, - disable: Te, - bindFramebuffer: Ye, - drawBuffers: it, - useProgram: Ce, - setBlending: X, - setMaterial: ie, - setFlipSided: J, - setCullFace: Se, - setLineWidth: me, - setPolygonOffset: ye, - setScissorTest: Ne, - activeTexture: qe, - bindTexture: rt, - unbindTexture: C, - compressedTexImage2D: S, - compressedTexImage3D: B, - texImage2D: Le, - texImage3D: Ze, - updateUBOMapping: Oe, - uniformBlockBinding: Ie, - texStorage2D: re, - texStorage3D: de, - texSubImage2D: ee, - texSubImage3D: j, - compressedTexSubImage2D: te, - compressedTexSubImage3D: Me, - scissor: se, - viewport: $e, - reset: Re - }; -} -function z0(s1, e, t, n, i, r, a) { - let o = i.isWebGL2, c = i.maxTextures, l = i.maxCubemapSize, h = i.maxTextureSize, u = i.maxSamples, d = e.has("WEBGL_multisampled_render_to_texture") ? e.get("WEBGL_multisampled_render_to_texture") : null, f = typeof navigator > "u" ? !1 : /OculusBrowser/g.test(navigator.userAgent), m = new WeakMap, _, g = new WeakMap, p = !1; - try { - p = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null; - } catch {} - function v(C, S) { - return p ? new OffscreenCanvas(C, S) : ws("canvas"); - } - function x1(C, S, B, ee) { - let j = 1; - if ((C.width > ee || C.height > ee) && (j = ee / Math.max(C.width, C.height)), j < 1 || S === !0) if (typeof HTMLImageElement < "u" && C instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && C instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && C instanceof ImageBitmap) { - let te = S ? Wr : Math.floor, Me = te(j * C.width), re = te(j * C.height); - _ === void 0 && (_ = v(Me, re)); - let de = B ? v(Me, re) : _; - return de.width = Me, de.height = re, de.getContext("2d").drawImage(C, 0, 0, Me, re), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + C.width + "x" + C.height + ") to (" + Me + "x" + re + ")."), de; - } else return "data" in C && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + C.width + "x" + C.height + ")."), C; - return C; - } - function y1(C) { - return mo(C.width) && mo(C.height); - } - function b(C) { - return o ? !1 : C.wrapS !== It || C.wrapT !== It || C.minFilter !== pt && C.minFilter !== mt; - } - function w(C, S) { - return C.generateMipmaps && S && C.minFilter !== pt && C.minFilter !== mt; - } - function R(C) { - s1.generateMipmap(C); - } - function I(C, S, B, ee, j = !1) { - if (o === !1) return S; - if (C !== null) { - if (s1[C] !== void 0) return s1[C]; - console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + C + "'"); - } - let te = S; - if (S === s1.RED && (B === s1.FLOAT && (te = s1.R32F), B === s1.HALF_FLOAT && (te = s1.R16F), B === s1.UNSIGNED_BYTE && (te = s1.R8)), S === s1.RED_INTEGER && (B === s1.UNSIGNED_BYTE && (te = s1.R8UI), B === s1.UNSIGNED_SHORT && (te = s1.R16UI), B === s1.UNSIGNED_INT && (te = s1.R32UI), B === s1.BYTE && (te = s1.R8I), B === s1.SHORT && (te = s1.R16I), B === s1.INT && (te = s1.R32I)), S === s1.RG && (B === s1.FLOAT && (te = s1.RG32F), B === s1.HALF_FLOAT && (te = s1.RG16F), B === s1.UNSIGNED_BYTE && (te = s1.RG8)), S === s1.RGBA) { - let Me = j ? zr : Qe.getTransfer(ee); - B === s1.FLOAT && (te = s1.RGBA32F), B === s1.HALF_FLOAT && (te = s1.RGBA16F), B === s1.UNSIGNED_BYTE && (te = Me === nt ? s1.SRGB8_ALPHA8 : s1.RGBA8), B === s1.UNSIGNED_SHORT_4_4_4_4 && (te = s1.RGBA4), B === s1.UNSIGNED_SHORT_5_5_5_1 && (te = s1.RGB5_A1); - } - return (te === s1.R16F || te === s1.R32F || te === s1.RG16F || te === s1.RG32F || te === s1.RGBA16F || te === s1.RGBA32F) && e.get("EXT_color_buffer_float"), te; - } - function M(C, S, B) { - return w(C, B) === !0 || C.isFramebufferTexture && C.minFilter !== pt && C.minFilter !== mt ? Math.log2(Math.max(S.width, S.height)) + 1 : C.mipmaps !== void 0 && C.mipmaps.length > 0 ? C.mipmaps.length : C.isCompressedTexture && Array.isArray(C.image) ? S.mipmaps.length : 1; - } - function T(C) { - return C === pt || C === fo || C === Lr ? s1.NEAREST : s1.LINEAR; - } - function O(C) { - let S = C.target; - S.removeEventListener("dispose", O), $(S), S.isVideoTexture && m.delete(S); - } - function Y(C) { - let S = C.target; - S.removeEventListener("dispose", Y), z(S); - } - function $(C) { - let S = n.get(C); - if (S.__webglInit === void 0) return; - let B = C.source, ee = g.get(B); - if (ee) { - let j = ee[S.__cacheKey]; - j.usedTimes--, j.usedTimes === 0 && U(C), Object.keys(ee).length === 0 && g.delete(B); - } - n.remove(C); - } - function U(C) { - let S = n.get(C); - s1.deleteTexture(S.__webglTexture); - let B = C.source, ee = g.get(B); - delete ee[S.__cacheKey], a.memory.textures--; - } - function z(C) { - let S = C.texture, B = n.get(C), ee = n.get(S); - if (ee.__webglTexture !== void 0 && (s1.deleteTexture(ee.__webglTexture), a.memory.textures--), C.depthTexture && C.depthTexture.dispose(), C.isWebGLCubeRenderTarget) for(let j = 0; j < 6; j++){ - if (Array.isArray(B.__webglFramebuffer[j])) for(let te = 0; te < B.__webglFramebuffer[j].length; te++)s1.deleteFramebuffer(B.__webglFramebuffer[j][te]); - else s1.deleteFramebuffer(B.__webglFramebuffer[j]); - B.__webglDepthbuffer && s1.deleteRenderbuffer(B.__webglDepthbuffer[j]); - } - else { - if (Array.isArray(B.__webglFramebuffer)) for(let j = 0; j < B.__webglFramebuffer.length; j++)s1.deleteFramebuffer(B.__webglFramebuffer[j]); - else s1.deleteFramebuffer(B.__webglFramebuffer); - if (B.__webglDepthbuffer && s1.deleteRenderbuffer(B.__webglDepthbuffer), B.__webglMultisampledFramebuffer && s1.deleteFramebuffer(B.__webglMultisampledFramebuffer), B.__webglColorRenderbuffer) for(let j = 0; j < B.__webglColorRenderbuffer.length; j++)B.__webglColorRenderbuffer[j] && s1.deleteRenderbuffer(B.__webglColorRenderbuffer[j]); - B.__webglDepthRenderbuffer && s1.deleteRenderbuffer(B.__webglDepthRenderbuffer); - } - if (C.isWebGLMultipleRenderTargets) for(let j = 0, te = S.length; j < te; j++){ - let Me = n.get(S[j]); - Me.__webglTexture && (s1.deleteTexture(Me.__webglTexture), a.memory.textures--), n.remove(S[j]); - } - n.remove(S), n.remove(C); + setMediaStreamSource(t) { + return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(t), this.connect(), this; } - let q = 0; - function H() { - q = 0; - } - function ne() { - let C = q; - return C >= c && console.warn("THREE.WebGLTextures: Trying to use " + C + " texture units while this GPU supports only " + c), q += 1, C; - } - function W(C) { - let S = []; - return S.push(C.wrapS), S.push(C.wrapT), S.push(C.wrapR || 0), S.push(C.magFilter), S.push(C.minFilter), S.push(C.anisotropy), S.push(C.internalFormat), S.push(C.format), S.push(C.type), S.push(C.generateMipmaps), S.push(C.premultiplyAlpha), S.push(C.flipY), S.push(C.unpackAlignment), S.push(C.colorSpace), S.join(); - } - function K(C, S) { - let B = n.get(C); - if (C.isVideoTexture && qe(C), C.isRenderTargetTexture === !1 && C.version > 0 && B.__version !== C.version) { - let ee = C.image; - if (ee === null) console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found."); - else if (ee.complete === !1) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); - else { - Ye(B, C, S); - return; - } - } - t.bindTexture(s1.TEXTURE_2D, B.__webglTexture, s1.TEXTURE0 + S); + setBuffer(t) { + return this.buffer = t, this.sourceType = "buffer", this.autoplay && this.play(), this; } - function D(C, S) { - let B = n.get(C); - if (C.version > 0 && B.__version !== C.version) { - Ye(B, C, S); + play(t = 0) { + if (this.isPlaying === !0) { + console.warn("THREE.Audio: Audio is already playing."); return; } - t.bindTexture(s1.TEXTURE_2D_ARRAY, B.__webglTexture, s1.TEXTURE0 + S); - } - function G(C, S) { - let B = n.get(C); - if (C.version > 0 && B.__version !== C.version) { - Ye(B, C, S); + if (this.hasPlaybackControl === !1) { + console.warn("THREE.Audio: this Audio has no playback control."); return; } - t.bindTexture(s1.TEXTURE_3D, B.__webglTexture, s1.TEXTURE0 + S); + this._startedAt = this.context.currentTime + t; + let e = this.context.createBufferSource(); + return e.buffer = this.buffer, e.loop = this.loop, e.loopStart = this.loopStart, e.loopEnd = this.loopEnd, e.onended = this.onEnded.bind(this), e.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = e, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect(); } - function he(C, S) { - let B = n.get(C); - if (C.version > 0 && B.__version !== C.version) { - it(B, C, S); + pause() { + if (this.hasPlaybackControl === !1) { + console.warn("THREE.Audio: this Audio has no playback control."); return; } - t.bindTexture(s1.TEXTURE_CUBE_MAP, B.__webglTexture, s1.TEXTURE0 + S); - } - let fe = { - [Dr]: s1.REPEAT, - [It]: s1.CLAMP_TO_EDGE, - [Nr]: s1.MIRRORED_REPEAT - }, _e = { - [pt]: s1.NEAREST, - [fo]: s1.NEAREST_MIPMAP_NEAREST, - [Lr]: s1.NEAREST_MIPMAP_LINEAR, - [mt]: s1.LINEAR, - [ud]: s1.LINEAR_MIPMAP_NEAREST, - [li]: s1.LINEAR_MIPMAP_LINEAR - }, we = { - [Uf]: s1.NEVER, - [Vf]: s1.ALWAYS, - [Df]: s1.LESS, - [Of]: s1.LEQUAL, - [Nf]: s1.EQUAL, - [zf]: s1.GEQUAL, - [Ff]: s1.GREATER, - [Bf]: s1.NOTEQUAL - }; - function Ee(C, S, B) { - if (B ? (s1.texParameteri(C, s1.TEXTURE_WRAP_S, fe[S.wrapS]), s1.texParameteri(C, s1.TEXTURE_WRAP_T, fe[S.wrapT]), (C === s1.TEXTURE_3D || C === s1.TEXTURE_2D_ARRAY) && s1.texParameteri(C, s1.TEXTURE_WRAP_R, fe[S.wrapR]), s1.texParameteri(C, s1.TEXTURE_MAG_FILTER, _e[S.magFilter]), s1.texParameteri(C, s1.TEXTURE_MIN_FILTER, _e[S.minFilter])) : (s1.texParameteri(C, s1.TEXTURE_WRAP_S, s1.CLAMP_TO_EDGE), s1.texParameteri(C, s1.TEXTURE_WRAP_T, s1.CLAMP_TO_EDGE), (C === s1.TEXTURE_3D || C === s1.TEXTURE_2D_ARRAY) && s1.texParameteri(C, s1.TEXTURE_WRAP_R, s1.CLAMP_TO_EDGE), (S.wrapS !== It || S.wrapT !== It) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), s1.texParameteri(C, s1.TEXTURE_MAG_FILTER, T(S.magFilter)), s1.texParameteri(C, s1.TEXTURE_MIN_FILTER, T(S.minFilter)), S.minFilter !== pt && S.minFilter !== mt && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")), S.compareFunction && (s1.texParameteri(C, s1.TEXTURE_COMPARE_MODE, s1.COMPARE_REF_TO_TEXTURE), s1.texParameteri(C, s1.TEXTURE_COMPARE_FUNC, we[S.compareFunction])), e.has("EXT_texture_filter_anisotropic") === !0) { - let ee = e.get("EXT_texture_filter_anisotropic"); - if (S.magFilter === pt || S.minFilter !== Lr && S.minFilter !== li || S.type === xn && e.has("OES_texture_float_linear") === !1 || o === !1 && S.type === Ts && e.has("OES_texture_half_float_linear") === !1) return; - (S.anisotropy > 1 || n.get(S).__currentAnisotropy) && (s1.texParameterf(C, ee.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(S.anisotropy, i.getMaxAnisotropy())), n.get(S).__currentAnisotropy = S.anisotropy); - } - } - function Te(C, S) { - let B = !1; - C.__webglInit === void 0 && (C.__webglInit = !0, S.addEventListener("dispose", O)); - let ee = S.source, j = g.get(ee); - j === void 0 && (j = {}, g.set(ee, j)); - let te = W(S); - if (te !== C.__cacheKey) { - j[te] === void 0 && (j[te] = { - texture: s1.createTexture(), - usedTimes: 0 - }, a.memory.textures++, B = !0), j[te].usedTimes++; - let Me = j[C.__cacheKey]; - Me !== void 0 && (j[C.__cacheKey].usedTimes--, Me.usedTimes === 0 && U(S)), C.__cacheKey = te, C.__webglTexture = j[te].texture; - } - return B; - } - function Ye(C, S, B) { - let ee = s1.TEXTURE_2D; - (S.isDataArrayTexture || S.isCompressedArrayTexture) && (ee = s1.TEXTURE_2D_ARRAY), S.isData3DTexture && (ee = s1.TEXTURE_3D); - let j = Te(C, S), te = S.source; - t.bindTexture(ee, C.__webglTexture, s1.TEXTURE0 + B); - let Me = n.get(te); - if (te.version !== Me.__version || j === !0) { - t.activeTexture(s1.TEXTURE0 + B); - let re = Qe.getPrimaries(Qe.workingColorSpace), de = S.colorSpace === Xt ? null : Qe.getPrimaries(S.colorSpace), Le = S.colorSpace === Xt || re === de ? s1.NONE : s1.BROWSER_DEFAULT_WEBGL; - s1.pixelStorei(s1.UNPACK_FLIP_Y_WEBGL, S.flipY), s1.pixelStorei(s1.UNPACK_PREMULTIPLY_ALPHA_WEBGL, S.premultiplyAlpha), s1.pixelStorei(s1.UNPACK_ALIGNMENT, S.unpackAlignment), s1.pixelStorei(s1.UNPACK_COLORSPACE_CONVERSION_WEBGL, Le); - let Ze = b(S) && y1(S.image) === !1, se = x1(S.image, Ze, !1, h); - se = rt(S, se); - let $e = y1(se) || o, Oe = r.convert(S.format, S.colorSpace), Ie = r.convert(S.type), Re = I(S.internalFormat, Oe, Ie, S.colorSpace, S.isVideoTexture); - Ee(ee, S, $e); - let P, ce = S.mipmaps, ae = o && S.isVideoTexture !== !0, ge = Me.__version === void 0 || j === !0, ue = M(S, se, $e); - if (S.isDepthTexture) Re = s1.DEPTH_COMPONENT, o ? S.type === xn ? Re = s1.DEPTH_COMPONENT32F : S.type === Ln ? Re = s1.DEPTH_COMPONENT24 : S.type === ii ? Re = s1.DEPTH24_STENCIL8 : Re = s1.DEPTH_COMPONENT16 : S.type === xn && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), S.format === si && Re === s1.DEPTH_COMPONENT && S.type !== Wc && S.type !== Ln && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), S.type = Ln, Ie = r.convert(S.type)), S.format === Yi && Re === s1.DEPTH_COMPONENT && (Re = s1.DEPTH_STENCIL, S.type !== ii && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), S.type = ii, Ie = r.convert(S.type))), ge && (ae ? t.texStorage2D(s1.TEXTURE_2D, 1, Re, se.width, se.height) : t.texImage2D(s1.TEXTURE_2D, 0, Re, se.width, se.height, 0, Oe, Ie, null)); - else if (S.isDataTexture) if (ce.length > 0 && $e) { - ae && ge && t.texStorage2D(s1.TEXTURE_2D, ue, Re, ce[0].width, ce[0].height); - for(let Q = 0, be = ce.length; Q < be; Q++)P = ce[Q], ae ? t.texSubImage2D(s1.TEXTURE_2D, Q, 0, 0, P.width, P.height, Oe, Ie, P.data) : t.texImage2D(s1.TEXTURE_2D, Q, Re, P.width, P.height, 0, Oe, Ie, P.data); - S.generateMipmaps = !1; - } else ae ? (ge && t.texStorage2D(s1.TEXTURE_2D, ue, Re, se.width, se.height), t.texSubImage2D(s1.TEXTURE_2D, 0, 0, 0, se.width, se.height, Oe, Ie, se.data)) : t.texImage2D(s1.TEXTURE_2D, 0, Re, se.width, se.height, 0, Oe, Ie, se.data); - else if (S.isCompressedTexture) if (S.isCompressedArrayTexture) { - ae && ge && t.texStorage3D(s1.TEXTURE_2D_ARRAY, ue, Re, ce[0].width, ce[0].height, se.depth); - for(let Q = 0, be = ce.length; Q < be; Q++)P = ce[Q], S.format !== Wt ? Oe !== null ? ae ? t.compressedTexSubImage3D(s1.TEXTURE_2D_ARRAY, Q, 0, 0, 0, P.width, P.height, se.depth, Oe, P.data, 0, 0) : t.compressedTexImage3D(s1.TEXTURE_2D_ARRAY, Q, Re, P.width, P.height, se.depth, 0, P.data, 0, 0) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : ae ? t.texSubImage3D(s1.TEXTURE_2D_ARRAY, Q, 0, 0, 0, P.width, P.height, se.depth, Oe, Ie, P.data) : t.texImage3D(s1.TEXTURE_2D_ARRAY, Q, Re, P.width, P.height, se.depth, 0, Oe, Ie, P.data); - } else { - ae && ge && t.texStorage2D(s1.TEXTURE_2D, ue, Re, ce[0].width, ce[0].height); - for(let Q = 0, be = ce.length; Q < be; Q++)P = ce[Q], S.format !== Wt ? Oe !== null ? ae ? t.compressedTexSubImage2D(s1.TEXTURE_2D, Q, 0, 0, P.width, P.height, Oe, P.data) : t.compressedTexImage2D(s1.TEXTURE_2D, Q, Re, P.width, P.height, 0, P.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : ae ? t.texSubImage2D(s1.TEXTURE_2D, Q, 0, 0, P.width, P.height, Oe, Ie, P.data) : t.texImage2D(s1.TEXTURE_2D, Q, Re, P.width, P.height, 0, Oe, Ie, P.data); - } - else if (S.isDataArrayTexture) ae ? (ge && t.texStorage3D(s1.TEXTURE_2D_ARRAY, ue, Re, se.width, se.height, se.depth), t.texSubImage3D(s1.TEXTURE_2D_ARRAY, 0, 0, 0, 0, se.width, se.height, se.depth, Oe, Ie, se.data)) : t.texImage3D(s1.TEXTURE_2D_ARRAY, 0, Re, se.width, se.height, se.depth, 0, Oe, Ie, se.data); - else if (S.isData3DTexture) ae ? (ge && t.texStorage3D(s1.TEXTURE_3D, ue, Re, se.width, se.height, se.depth), t.texSubImage3D(s1.TEXTURE_3D, 0, 0, 0, 0, se.width, se.height, se.depth, Oe, Ie, se.data)) : t.texImage3D(s1.TEXTURE_3D, 0, Re, se.width, se.height, se.depth, 0, Oe, Ie, se.data); - else if (S.isFramebufferTexture) { - if (ge) if (ae) t.texStorage2D(s1.TEXTURE_2D, ue, Re, se.width, se.height); - else { - let Q = se.width, be = se.height; - for(let Fe = 0; Fe < ue; Fe++)t.texImage2D(s1.TEXTURE_2D, Fe, Re, Q, be, 0, Oe, Ie, null), Q >>= 1, be >>= 1; - } - } else if (ce.length > 0 && $e) { - ae && ge && t.texStorage2D(s1.TEXTURE_2D, ue, Re, ce[0].width, ce[0].height); - for(let Q = 0, be = ce.length; Q < be; Q++)P = ce[Q], ae ? t.texSubImage2D(s1.TEXTURE_2D, Q, 0, 0, Oe, Ie, P) : t.texImage2D(s1.TEXTURE_2D, Q, Re, Oe, Ie, P); - S.generateMipmaps = !1; - } else ae ? (ge && t.texStorage2D(s1.TEXTURE_2D, ue, Re, se.width, se.height), t.texSubImage2D(s1.TEXTURE_2D, 0, 0, 0, Oe, Ie, se)) : t.texImage2D(s1.TEXTURE_2D, 0, Re, Oe, Ie, se); - w(S, $e) && R(ee), Me.__version = te.version, S.onUpdate && S.onUpdate(S); - } - C.__version = S.version; - } - function it(C, S, B) { - if (S.image.length !== 6) return; - let ee = Te(C, S), j = S.source; - t.bindTexture(s1.TEXTURE_CUBE_MAP, C.__webglTexture, s1.TEXTURE0 + B); - let te = n.get(j); - if (j.version !== te.__version || ee === !0) { - t.activeTexture(s1.TEXTURE0 + B); - let Me = Qe.getPrimaries(Qe.workingColorSpace), re = S.colorSpace === Xt ? null : Qe.getPrimaries(S.colorSpace), de = S.colorSpace === Xt || Me === re ? s1.NONE : s1.BROWSER_DEFAULT_WEBGL; - s1.pixelStorei(s1.UNPACK_FLIP_Y_WEBGL, S.flipY), s1.pixelStorei(s1.UNPACK_PREMULTIPLY_ALPHA_WEBGL, S.premultiplyAlpha), s1.pixelStorei(s1.UNPACK_ALIGNMENT, S.unpackAlignment), s1.pixelStorei(s1.UNPACK_COLORSPACE_CONVERSION_WEBGL, de); - let Le = S.isCompressedTexture || S.image[0].isCompressedTexture, Ze = S.image[0] && S.image[0].isDataTexture, se = []; - for(let Q = 0; Q < 6; Q++)!Le && !Ze ? se[Q] = x1(S.image[Q], !1, !0, l) : se[Q] = Ze ? S.image[Q].image : S.image[Q], se[Q] = rt(S, se[Q]); - let $e = se[0], Oe = y1($e) || o, Ie = r.convert(S.format, S.colorSpace), Re = r.convert(S.type), P = I(S.internalFormat, Ie, Re, S.colorSpace), ce = o && S.isVideoTexture !== !0, ae = te.__version === void 0 || ee === !0, ge = M(S, $e, Oe); - Ee(s1.TEXTURE_CUBE_MAP, S, Oe); - let ue; - if (Le) { - ce && ae && t.texStorage2D(s1.TEXTURE_CUBE_MAP, ge, P, $e.width, $e.height); - for(let Q = 0; Q < 6; Q++){ - ue = se[Q].mipmaps; - for(let be = 0; be < ue.length; be++){ - let Fe = ue[be]; - S.format !== Wt ? Ie !== null ? ce ? t.compressedTexSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be, 0, 0, Fe.width, Fe.height, Ie, Fe.data) : t.compressedTexImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be, P, Fe.width, Fe.height, 0, Fe.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : ce ? t.texSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be, 0, 0, Fe.width, Fe.height, Ie, Re, Fe.data) : t.texImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be, P, Fe.width, Fe.height, 0, Ie, Re, Fe.data); - } - } - } else { - ue = S.mipmaps, ce && ae && (ue.length > 0 && ge++, t.texStorage2D(s1.TEXTURE_CUBE_MAP, ge, P, se[0].width, se[0].height)); - for(let Q = 0; Q < 6; Q++)if (Ze) { - ce ? t.texSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, 0, 0, 0, se[Q].width, se[Q].height, Ie, Re, se[Q].data) : t.texImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, 0, P, se[Q].width, se[Q].height, 0, Ie, Re, se[Q].data); - for(let be = 0; be < ue.length; be++){ - let At = ue[be].image[Q].image; - ce ? t.texSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be + 1, 0, 0, At.width, At.height, Ie, Re, At.data) : t.texImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be + 1, P, At.width, At.height, 0, Ie, Re, At.data); - } - } else { - ce ? t.texSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, 0, 0, 0, Ie, Re, se[Q]) : t.texImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, 0, P, Ie, Re, se[Q]); - for(let be = 0; be < ue.length; be++){ - let Fe = ue[be]; - ce ? t.texSubImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be + 1, 0, 0, Ie, Re, Fe.image[Q]) : t.texImage2D(s1.TEXTURE_CUBE_MAP_POSITIVE_X + Q, be + 1, P, Ie, Re, Fe.image[Q]); - } - } - } - w(S, Oe) && R(s1.TEXTURE_CUBE_MAP), te.__version = j.version, S.onUpdate && S.onUpdate(S); - } - C.__version = S.version; - } - function Ce(C, S, B, ee, j, te) { - let Me = r.convert(B.format, B.colorSpace), re = r.convert(B.type), de = I(B.internalFormat, Me, re, B.colorSpace); - if (!n.get(S).__hasExternalTextures) { - let Ze = Math.max(1, S.width >> te), se = Math.max(1, S.height >> te); - j === s1.TEXTURE_3D || j === s1.TEXTURE_2D_ARRAY ? t.texImage3D(j, te, de, Ze, se, S.depth, 0, Me, re, null) : t.texImage2D(j, te, de, Ze, se, 0, Me, re, null); - } - t.bindFramebuffer(s1.FRAMEBUFFER, C), Ne(S) ? d.framebufferTexture2DMultisampleEXT(s1.FRAMEBUFFER, ee, j, n.get(B).__webglTexture, 0, ye(S)) : (j === s1.TEXTURE_2D || j >= s1.TEXTURE_CUBE_MAP_POSITIVE_X && j <= s1.TEXTURE_CUBE_MAP_NEGATIVE_Z) && s1.framebufferTexture2D(s1.FRAMEBUFFER, ee, j, n.get(B).__webglTexture, te), t.bindFramebuffer(s1.FRAMEBUFFER, null); - } - function L(C, S, B) { - if (s1.bindRenderbuffer(s1.RENDERBUFFER, C), S.depthBuffer && !S.stencilBuffer) { - let ee = o === !0 ? s1.DEPTH_COMPONENT24 : s1.DEPTH_COMPONENT16; - if (B || Ne(S)) { - let j = S.depthTexture; - j && j.isDepthTexture && (j.type === xn ? ee = s1.DEPTH_COMPONENT32F : j.type === Ln && (ee = s1.DEPTH_COMPONENT24)); - let te = ye(S); - Ne(S) ? d.renderbufferStorageMultisampleEXT(s1.RENDERBUFFER, te, ee, S.width, S.height) : s1.renderbufferStorageMultisample(s1.RENDERBUFFER, te, ee, S.width, S.height); - } else s1.renderbufferStorage(s1.RENDERBUFFER, ee, S.width, S.height); - s1.framebufferRenderbuffer(s1.FRAMEBUFFER, s1.DEPTH_ATTACHMENT, s1.RENDERBUFFER, C); - } else if (S.depthBuffer && S.stencilBuffer) { - let ee = ye(S); - B && Ne(S) === !1 ? s1.renderbufferStorageMultisample(s1.RENDERBUFFER, ee, s1.DEPTH24_STENCIL8, S.width, S.height) : Ne(S) ? d.renderbufferStorageMultisampleEXT(s1.RENDERBUFFER, ee, s1.DEPTH24_STENCIL8, S.width, S.height) : s1.renderbufferStorage(s1.RENDERBUFFER, s1.DEPTH_STENCIL, S.width, S.height), s1.framebufferRenderbuffer(s1.FRAMEBUFFER, s1.DEPTH_STENCIL_ATTACHMENT, s1.RENDERBUFFER, C); - } else { - let ee = S.isWebGLMultipleRenderTargets === !0 ? S.texture : [ - S.texture - ]; - for(let j = 0; j < ee.length; j++){ - let te = ee[j], Me = r.convert(te.format, te.colorSpace), re = r.convert(te.type), de = I(te.internalFormat, Me, re, te.colorSpace), Le = ye(S); - B && Ne(S) === !1 ? s1.renderbufferStorageMultisample(s1.RENDERBUFFER, Le, de, S.width, S.height) : Ne(S) ? d.renderbufferStorageMultisampleEXT(s1.RENDERBUFFER, Le, de, S.width, S.height) : s1.renderbufferStorage(s1.RENDERBUFFER, de, S.width, S.height); - } - } - s1.bindRenderbuffer(s1.RENDERBUFFER, null); - } - function oe(C, S) { - if (S && S.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); - if (t.bindFramebuffer(s1.FRAMEBUFFER, C), !(S.depthTexture && S.depthTexture.isDepthTexture)) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); - (!n.get(S.depthTexture).__webglTexture || S.depthTexture.image.width !== S.width || S.depthTexture.image.height !== S.height) && (S.depthTexture.image.width = S.width, S.depthTexture.image.height = S.height, S.depthTexture.needsUpdate = !0), K(S.depthTexture, 0); - let ee = n.get(S.depthTexture).__webglTexture, j = ye(S); - if (S.depthTexture.format === si) Ne(S) ? d.framebufferTexture2DMultisampleEXT(s1.FRAMEBUFFER, s1.DEPTH_ATTACHMENT, s1.TEXTURE_2D, ee, 0, j) : s1.framebufferTexture2D(s1.FRAMEBUFFER, s1.DEPTH_ATTACHMENT, s1.TEXTURE_2D, ee, 0); - else if (S.depthTexture.format === Yi) Ne(S) ? d.framebufferTexture2DMultisampleEXT(s1.FRAMEBUFFER, s1.DEPTH_STENCIL_ATTACHMENT, s1.TEXTURE_2D, ee, 0, j) : s1.framebufferTexture2D(s1.FRAMEBUFFER, s1.DEPTH_STENCIL_ATTACHMENT, s1.TEXTURE_2D, ee, 0); - else throw new Error("Unknown depthTexture format"); + return this.isPlaying === !0 && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === !0 && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this; } - function X(C) { - let S = n.get(C), B = C.isWebGLCubeRenderTarget === !0; - if (C.depthTexture && !S.__autoAllocateDepthBuffer) { - if (B) throw new Error("target.depthTexture not supported in Cube render targets"); - oe(S.__webglFramebuffer, C); - } else if (B) { - S.__webglDepthbuffer = []; - for(let ee = 0; ee < 6; ee++)t.bindFramebuffer(s1.FRAMEBUFFER, S.__webglFramebuffer[ee]), S.__webglDepthbuffer[ee] = s1.createRenderbuffer(), L(S.__webglDepthbuffer[ee], C, !1); - } else t.bindFramebuffer(s1.FRAMEBUFFER, S.__webglFramebuffer), S.__webglDepthbuffer = s1.createRenderbuffer(), L(S.__webglDepthbuffer, C, !1); - t.bindFramebuffer(s1.FRAMEBUFFER, null); - } - function ie(C, S, B) { - let ee = n.get(C); - S !== void 0 && Ce(ee.__webglFramebuffer, C, C.texture, s1.COLOR_ATTACHMENT0, s1.TEXTURE_2D, 0), B !== void 0 && X(C); - } - function J(C) { - let S = C.texture, B = n.get(C), ee = n.get(S); - C.addEventListener("dispose", Y), C.isWebGLMultipleRenderTargets !== !0 && (ee.__webglTexture === void 0 && (ee.__webglTexture = s1.createTexture()), ee.__version = S.version, a.memory.textures++); - let j = C.isWebGLCubeRenderTarget === !0, te = C.isWebGLMultipleRenderTargets === !0, Me = y1(C) || o; - if (j) { - B.__webglFramebuffer = []; - for(let re = 0; re < 6; re++)if (o && S.mipmaps && S.mipmaps.length > 0) { - B.__webglFramebuffer[re] = []; - for(let de = 0; de < S.mipmaps.length; de++)B.__webglFramebuffer[re][de] = s1.createFramebuffer(); - } else B.__webglFramebuffer[re] = s1.createFramebuffer(); - } else { - if (o && S.mipmaps && S.mipmaps.length > 0) { - B.__webglFramebuffer = []; - for(let re = 0; re < S.mipmaps.length; re++)B.__webglFramebuffer[re] = s1.createFramebuffer(); - } else B.__webglFramebuffer = s1.createFramebuffer(); - if (te) if (i.drawBuffers) { - let re = C.texture; - for(let de = 0, Le = re.length; de < Le; de++){ - let Ze = n.get(re[de]); - Ze.__webglTexture === void 0 && (Ze.__webglTexture = s1.createTexture(), a.memory.textures++); - } - } else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension."); - if (o && C.samples > 0 && Ne(C) === !1) { - let re = te ? S : [ - S - ]; - B.__webglMultisampledFramebuffer = s1.createFramebuffer(), B.__webglColorRenderbuffer = [], t.bindFramebuffer(s1.FRAMEBUFFER, B.__webglMultisampledFramebuffer); - for(let de = 0; de < re.length; de++){ - let Le = re[de]; - B.__webglColorRenderbuffer[de] = s1.createRenderbuffer(), s1.bindRenderbuffer(s1.RENDERBUFFER, B.__webglColorRenderbuffer[de]); - let Ze = r.convert(Le.format, Le.colorSpace), se = r.convert(Le.type), $e = I(Le.internalFormat, Ze, se, Le.colorSpace, C.isXRRenderTarget === !0), Oe = ye(C); - s1.renderbufferStorageMultisample(s1.RENDERBUFFER, Oe, $e, C.width, C.height), s1.framebufferRenderbuffer(s1.FRAMEBUFFER, s1.COLOR_ATTACHMENT0 + de, s1.RENDERBUFFER, B.__webglColorRenderbuffer[de]); - } - s1.bindRenderbuffer(s1.RENDERBUFFER, null), C.depthBuffer && (B.__webglDepthRenderbuffer = s1.createRenderbuffer(), L(B.__webglDepthRenderbuffer, C, !0)), t.bindFramebuffer(s1.FRAMEBUFFER, null); - } - } - if (j) { - t.bindTexture(s1.TEXTURE_CUBE_MAP, ee.__webglTexture), Ee(s1.TEXTURE_CUBE_MAP, S, Me); - for(let re = 0; re < 6; re++)if (o && S.mipmaps && S.mipmaps.length > 0) for(let de = 0; de < S.mipmaps.length; de++)Ce(B.__webglFramebuffer[re][de], C, S, s1.COLOR_ATTACHMENT0, s1.TEXTURE_CUBE_MAP_POSITIVE_X + re, de); - else Ce(B.__webglFramebuffer[re], C, S, s1.COLOR_ATTACHMENT0, s1.TEXTURE_CUBE_MAP_POSITIVE_X + re, 0); - w(S, Me) && R(s1.TEXTURE_CUBE_MAP), t.unbindTexture(); - } else if (te) { - let re = C.texture; - for(let de = 0, Le = re.length; de < Le; de++){ - let Ze = re[de], se = n.get(Ze); - t.bindTexture(s1.TEXTURE_2D, se.__webglTexture), Ee(s1.TEXTURE_2D, Ze, Me), Ce(B.__webglFramebuffer, C, Ze, s1.COLOR_ATTACHMENT0 + de, s1.TEXTURE_2D, 0), w(Ze, Me) && R(s1.TEXTURE_2D); - } - t.unbindTexture(); - } else { - let re = s1.TEXTURE_2D; - if ((C.isWebGL3DRenderTarget || C.isWebGLArrayRenderTarget) && (o ? re = C.isWebGL3DRenderTarget ? s1.TEXTURE_3D : s1.TEXTURE_2D_ARRAY : console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")), t.bindTexture(re, ee.__webglTexture), Ee(re, S, Me), o && S.mipmaps && S.mipmaps.length > 0) for(let de = 0; de < S.mipmaps.length; de++)Ce(B.__webglFramebuffer[de], C, S, s1.COLOR_ATTACHMENT0, re, de); - else Ce(B.__webglFramebuffer, C, S, s1.COLOR_ATTACHMENT0, re, 0); - w(S, Me) && R(re), t.unbindTexture(); + stop(t = 0) { + if (this.hasPlaybackControl === !1) { + console.warn("THREE.Audio: this Audio has no playback control."); + return; } - C.depthBuffer && X(C); - } - function Se(C) { - let S = y1(C) || o, B = C.isWebGLMultipleRenderTargets === !0 ? C.texture : [ - C.texture - ]; - for(let ee = 0, j = B.length; ee < j; ee++){ - let te = B[ee]; - if (w(te, S)) { - let Me = C.isWebGLCubeRenderTarget ? s1.TEXTURE_CUBE_MAP : s1.TEXTURE_2D, re = n.get(te).__webglTexture; - t.bindTexture(Me, re), R(Me), t.unbindTexture(); - } - } - } - function me(C) { - if (o && C.samples > 0 && Ne(C) === !1) { - let S = C.isWebGLMultipleRenderTargets ? C.texture : [ - C.texture - ], B = C.width, ee = C.height, j = s1.COLOR_BUFFER_BIT, te = [], Me = C.stencilBuffer ? s1.DEPTH_STENCIL_ATTACHMENT : s1.DEPTH_ATTACHMENT, re = n.get(C), de = C.isWebGLMultipleRenderTargets === !0; - if (de) for(let Le = 0; Le < S.length; Le++)t.bindFramebuffer(s1.FRAMEBUFFER, re.__webglMultisampledFramebuffer), s1.framebufferRenderbuffer(s1.FRAMEBUFFER, s1.COLOR_ATTACHMENT0 + Le, s1.RENDERBUFFER, null), t.bindFramebuffer(s1.FRAMEBUFFER, re.__webglFramebuffer), s1.framebufferTexture2D(s1.DRAW_FRAMEBUFFER, s1.COLOR_ATTACHMENT0 + Le, s1.TEXTURE_2D, null, 0); - t.bindFramebuffer(s1.READ_FRAMEBUFFER, re.__webglMultisampledFramebuffer), t.bindFramebuffer(s1.DRAW_FRAMEBUFFER, re.__webglFramebuffer); - for(let Le = 0; Le < S.length; Le++){ - te.push(s1.COLOR_ATTACHMENT0 + Le), C.depthBuffer && te.push(Me); - let Ze = re.__ignoreDepthValues !== void 0 ? re.__ignoreDepthValues : !1; - if (Ze === !1 && (C.depthBuffer && (j |= s1.DEPTH_BUFFER_BIT), C.stencilBuffer && (j |= s1.STENCIL_BUFFER_BIT)), de && s1.framebufferRenderbuffer(s1.READ_FRAMEBUFFER, s1.COLOR_ATTACHMENT0, s1.RENDERBUFFER, re.__webglColorRenderbuffer[Le]), Ze === !0 && (s1.invalidateFramebuffer(s1.READ_FRAMEBUFFER, [ - Me - ]), s1.invalidateFramebuffer(s1.DRAW_FRAMEBUFFER, [ - Me - ])), de) { - let se = n.get(S[Le]).__webglTexture; - s1.framebufferTexture2D(s1.DRAW_FRAMEBUFFER, s1.COLOR_ATTACHMENT0, s1.TEXTURE_2D, se, 0); - } - s1.blitFramebuffer(0, 0, B, ee, 0, 0, B, ee, j, s1.NEAREST), f && s1.invalidateFramebuffer(s1.READ_FRAMEBUFFER, te); - } - if (t.bindFramebuffer(s1.READ_FRAMEBUFFER, null), t.bindFramebuffer(s1.DRAW_FRAMEBUFFER, null), de) for(let Le = 0; Le < S.length; Le++){ - t.bindFramebuffer(s1.FRAMEBUFFER, re.__webglMultisampledFramebuffer), s1.framebufferRenderbuffer(s1.FRAMEBUFFER, s1.COLOR_ATTACHMENT0 + Le, s1.RENDERBUFFER, re.__webglColorRenderbuffer[Le]); - let Ze = n.get(S[Le]).__webglTexture; - t.bindFramebuffer(s1.FRAMEBUFFER, re.__webglFramebuffer), s1.framebufferTexture2D(s1.DRAW_FRAMEBUFFER, s1.COLOR_ATTACHMENT0 + Le, s1.TEXTURE_2D, Ze, 0); - } - t.bindFramebuffer(s1.DRAW_FRAMEBUFFER, re.__webglMultisampledFramebuffer); - } - } - function ye(C) { - return Math.min(u, C.samples); - } - function Ne(C) { - let S = n.get(C); - return o && C.samples > 0 && e.has("WEBGL_multisampled_render_to_texture") === !0 && S.__useRenderToTexture !== !1; - } - function qe(C) { - let S = a.render.frame; - m.get(C) !== S && (m.set(C, S), C.update()); - } - function rt(C, S) { - let B = C.colorSpace, ee = C.format, j = C.type; - return C.isCompressedTexture === !0 || C.isVideoTexture === !0 || C.format === po || B !== Mn && B !== Xt && (Qe.getTransfer(B) === nt ? o === !1 ? e.has("EXT_sRGB") === !0 && ee === Wt ? (C.format = po, C.minFilter = mt, C.generateMipmaps = !1) : S = Xr.sRGBToLinear(S) : (ee !== Wt || j !== On) && console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", B)), S; - } - this.allocateTextureUnit = ne, this.resetTextureUnits = H, this.setTexture2D = K, this.setTexture2DArray = D, this.setTexture3D = G, this.setTextureCube = he, this.rebindTextures = ie, this.setupRenderTarget = J, this.updateRenderTargetMipmap = Se, this.updateMultisampleRenderTarget = me, this.setupDepthRenderbuffer = X, this.setupFrameBufferTexture = Ce, this.useMultisampledRTT = Ne; -} -function V0(s1, e, t) { - let n = t.isWebGL2; - function i(r, a = Xt) { - let o, c = Qe.getTransfer(a); - if (r === On) return s1.UNSIGNED_BYTE; - if (r === fd) return s1.UNSIGNED_SHORT_4_4_4_4; - if (r === pd) return s1.UNSIGNED_SHORT_5_5_5_1; - if (r === _f) return s1.BYTE; - if (r === xf) return s1.SHORT; - if (r === Wc) return s1.UNSIGNED_SHORT; - if (r === dd) return s1.INT; - if (r === Ln) return s1.UNSIGNED_INT; - if (r === xn) return s1.FLOAT; - if (r === Ts) return n ? s1.HALF_FLOAT : (o = e.get("OES_texture_half_float"), o !== null ? o.HALF_FLOAT_OES : null); - if (r === vf) return s1.ALPHA; - if (r === Wt) return s1.RGBA; - if (r === yf) return s1.LUMINANCE; - if (r === Mf) return s1.LUMINANCE_ALPHA; - if (r === si) return s1.DEPTH_COMPONENT; - if (r === Yi) return s1.DEPTH_STENCIL; - if (r === po) return o = e.get("EXT_sRGB"), o !== null ? o.SRGB_ALPHA_EXT : null; - if (r === Sf) return s1.RED; - if (r === md) return s1.RED_INTEGER; - if (r === bf) return s1.RG; - if (r === gd) return s1.RG_INTEGER; - if (r === _d) return s1.RGBA_INTEGER; - if (r === wa || r === Aa || r === Ra || r === Ca) if (c === nt) if (o = e.get("WEBGL_compressed_texture_s3tc_srgb"), o !== null) { - if (r === wa) return o.COMPRESSED_SRGB_S3TC_DXT1_EXT; - if (r === Aa) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - if (r === Ra) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - if (r === Ca) return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else return null; - else if (o = e.get("WEBGL_compressed_texture_s3tc"), o !== null) { - if (r === wa) return o.COMPRESSED_RGB_S3TC_DXT1_EXT; - if (r === Aa) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if (r === Ra) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if (r === Ca) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else return null; - if (r === ul || r === dl || r === fl || r === pl) if (o = e.get("WEBGL_compressed_texture_pvrtc"), o !== null) { - if (r === ul) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if (r === dl) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if (r === fl) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if (r === pl) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - } else return null; - if (r === Ef) return o = e.get("WEBGL_compressed_texture_etc1"), o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null; - if (r === ml || r === gl) if (o = e.get("WEBGL_compressed_texture_etc"), o !== null) { - if (r === ml) return c === nt ? o.COMPRESSED_SRGB8_ETC2 : o.COMPRESSED_RGB8_ETC2; - if (r === gl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : o.COMPRESSED_RGBA8_ETC2_EAC; - } else return null; - if (r === _l || r === xl || r === vl || r === yl || r === Ml || r === Sl || r === bl || r === El || r === Tl || r === wl || r === Al || r === Rl || r === Cl || r === Pl) if (o = e.get("WEBGL_compressed_texture_astc"), o !== null) { - if (r === _l) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : o.COMPRESSED_RGBA_ASTC_4x4_KHR; - if (r === xl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : o.COMPRESSED_RGBA_ASTC_5x4_KHR; - if (r === vl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : o.COMPRESSED_RGBA_ASTC_5x5_KHR; - if (r === yl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : o.COMPRESSED_RGBA_ASTC_6x5_KHR; - if (r === Ml) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : o.COMPRESSED_RGBA_ASTC_6x6_KHR; - if (r === Sl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : o.COMPRESSED_RGBA_ASTC_8x5_KHR; - if (r === bl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : o.COMPRESSED_RGBA_ASTC_8x6_KHR; - if (r === El) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : o.COMPRESSED_RGBA_ASTC_8x8_KHR; - if (r === Tl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : o.COMPRESSED_RGBA_ASTC_10x5_KHR; - if (r === wl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : o.COMPRESSED_RGBA_ASTC_10x6_KHR; - if (r === Al) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : o.COMPRESSED_RGBA_ASTC_10x8_KHR; - if (r === Rl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : o.COMPRESSED_RGBA_ASTC_10x10_KHR; - if (r === Cl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : o.COMPRESSED_RGBA_ASTC_12x10_KHR; - if (r === Pl) return c === nt ? o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : o.COMPRESSED_RGBA_ASTC_12x12_KHR; - } else return null; - if (r === Pa || r === Ll || r === Il) if (o = e.get("EXT_texture_compression_bptc"), o !== null) { - if (r === Pa) return c === nt ? o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : o.COMPRESSED_RGBA_BPTC_UNORM_EXT; - if (r === Ll) return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; - if (r === Il) return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; - } else return null; - if (r === Tf || r === Ul || r === Dl || r === Nl) if (o = e.get("EXT_texture_compression_rgtc"), o !== null) { - if (r === Pa) return o.COMPRESSED_RED_RGTC1_EXT; - if (r === Ul) return o.COMPRESSED_SIGNED_RED_RGTC1_EXT; - if (r === Dl) return o.COMPRESSED_RED_GREEN_RGTC2_EXT; - if (r === Nl) return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; - } else return null; - return r === ii ? n ? s1.UNSIGNED_INT_24_8 : (o = e.get("WEBGL_depth_texture"), o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null) : s1[r] !== void 0 ? s1[r] : null; - } - return { - convert: i - }; -} -var To = class extends yt { - constructor(e = []){ - super(), this.isArrayCamera = !0, this.cameras = e; - } -}, ti = class extends Je { - constructor(){ - super(), this.isGroup = !0, this.type = "Group"; - } -}, k0 = { - type: "move" -}, Ss = class { - constructor(){ - this._targetRay = null, this._grip = null, this._hand = null; - } - getHandSpace() { - return this._hand === null && (this._hand = new ti, 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 ti, this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new A, this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new A), this._targetRay; - } - getGripSpace() { - return this._grip === null && (this._grip = new ti, this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new A, this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new A), this._grip; + return this._progress = 0, this.source !== null && (this.source.stop(this.context.currentTime + t), this.source.onended = null), this.isPlaying = !1, this; } - 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() { + if (this.filters.length > 0) { + this.source.connect(this.filters[0]); + for(let t = 1, e = this.filters.length; t < e; t++)this.filters[t - 1].connect(this.filters[t]); + this.filters[this.filters.length - 1].connect(this.getOutput()); + } else this.source.connect(this.getOutput()); + return this._connected = !0, this; } - connect(e) { - if (e && e.hand) { - let t = this._hand; - if (t) for (let n of e.hand.values())this._getHandJoint(t, n); + disconnect() { + if (this._connected !== !1) { + if (this.filters.length > 0) { + this.source.disconnect(this.filters[0]); + for(let t = 1, e = this.filters.length; t < e; t++)this.filters[t - 1].disconnect(this.filters[t]); + this.filters[this.filters.length - 1].disconnect(this.getOutput()); + } else this.source.disconnect(this.getOutput()); + return this._connected = !1, this; } - 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; + getFilters() { + return this.filters; } - update(e, t, n) { - let i = null, r = null, a = null, o = this._targetRay, c = this._grip, l = this._hand; - if (e && t.session.visibilityState !== "visible-blurred") { - if (l && e.hand) { - a = !0; - for (let _ of e.hand.values()){ - let g = t.getJointPose(_, n), p = this._getHandJoint(l, _); - g !== null && (p.matrix.fromArray(g.transform.matrix), p.matrix.decompose(p.position, p.rotation, p.scale), p.matrixWorldNeedsUpdate = !0, p.jointRadius = g.radius), p.visible = g !== null; - } - let h = l.joints["index-finger-tip"], u = l.joints["thumb-tip"], d = h.position.distanceTo(u.position), f = .02, m = .005; - l.inputState.pinching && d > f + m ? (l.inputState.pinching = !1, this.dispatchEvent({ - type: "pinchend", - handedness: e.handedness, - target: this - })) : !l.inputState.pinching && d <= f - m && (l.inputState.pinching = !0, this.dispatchEvent({ - type: "pinchstart", - handedness: e.handedness, - target: this - })); - } else c !== null && e.gripSpace && (r = t.getPose(e.gripSpace, n), r !== null && (c.matrix.fromArray(r.transform.matrix), c.matrix.decompose(c.position, c.rotation, c.scale), c.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (c.hasLinearVelocity = !0, c.linearVelocity.copy(r.linearVelocity)) : c.hasLinearVelocity = !1, r.angularVelocity ? (c.hasAngularVelocity = !0, c.angularVelocity.copy(r.angularVelocity)) : c.hasAngularVelocity = !1)); - o !== null && (i = t.getPose(e.targetRaySpace, n), i === null && r !== null && (i = r), i !== null && (o.matrix.fromArray(i.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, i.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(i.linearVelocity)) : o.hasLinearVelocity = !1, i.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(i.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(k0))); - } - return o !== null && (o.visible = i !== null), c !== null && (c.visible = r !== null), l !== null && (l.visible = a !== null), this; + setFilters(t) { + return t || (t = []), this._connected === !0 ? (this.disconnect(), this.filters = t.slice(), this.connect()) : this.filters = t.slice(), this; } - _getHandJoint(e, t) { - if (e.joints[t.jointName] === void 0) { - let n = new ti; - n.matrixAutoUpdate = !1, n.visible = !1, e.joints[t.jointName] = n, e.add(n); - } - return e.joints[t.jointName]; + setDetune(t) { + return this.detune = t, this.isPlaying === !0 && this.source.detune !== void 0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01), this; } -}, wo = class extends St { - constructor(e, t, n, i, r, a, o, c, l, h){ - if (h = h !== void 0 ? h : si, h !== si && h !== Yi) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); - n === void 0 && h === si && (n = Ln), n === void 0 && h === Yi && (n = ii), super(null, i, r, a, o, c, h, n, l), this.isDepthTexture = !0, this.image = { - width: e, - height: t - }, this.magFilter = o !== void 0 ? o : pt, this.minFilter = c !== void 0 ? c : pt, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null; + getDetune() { + return this.detune; } - copy(e) { - return super.copy(e), this.compareFunction = e.compareFunction, this; + getFilter() { + return this.getFilters()[0]; } - toJSON(e) { - let t = super.toJSON(e); - return this.compareFunction !== null && (t.compareFunction = this.compareFunction), t; + setFilter(t) { + return this.setFilters(t ? [ + t + ] : []); } -}, Ao = class extends sn { - constructor(e, t){ - super(); - let n = this, i = null, r = 1, a = null, o = "local-floor", c = 1, l = null, h = null, u = null, d = null, f = null, m = null, _ = t.getContextAttributes(), g = null, p = null, v = [], x1 = [], y1 = new yt; - y1.layers.enable(1), y1.viewport = new je; - let b = new yt; - b.layers.enable(2), b.viewport = new je; - let w = [ - y1, - b - ], R = new To; - R.layers.enable(1), R.layers.enable(2); - let I = null, M = null; - this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(D) { - let G = v[D]; - return G === void 0 && (G = new Ss, v[D] = G), G.getTargetRaySpace(); - }, this.getControllerGrip = function(D) { - let G = v[D]; - return G === void 0 && (G = new Ss, v[D] = G), G.getGripSpace(); - }, this.getHand = function(D) { - let G = v[D]; - return G === void 0 && (G = new Ss, v[D] = G), G.getHandSpace(); - }; - function T(D) { - let G = x1.indexOf(D.inputSource); - if (G === -1) return; - let he = v[G]; - he !== void 0 && (he.update(D.inputSource, D.frame, l || a), he.dispatchEvent({ - type: D.type, - data: D.inputSource - })); - } - function O() { - i.removeEventListener("select", T), i.removeEventListener("selectstart", T), i.removeEventListener("selectend", T), i.removeEventListener("squeeze", T), i.removeEventListener("squeezestart", T), i.removeEventListener("squeezeend", T), i.removeEventListener("end", O), i.removeEventListener("inputsourceschange", Y); - for(let D = 0; D < v.length; D++){ - let G = x1[D]; - G !== null && (x1[D] = null, v[D].disconnect(G)); - } - I = null, M = null, e.setRenderTarget(g), f = null, d = null, u = null, i = null, p = null, K.stop(), n.isPresenting = !1, n.dispatchEvent({ - type: "sessionend" - }); - } - this.setFramebufferScaleFactor = function(D) { - r = D, n.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); - }, this.setReferenceSpaceType = function(D) { - o = D, n.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); - }, this.getReferenceSpace = function() { - return l || a; - }, this.setReferenceSpace = function(D) { - l = D; - }, this.getBaseLayer = function() { - return d !== null ? d : f; - }, this.getBinding = function() { - return u; - }, this.getFrame = function() { - return m; - }, this.getSession = function() { - return i; - }, this.setSession = async function(D) { - if (i = D, i !== null) { - if (g = e.getRenderTarget(), i.addEventListener("select", T), i.addEventListener("selectstart", T), i.addEventListener("selectend", T), i.addEventListener("squeeze", T), i.addEventListener("squeezestart", T), i.addEventListener("squeezeend", T), i.addEventListener("end", O), i.addEventListener("inputsourceschange", Y), _.xrCompatible !== !0 && await t.makeXRCompatible(), i.renderState.layers === void 0 || e.capabilities.isWebGL2 === !1) { - let G = { - antialias: i.renderState.layers === void 0 ? _.antialias : !0, - alpha: !0, - depth: _.depth, - stencil: _.stencil, - framebufferScaleFactor: r - }; - f = new XRWebGLLayer(i, t, G), i.updateRenderState({ - baseLayer: f - }), p = new qt(f.framebufferWidth, f.framebufferHeight, { - format: Wt, - type: On, - colorSpace: e.outputColorSpace, - stencilBuffer: _.stencil - }); - } else { - let G = null, he = null, fe = null; - _.depth && (fe = _.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, G = _.stencil ? Yi : si, he = _.stencil ? ii : Ln); - let _e = { - colorFormat: t.RGBA8, - depthFormat: fe, - scaleFactor: r - }; - u = new XRWebGLBinding(i, t), d = u.createProjectionLayer(_e), i.updateRenderState({ - layers: [ - d - ] - }), p = new qt(d.textureWidth, d.textureHeight, { - format: Wt, - type: On, - depthTexture: new wo(d.textureWidth, d.textureHeight, he, void 0, void 0, void 0, void 0, void 0, void 0, G), - stencilBuffer: _.stencil, - colorSpace: e.outputColorSpace, - samples: _.antialias ? 4 : 0 - }); - let we = e.properties.get(p); - we.__ignoreDepthValues = d.ignoreDepthValues; - } - p.isXRRenderTarget = !0, this.setFoveation(c), l = null, a = await i.requestReferenceSpace(o), K.setContext(i), K.start(), n.isPresenting = !0, n.dispatchEvent({ - type: "sessionstart" - }); - } - }, this.getEnvironmentBlendMode = function() { - if (i !== null) return i.environmentBlendMode; - }; - function Y(D) { - for(let G = 0; G < D.removed.length; G++){ - let he = D.removed[G], fe = x1.indexOf(he); - fe >= 0 && (x1[fe] = null, v[fe].disconnect(he)); - } - for(let G = 0; G < D.added.length; G++){ - let he = D.added[G], fe = x1.indexOf(he); - if (fe === -1) { - for(let we = 0; we < v.length; we++)if (we >= x1.length) { - x1.push(he), fe = we; - break; - } else if (x1[we] === null) { - x1[we] = he, fe = we; - break; - } - if (fe === -1) break; - } - let _e = v[fe]; - _e && _e.connect(he); - } - } - let $ = new A, U = new A; - function z(D, G, he) { - $.setFromMatrixPosition(G.matrixWorld), U.setFromMatrixPosition(he.matrixWorld); - let fe = $.distanceTo(U), _e = G.projectionMatrix.elements, we = he.projectionMatrix.elements, Ee = _e[14] / (_e[10] - 1), Te = _e[14] / (_e[10] + 1), Ye = (_e[9] + 1) / _e[5], it = (_e[9] - 1) / _e[5], Ce = (_e[8] - 1) / _e[0], L = (we[8] + 1) / we[0], oe = Ee * Ce, X = Ee * L, ie = fe / (-Ce + L), J = ie * -Ce; - G.matrixWorld.decompose(D.position, D.quaternion, D.scale), D.translateX(J), D.translateZ(ie), D.matrixWorld.compose(D.position, D.quaternion, D.scale), D.matrixWorldInverse.copy(D.matrixWorld).invert(); - let Se = Ee + ie, me = Te + ie, ye = oe - J, Ne = X + (fe - J), qe = Ye * Te / me * Se, rt = it * Te / me * Se; - D.projectionMatrix.makePerspective(ye, Ne, qe, rt, Se, me), D.projectionMatrixInverse.copy(D.projectionMatrix).invert(); - } - function q(D, G) { - G === null ? D.matrixWorld.copy(D.matrix) : D.matrixWorld.multiplyMatrices(G.matrixWorld, D.matrix), D.matrixWorldInverse.copy(D.matrixWorld).invert(); - } - this.updateCamera = function(D) { - if (i === null) return; - R.near = b.near = y1.near = D.near, R.far = b.far = y1.far = D.far, (I !== R.near || M !== R.far) && (i.updateRenderState({ - depthNear: R.near, - depthFar: R.far - }), I = R.near, M = R.far); - let G = D.parent, he = R.cameras; - q(R, G); - for(let fe = 0; fe < he.length; fe++)q(he[fe], G); - he.length === 2 ? z(R, y1, b) : R.projectionMatrix.copy(y1.projectionMatrix), H(D, R, G); - }; - function H(D, G, he) { - he === null ? D.matrix.copy(G.matrixWorld) : (D.matrix.copy(he.matrixWorld), D.matrix.invert(), D.matrix.multiply(G.matrixWorld)), D.matrix.decompose(D.position, D.quaternion, D.scale), D.updateMatrixWorld(!0), D.projectionMatrix.copy(G.projectionMatrix), D.projectionMatrixInverse.copy(G.projectionMatrixInverse), D.isPerspectiveCamera && (D.fov = Zi * 2 * Math.atan(1 / D.projectionMatrix.elements[5]), D.zoom = 1); - } - this.getCamera = function() { - return R; - }, this.getFoveation = function() { - if (!(d === null && f === null)) return c; - }, this.setFoveation = function(D) { - c = D, d !== null && (d.fixedFoveation = D), f !== null && f.fixedFoveation !== void 0 && (f.fixedFoveation = D); - }; - let ne = null; - function W(D, G) { - if (h = G.getViewerPose(l || a), m = G, h !== null) { - let he = h.views; - f !== null && (e.setRenderTargetFramebuffer(p, f.framebuffer), e.setRenderTarget(p)); - let fe = !1; - he.length !== R.cameras.length && (R.cameras.length = 0, fe = !0); - for(let _e = 0; _e < he.length; _e++){ - let we = he[_e], Ee = null; - if (f !== null) Ee = f.getViewport(we); - else { - let Ye = u.getViewSubImage(d, we); - Ee = Ye.viewport, _e === 0 && (e.setRenderTargetTextures(p, Ye.colorTexture, d.ignoreDepthValues ? void 0 : Ye.depthStencilTexture), e.setRenderTarget(p)); - } - let Te = w[_e]; - Te === void 0 && (Te = new yt, Te.layers.enable(_e), Te.viewport = new je, w[_e] = Te), Te.matrix.fromArray(we.transform.matrix), Te.matrix.decompose(Te.position, Te.quaternion, Te.scale), Te.projectionMatrix.fromArray(we.projectionMatrix), Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert(), Te.viewport.set(Ee.x, Ee.y, Ee.width, Ee.height), _e === 0 && (R.matrix.copy(Te.matrix), R.matrix.decompose(R.position, R.quaternion, R.scale)), fe === !0 && R.cameras.push(Te); - } - } - for(let he = 0; he < v.length; he++){ - let fe = x1[he], _e = v[he]; - fe !== null && _e !== void 0 && _e.update(fe, G, l || a); - } - ne && ne(D, G), G.detectedPlanes && n.dispatchEvent({ - type: "planesdetected", - data: G - }), m = null; + setPlaybackRate(t) { + if (this.hasPlaybackControl === !1) { + console.warn("THREE.Audio: this Audio has no playback control."); + return; } - let K = new Ed; - K.setAnimationLoop(W), this.setAnimationLoop = function(D) { - ne = D; - }, this.dispose = function() {}; + return this.playbackRate = t, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01), this; } -}; -function H0(s1, e) { - function t(g, p) { - g.matrixAutoUpdate === !0 && g.updateMatrix(), p.value.copy(g.matrix); + getPlaybackRate() { + return this.playbackRate; } - function n(g, p) { - p.color.getRGB(g.fogColor.value, bd(s1)), p.isFog ? (g.fogNear.value = p.near, g.fogFar.value = p.far) : p.isFogExp2 && (g.fogDensity.value = p.density); + onEnded() { + this.isPlaying = !1, this._progress = 0; } - function i(g, p, v, x1, y1) { - p.isMeshBasicMaterial || p.isMeshLambertMaterial ? r(g, p) : p.isMeshToonMaterial ? (r(g, p), u(g, p)) : p.isMeshPhongMaterial ? (r(g, p), h(g, p)) : p.isMeshStandardMaterial ? (r(g, p), d(g, p), p.isMeshPhysicalMaterial && f(g, p, y1)) : p.isMeshMatcapMaterial ? (r(g, p), m(g, p)) : p.isMeshDepthMaterial ? r(g, p) : p.isMeshDistanceMaterial ? (r(g, p), _(g, p)) : p.isMeshNormalMaterial ? r(g, p) : p.isLineBasicMaterial ? (a(g, p), p.isLineDashedMaterial && o(g, p)) : p.isPointsMaterial ? c(g, p, v, x1) : p.isSpriteMaterial ? l(g, p) : p.isShadowMaterial ? (g.color.value.copy(p.color), g.opacity.value = p.opacity) : p.isShaderMaterial && (p.uniformsNeedUpdate = !1); + getLoop() { + return this.hasPlaybackControl === !1 ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop; } - function r(g, p) { - g.opacity.value = p.opacity, p.color && g.diffuse.value.copy(p.color), p.emissive && g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity), p.map && (g.map.value = p.map, t(p.map, g.mapTransform)), p.alphaMap && (g.alphaMap.value = p.alphaMap, t(p.alphaMap, g.alphaMapTransform)), p.bumpMap && (g.bumpMap.value = p.bumpMap, t(p.bumpMap, g.bumpMapTransform), g.bumpScale.value = p.bumpScale, p.side === Ft && (g.bumpScale.value *= -1)), p.normalMap && (g.normalMap.value = p.normalMap, t(p.normalMap, g.normalMapTransform), g.normalScale.value.copy(p.normalScale), p.side === Ft && g.normalScale.value.negate()), p.displacementMap && (g.displacementMap.value = p.displacementMap, t(p.displacementMap, g.displacementMapTransform), g.displacementScale.value = p.displacementScale, g.displacementBias.value = p.displacementBias), p.emissiveMap && (g.emissiveMap.value = p.emissiveMap, t(p.emissiveMap, g.emissiveMapTransform)), p.specularMap && (g.specularMap.value = p.specularMap, t(p.specularMap, g.specularMapTransform)), p.alphaTest > 0 && (g.alphaTest.value = p.alphaTest); - let v = e.get(p).envMap; - if (v && (g.envMap.value = v, g.flipEnvMap.value = v.isCubeTexture && v.isRenderTargetTexture === !1 ? -1 : 1, g.reflectivity.value = p.reflectivity, g.ior.value = p.ior, g.refractionRatio.value = p.refractionRatio), p.lightMap) { - g.lightMap.value = p.lightMap; - let x1 = s1._useLegacyLights === !0 ? Math.PI : 1; - g.lightMapIntensity.value = p.lightMapIntensity * x1, t(p.lightMap, g.lightMapTransform); + setLoop(t) { + if (this.hasPlaybackControl === !1) { + console.warn("THREE.Audio: this Audio has no playback control."); + return; } - p.aoMap && (g.aoMap.value = p.aoMap, g.aoMapIntensity.value = p.aoMapIntensity, t(p.aoMap, g.aoMapTransform)); + return this.loop = t, this.isPlaying === !0 && (this.source.loop = this.loop), this; } - function a(g, p) { - g.diffuse.value.copy(p.color), g.opacity.value = p.opacity, p.map && (g.map.value = p.map, t(p.map, g.mapTransform)); + setLoopStart(t) { + return this.loopStart = t, this; } - function o(g, p) { - g.dashSize.value = p.dashSize, g.totalSize.value = p.dashSize + p.gapSize, g.scale.value = p.scale; + setLoopEnd(t) { + return this.loopEnd = t, this; } - function c(g, p, v, x1) { - g.diffuse.value.copy(p.color), g.opacity.value = p.opacity, g.size.value = p.size * v, g.scale.value = x1 * .5, p.map && (g.map.value = p.map, t(p.map, g.uvTransform)), p.alphaMap && (g.alphaMap.value = p.alphaMap, t(p.alphaMap, g.alphaMapTransform)), p.alphaTest > 0 && (g.alphaTest.value = p.alphaTest); + getVolume() { + return this.gain.gain.value; } - function l(g, p) { - g.diffuse.value.copy(p.color), g.opacity.value = p.opacity, g.rotation.value = p.rotation, p.map && (g.map.value = p.map, t(p.map, g.mapTransform)), p.alphaMap && (g.alphaMap.value = p.alphaMap, t(p.alphaMap, g.alphaMapTransform)), p.alphaTest > 0 && (g.alphaTest.value = p.alphaTest); + setVolume(t) { + return this.gain.gain.setTargetAtTime(t, this.context.currentTime, .01), this; } - function h(g, p) { - g.specular.value.copy(p.specular), g.shininess.value = Math.max(p.shininess, 1e-4); + copy(t, e) { + return super.copy(t, e), t.sourceType !== "buffer" ? (console.warn("THREE.Audio: Audio source type cannot be copied."), this) : (this.autoplay = t.autoplay, this.buffer = t.buffer, this.detune = t.detune, this.loop = t.loop, this.loopStart = t.loopStart, this.loopEnd = t.loopEnd, this.offset = t.offset, this.duration = t.duration, this.playbackRate = t.playbackRate, this.hasPlaybackControl = t.hasPlaybackControl, this.sourceType = t.sourceType, this.filters = t.filters.slice(), this); } - function u(g, p) { - p.gradientMap && (g.gradientMap.value = p.gradientMap); + clone(t) { + return new this.constructor(this.listener).copy(this, t); } - function d(g, p) { - g.metalness.value = p.metalness, p.metalnessMap && (g.metalnessMap.value = p.metalnessMap, t(p.metalnessMap, g.metalnessMapTransform)), g.roughness.value = p.roughness, p.roughnessMap && (g.roughnessMap.value = p.roughnessMap, t(p.roughnessMap, g.roughnessMapTransform)), e.get(p).envMap && (g.envMapIntensity.value = p.envMapIntensity); +}, Pe = new w, Ph = new bt, _d = new w, Oe = new w, Oh = class extends ko { + constructor(t){ + super(t), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain); } - function f(g, p, v) { - g.ior.value = p.ior, p.sheen > 0 && (g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen), g.sheenRoughness.value = p.sheenRoughness, p.sheenColorMap && (g.sheenColorMap.value = p.sheenColorMap, t(p.sheenColorMap, g.sheenColorMapTransform)), p.sheenRoughnessMap && (g.sheenRoughnessMap.value = p.sheenRoughnessMap, t(p.sheenRoughnessMap, g.sheenRoughnessMapTransform))), p.clearcoat > 0 && (g.clearcoat.value = p.clearcoat, g.clearcoatRoughness.value = p.clearcoatRoughness, p.clearcoatMap && (g.clearcoatMap.value = p.clearcoatMap, t(p.clearcoatMap, g.clearcoatMapTransform)), p.clearcoatRoughnessMap && (g.clearcoatRoughnessMap.value = p.clearcoatRoughnessMap, t(p.clearcoatRoughnessMap, g.clearcoatRoughnessMapTransform)), p.clearcoatNormalMap && (g.clearcoatNormalMap.value = p.clearcoatNormalMap, t(p.clearcoatNormalMap, g.clearcoatNormalMapTransform), g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale), p.side === Ft && g.clearcoatNormalScale.value.negate())), p.iridescence > 0 && (g.iridescence.value = p.iridescence, g.iridescenceIOR.value = p.iridescenceIOR, g.iridescenceThicknessMinimum.value = p.iridescenceThicknessRange[0], g.iridescenceThicknessMaximum.value = p.iridescenceThicknessRange[1], p.iridescenceMap && (g.iridescenceMap.value = p.iridescenceMap, t(p.iridescenceMap, g.iridescenceMapTransform)), p.iridescenceThicknessMap && (g.iridescenceThicknessMap.value = p.iridescenceThicknessMap, t(p.iridescenceThicknessMap, g.iridescenceThicknessMapTransform))), p.transmission > 0 && (g.transmission.value = p.transmission, g.transmissionSamplerMap.value = v.texture, g.transmissionSamplerSize.value.set(v.width, v.height), p.transmissionMap && (g.transmissionMap.value = p.transmissionMap, t(p.transmissionMap, g.transmissionMapTransform)), g.thickness.value = p.thickness, p.thicknessMap && (g.thicknessMap.value = p.thicknessMap, t(p.thicknessMap, g.thicknessMapTransform)), g.attenuationDistance.value = p.attenuationDistance, g.attenuationColor.value.copy(p.attenuationColor)), p.anisotropy > 0 && (g.anisotropyVector.value.set(p.anisotropy * Math.cos(p.anisotropyRotation), p.anisotropy * Math.sin(p.anisotropyRotation)), p.anisotropyMap && (g.anisotropyMap.value = p.anisotropyMap, t(p.anisotropyMap, g.anisotropyMapTransform))), g.specularIntensity.value = p.specularIntensity, g.specularColor.value.copy(p.specularColor), p.specularColorMap && (g.specularColorMap.value = p.specularColorMap, t(p.specularColorMap, g.specularColorMapTransform)), p.specularIntensityMap && (g.specularIntensityMap.value = p.specularIntensityMap, t(p.specularIntensityMap, g.specularIntensityMapTransform)); + connect() { + super.connect(), this.panner.connect(this.gain); } - function m(g, p) { - p.matcap && (g.matcap.value = p.matcap); + disconnect() { + super.disconnect(), this.panner.disconnect(this.gain); } - function _(g, p) { - let v = e.get(p).light; - g.referencePosition.value.setFromMatrixPosition(v.matrixWorld), g.nearDistance.value = v.shadow.camera.near, g.farDistance.value = v.shadow.camera.far; + getOutput() { + return this.panner; } - return { - refreshFogUniforms: n, - refreshMaterialUniforms: i - }; -} -function G0(s1, e, t, n) { - let i = {}, r = {}, a = [], o = t.isWebGL2 ? s1.getParameter(s1.MAX_UNIFORM_BUFFER_BINDINGS) : 0; - function c(v, x1) { - let y1 = x1.program; - n.uniformBlockBinding(v, y1); - } - function l(v, x1) { - let y1 = i[v.id]; - y1 === void 0 && (m(v), y1 = h(v), i[v.id] = y1, v.addEventListener("dispose", g)); - let b = x1.program; - n.updateUBOMapping(v, b); - let w = e.render.frame; - r[v.id] !== w && (d(v), r[v.id] = w); - } - function h(v) { - let x1 = u(); - v.__bindingPointIndex = x1; - let y1 = s1.createBuffer(), b = v.__size, w = v.usage; - return s1.bindBuffer(s1.UNIFORM_BUFFER, y1), s1.bufferData(s1.UNIFORM_BUFFER, b, w), s1.bindBuffer(s1.UNIFORM_BUFFER, null), s1.bindBufferBase(s1.UNIFORM_BUFFER, x1, y1), y1; - } - function u() { - for(let v = 0; v < o; v++)if (a.indexOf(v) === -1) return a.push(v), v; - return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."), 0; + getRefDistance() { + return this.panner.refDistance; } - function d(v) { - let x1 = i[v.id], y1 = v.uniforms, b = v.__cache; - s1.bindBuffer(s1.UNIFORM_BUFFER, x1); - for(let w = 0, R = y1.length; w < R; w++){ - let I = y1[w]; - if (f(I, w, b) === !0) { - let M = I.__offset, T = Array.isArray(I.value) ? I.value : [ - I.value - ], O = 0; - for(let Y = 0; Y < T.length; Y++){ - let $ = T[Y], U = _($); - typeof $ == "number" ? (I.__data[0] = $, s1.bufferSubData(s1.UNIFORM_BUFFER, M + O, I.__data)) : $.isMatrix3 ? (I.__data[0] = $.elements[0], I.__data[1] = $.elements[1], I.__data[2] = $.elements[2], I.__data[3] = $.elements[0], I.__data[4] = $.elements[3], I.__data[5] = $.elements[4], I.__data[6] = $.elements[5], I.__data[7] = $.elements[0], I.__data[8] = $.elements[6], I.__data[9] = $.elements[7], I.__data[10] = $.elements[8], I.__data[11] = $.elements[0]) : ($.toArray(I.__data, O), O += U.storage / Float32Array.BYTES_PER_ELEMENT); - } - s1.bufferSubData(s1.UNIFORM_BUFFER, M, I.__data); - } - } - s1.bindBuffer(s1.UNIFORM_BUFFER, null); + setRefDistance(t) { + return this.panner.refDistance = t, this; } - function f(v, x1, y1) { - let b = v.value; - if (y1[x1] === void 0) { - if (typeof b == "number") y1[x1] = b; - else { - let w = Array.isArray(b) ? b : [ - b - ], R = []; - for(let I = 0; I < w.length; I++)R.push(w[I].clone()); - y1[x1] = R; - } - return !0; - } else if (typeof b == "number") { - if (y1[x1] !== b) return y1[x1] = b, !0; - } else { - let w = Array.isArray(y1[x1]) ? y1[x1] : [ - y1[x1] - ], R = Array.isArray(b) ? b : [ - b - ]; - for(let I = 0; I < w.length; I++){ - let M = w[I]; - if (M.equals(R[I]) === !1) return M.copy(R[I]), !0; - } - } - return !1; + getRolloffFactor() { + return this.panner.rolloffFactor; } - function m(v) { - let x1 = v.uniforms, y1 = 0, b = 16, w = 0; - for(let R = 0, I = x1.length; R < I; R++){ - let M = x1[R], T = { - boundary: 0, - storage: 0 - }, O = Array.isArray(M.value) ? M.value : [ - M.value - ]; - for(let Y = 0, $ = O.length; Y < $; Y++){ - let U = O[Y], z = _(U); - T.boundary += z.boundary, T.storage += z.storage; - } - if (M.__data = new Float32Array(T.storage / Float32Array.BYTES_PER_ELEMENT), M.__offset = y1, R > 0) { - w = y1 % b; - let Y = b - w; - w !== 0 && Y - T.boundary < 0 && (y1 += b - w, M.__offset = y1); - } - y1 += T.storage; - } - return w = y1 % b, w > 0 && (y1 += b - w), v.__size = y1, v.__cache = {}, this; + setRolloffFactor(t) { + return this.panner.rolloffFactor = t, this; } - function _(v) { - let x1 = { - boundary: 0, - storage: 0 - }; - return typeof v == "number" ? (x1.boundary = 4, x1.storage = 4) : v.isVector2 ? (x1.boundary = 8, x1.storage = 8) : v.isVector3 || v.isColor ? (x1.boundary = 16, x1.storage = 12) : v.isVector4 ? (x1.boundary = 16, x1.storage = 16) : v.isMatrix3 ? (x1.boundary = 48, x1.storage = 48) : v.isMatrix4 ? (x1.boundary = 64, x1.storage = 64) : v.isTexture ? console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.") : console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", v), x1; + getDistanceModel() { + return this.panner.distanceModel; } - function g(v) { - let x1 = v.target; - x1.removeEventListener("dispose", g); - let y1 = a.indexOf(x1.__bindingPointIndex); - a.splice(y1, 1), s1.deleteBuffer(i[x1.id]), delete i[x1.id], delete r[x1.id]; + setDistanceModel(t) { + return this.panner.distanceModel = t, this; } - function p() { - for(let v in i)s1.deleteBuffer(i[v]); - a = [], i = {}, r = {}; + getMaxDistance() { + return this.panner.maxDistance; } - return { - bind: c, - update: l, - dispose: p - }; -} -var Ro = class { - constructor(e = {}){ - let { canvas: t = tp() , context: n = null , depth: i = !0 , stencil: r = !0 , alpha: a = !1 , antialias: o = !1 , premultipliedAlpha: c = !0 , preserveDrawingBuffer: l = !1 , powerPreference: h = "default" , failIfMajorPerformanceCaveat: u = !1 } = e; - this.isWebGLRenderer = !0; - let d; - n !== null ? d = n.getContextAttributes().alpha : d = a; - let f = new Uint32Array(4), m = new Int32Array(4), _ = null, g = null, p = [], v = []; - this.domElement = t, this.debug = { - checkShaderErrors: !0, - onShaderError: null - }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this._outputColorSpace = vt, this._useLegacyLights = !1, this.toneMapping = Nn, this.toneMappingExposure = 1; - let x1 = this, y1 = !1, b = 0, w = 0, R = null, I = -1, M = null, T = new je, O = new je, Y = null, $ = new pe(0), U = 0, z = t.width, q = t.height, H = 1, ne = null, W = null, K = new je(0, 0, z, q), D = new je(0, 0, z, q), G = !1, he = new Ps, fe = !1, _e = !1, we = null, Ee = new ze, Te = new Z, Ye = new A, it = { - background: null, - fog: null, - environment: null, - overrideMaterial: null, - isScene: !0 - }; - function Ce() { - return R === null ? H : 1; - } - let L = n; - function oe(E, N) { - for(let V = 0; V < E.length; V++){ - let F = E[V], k = t.getContext(F, N); - if (k !== null) return k; - } - return null; - } - try { - let E = { - alpha: !0, - depth: i, - stencil: r, - antialias: o, - premultipliedAlpha: c, - preserveDrawingBuffer: l, - powerPreference: h, - failIfMajorPerformanceCaveat: u - }; - if ("setAttribute" in t && t.setAttribute("data-engine", `three.js r${Hc}`), t.addEventListener("webglcontextlost", ce, !1), t.addEventListener("webglcontextrestored", ae, !1), t.addEventListener("webglcontextcreationerror", ge, !1), L === null) { - let N = [ - "webgl2", - "webgl", - "experimental-webgl" - ]; - if (x1.isWebGL1Renderer === !0 && N.shift(), L = oe(N, E), L === null) throw oe(N) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); - } - typeof WebGLRenderingContext < "u" && L instanceof WebGLRenderingContext && console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."), L.getShaderPrecisionFormat === void 0 && (L.getShaderPrecisionFormat = function() { - return { - rangeMin: 1, - rangeMax: 1, - precision: 1 - }; - }); - } catch (E) { - throw console.error("THREE.WebGLRenderer: " + E.message), E; - } - let X, ie, J, Se, me, ye, Ne, qe, rt, C, S, B, ee, j, te, Me, re, de, Le, Ze, se, $e, Oe, Ie; - function Re() { - X = new h_(L), ie = new s_(L, X, e), X.init(ie), $e = new V0(L, X, ie), J = new B0(L, X, ie), Se = new f_(L), me = new w0, ye = new z0(L, X, J, me, ie, $e, Se), Ne = new a_(x1), qe = new l_(x1), rt = new bp(L, ie), Oe = new n_(L, X, rt, ie), C = new u_(L, rt, Se, Oe), S = new __(L, C, rt, Se), Le = new g_(L, ie, ye), Me = new r_(me), B = new T0(x1, Ne, qe, X, ie, Oe, Me), ee = new H0(x1, me), j = new R0, te = new D0(X, ie), de = new t_(x1, Ne, qe, J, S, d, c), re = new F0(x1, S, ie), Ie = new G0(L, Se, ie, J), Ze = new i_(L, X, Se, ie), se = new d_(L, X, Se, ie), Se.programs = B.programs, x1.capabilities = ie, x1.extensions = X, x1.properties = me, x1.renderLists = j, x1.shadowMap = re, x1.state = J, x1.info = Se; - } - Re(); - let P = new Ao(x1, L); - this.xr = P, this.getContext = function() { - return L; - }, this.getContextAttributes = function() { - return L.getContextAttributes(); - }, this.forceContextLoss = function() { - let E = X.get("WEBGL_lose_context"); - E && E.loseContext(); - }, this.forceContextRestore = function() { - let E = X.get("WEBGL_lose_context"); - E && E.restoreContext(); - }, this.getPixelRatio = function() { - return H; - }, this.setPixelRatio = function(E) { - E !== void 0 && (H = E, this.setSize(z, q, !1)); - }, this.getSize = function(E) { - return E.set(z, q); - }, this.setSize = function(E, N, V = !0) { - if (P.isPresenting) { - console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); - return; - } - z = E, q = N, t.width = Math.floor(E * H), t.height = Math.floor(N * H), V === !0 && (t.style.width = E + "px", t.style.height = N + "px"), this.setViewport(0, 0, E, N); - }, this.getDrawingBufferSize = function(E) { - return E.set(z * H, q * H).floor(); - }, this.setDrawingBufferSize = function(E, N, V) { - z = E, q = N, H = V, t.width = Math.floor(E * V), t.height = Math.floor(N * V), this.setViewport(0, 0, E, N); - }, this.getCurrentViewport = function(E) { - return E.copy(T); - }, this.getViewport = function(E) { - return E.copy(K); - }, this.setViewport = function(E, N, V, F) { - E.isVector4 ? K.set(E.x, E.y, E.z, E.w) : K.set(E, N, V, F), J.viewport(T.copy(K).multiplyScalar(H).floor()); - }, this.getScissor = function(E) { - return E.copy(D); - }, this.setScissor = function(E, N, V, F) { - E.isVector4 ? D.set(E.x, E.y, E.z, E.w) : D.set(E, N, V, F), J.scissor(O.copy(D).multiplyScalar(H).floor()); - }, this.getScissorTest = function() { - return G; - }, this.setScissorTest = function(E) { - J.setScissorTest(G = E); - }, this.setOpaqueSort = function(E) { - ne = E; - }, this.setTransparentSort = function(E) { - W = E; - }, this.getClearColor = function(E) { - return E.copy(de.getClearColor()); - }, this.setClearColor = function() { - de.setClearColor.apply(de, arguments); - }, this.getClearAlpha = function() { - return de.getClearAlpha(); - }, this.setClearAlpha = function() { - de.setClearAlpha.apply(de, arguments); - }, this.clear = function(E = !0, N = !0, V = !0) { - let F = 0; - if (E) { - let k = !1; - if (R !== null) { - let xe = R.texture.format; - k = xe === _d || xe === gd || xe === md; - } - if (k) { - let xe = R.texture.type, Ae = xe === On || xe === Ln || xe === Wc || xe === ii || xe === fd || xe === pd, Ue = de.getClearColor(), De = de.getClearAlpha(), We = Ue.r, Pe = Ue.g, Ve = Ue.b; - Ae ? (f[0] = We, f[1] = Pe, f[2] = Ve, f[3] = De, L.clearBufferuiv(L.COLOR, 0, f)) : (m[0] = We, m[1] = Pe, m[2] = Ve, m[3] = De, L.clearBufferiv(L.COLOR, 0, m)); - } else F |= L.COLOR_BUFFER_BIT; - } - N && (F |= L.DEPTH_BUFFER_BIT), V && (F |= L.STENCIL_BUFFER_BIT), L.clear(F); - }, 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", ce, !1), t.removeEventListener("webglcontextrestored", ae, !1), t.removeEventListener("webglcontextcreationerror", ge, !1), j.dispose(), te.dispose(), me.dispose(), Ne.dispose(), qe.dispose(), S.dispose(), Oe.dispose(), Ie.dispose(), B.dispose(), P.dispose(), P.removeEventListener("sessionstart", tt), P.removeEventListener("sessionend", tn), we && (we.dispose(), we = null), Rt.stop(); - }; - function ce(E) { - E.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y1 = !0; - } - function ae() { - console.log("THREE.WebGLRenderer: Context Restored."), y1 = !1; - let E = Se.autoReset, N = re.enabled, V = re.autoUpdate, F = re.needsUpdate, k = re.type; - Re(), Se.autoReset = E, re.enabled = N, re.autoUpdate = V, re.needsUpdate = F, re.type = k; - } - function ge(E) { - console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", E.statusMessage); - } - function ue(E) { - let N = E.target; - N.removeEventListener("dispose", ue), Q(N); - } - function Q(E) { - be(E), me.remove(E); - } - function be(E) { - let N = me.get(E).programs; - N !== void 0 && (N.forEach(function(V) { - B.releaseProgram(V); - }), E.isShaderMaterial && B.releaseShaderCache(E)); - } - this.renderBufferDirect = function(E, N, V, F, k, xe) { - N === null && (N = it); - let Ae = k.isMesh && k.matrixWorld.determinant() < 0, Ue = Fd(E, N, V, F, k); - J.setMaterial(F, Ae); - let De = V.index, We = 1; - if (F.wireframe === !0) { - if (De = C.getWireframeAttribute(V), De === void 0) return; - We = 2; - } - let Pe = V.drawRange, Ve = V.attributes.position, at = Pe.start * We, lt = (Pe.start + Pe.count) * We; - xe !== null && (at = Math.max(at, xe.start * We), lt = Math.min(lt, (xe.start + xe.count) * We)), De !== null ? (at = Math.max(at, 0), lt = Math.min(lt, De.count)) : Ve != null && (at = Math.max(at, 0), lt = Math.min(lt, Ve.count)); - let Ht = lt - at; - if (Ht < 0 || Ht === 1 / 0) return; - Oe.setup(k, F, Ue, V, De); - let an, ut = Ze; - if (De !== null && (an = rt.get(De), ut = se, ut.setIndex(an)), k.isMesh) F.wireframe === !0 ? (J.setLineWidth(F.wireframeLinewidth * Ce()), ut.setMode(L.LINES)) : ut.setMode(L.TRIANGLES); - else if (k.isLine) { - let Xe = F.linewidth; - Xe === void 0 && (Xe = 1), J.setLineWidth(Xe * Ce()), k.isLineSegments ? ut.setMode(L.LINES) : k.isLineLoop ? ut.setMode(L.LINE_LOOP) : ut.setMode(L.LINE_STRIP); - } else k.isPoints ? ut.setMode(L.POINTS) : k.isSprite && ut.setMode(L.TRIANGLES); - if (k.isInstancedMesh) ut.renderInstances(at, Ht, k.count); - else if (V.isInstancedBufferGeometry) { - let Xe = V._maxInstanceCount !== void 0 ? V._maxInstanceCount : 1 / 0, Sa = Math.min(V.instanceCount, Xe); - ut.renderInstances(at, Ht, Sa); - } else ut.render(at, Ht); - }, this.compile = function(E, N) { - function V(F, k, xe) { - F.transparent === !0 && F.side === gn && F.forceSinglePass === !1 ? (F.side = Ft, F.needsUpdate = !0, Hs(F, k, xe), F.side = Bn, F.needsUpdate = !0, Hs(F, k, xe), F.side = gn) : Hs(F, k, xe); - } - g = te.get(E), g.init(), v.push(g), E.traverseVisible(function(F) { - F.isLight && F.layers.test(N.layers) && (g.pushLight(F), F.castShadow && g.pushShadow(F)); - }), g.setupLights(x1._useLegacyLights), E.traverse(function(F) { - let k = F.material; - if (k) if (Array.isArray(k)) for(let xe = 0; xe < k.length; xe++){ - let Ae = k[xe]; - V(Ae, E, F); - } - else V(k, E, F); - }), v.pop(), g = null; - }; - let Fe = null; - function At(E) { - Fe && Fe(E); - } - function tt() { - Rt.stop(); - } - function tn() { - Rt.start(); - } - let Rt = new Ed; - Rt.setAnimationLoop(At), typeof self < "u" && Rt.setContext(self), this.setAnimationLoop = function(E) { - Fe = E, P.setAnimationLoop(E), E === null ? Rt.stop() : Rt.start(); - }, P.addEventListener("sessionstart", tt), P.addEventListener("sessionend", tn), this.render = function(E, N) { - if (N !== void 0 && N.isCamera !== !0) { - console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); - return; - } - if (y1 === !0) return; - E.matrixWorldAutoUpdate === !0 && E.updateMatrixWorld(), N.parent === null && N.matrixWorldAutoUpdate === !0 && N.updateMatrixWorld(), P.enabled === !0 && P.isPresenting === !0 && (P.cameraAutoUpdate === !0 && P.updateCamera(N), N = P.getCamera()), E.isScene === !0 && E.onBeforeRender(x1, E, N, R), g = te.get(E, v.length), g.init(), v.push(g), Ee.multiplyMatrices(N.projectionMatrix, N.matrixWorldInverse), he.setFromProjectionMatrix(Ee), _e = this.localClippingEnabled, fe = Me.init(this.clippingPlanes, _e), _ = j.get(E, p.length), _.init(), p.push(_), jc(E, N, 0, x1.sortObjects), _.finish(), x1.sortObjects === !0 && _.sort(ne, W), this.info.render.frame++, fe === !0 && Me.beginShadows(); - let V = g.state.shadowsArray; - if (re.render(V, E, N), fe === !0 && Me.endShadows(), this.info.autoReset === !0 && this.info.reset(), de.render(_, E), g.setupLights(x1._useLegacyLights), N.isArrayCamera) { - let F = N.cameras; - for(let k = 0, xe = F.length; k < xe; k++){ - let Ae = F[k]; - el(_, E, Ae, Ae.viewport); - } - } else el(_, E, N); - R !== null && (ye.updateMultisampleRenderTarget(R), ye.updateRenderTargetMipmap(R)), E.isScene === !0 && E.onAfterRender(x1, E, N), Oe.resetDefaultState(), I = -1, M = null, v.pop(), v.length > 0 ? g = v[v.length - 1] : g = null, p.pop(), p.length > 0 ? _ = p[p.length - 1] : _ = null; - }; - function jc(E, N, V, F) { - if (E.visible === !1) return; - if (E.layers.test(N.layers)) { - if (E.isGroup) V = E.renderOrder; - else if (E.isLOD) E.autoUpdate === !0 && E.update(N); - else if (E.isLight) g.pushLight(E), E.castShadow && g.pushShadow(E); - else if (E.isSprite) { - if (!E.frustumCulled || he.intersectsSprite(E)) { - F && Ye.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Ee); - let Ae = S.update(E), Ue = E.material; - Ue.visible && _.push(E, Ae, Ue, V, Ye.z, null); - } - } else if ((E.isMesh || E.isLine || E.isPoints) && (!E.frustumCulled || he.intersectsObject(E))) { - let Ae = S.update(E), Ue = E.material; - if (F && (E.boundingSphere !== void 0 ? (E.boundingSphere === null && E.computeBoundingSphere(), Ye.copy(E.boundingSphere.center)) : (Ae.boundingSphere === null && Ae.computeBoundingSphere(), Ye.copy(Ae.boundingSphere.center)), Ye.applyMatrix4(E.matrixWorld).applyMatrix4(Ee)), Array.isArray(Ue)) { - let De = Ae.groups; - for(let We = 0, Pe = De.length; We < Pe; We++){ - let Ve = De[We], at = Ue[Ve.materialIndex]; - at && at.visible && _.push(E, Ae, at, V, Ye.z, Ve); - } - } else Ue.visible && _.push(E, Ae, Ue, V, Ye.z, null); - } - } - let xe = E.children; - for(let Ae = 0, Ue = xe.length; Ae < Ue; Ae++)jc(xe[Ae], N, V, F); - } - function el(E, N, V, F) { - let k = E.opaque, xe = E.transmissive, Ae = E.transparent; - g.setupLightsView(V), fe === !0 && Me.setGlobalState(x1.clippingPlanes, V), xe.length > 0 && Od(k, xe, N, V), F && J.viewport(T.copy(F)), k.length > 0 && ks(k, N, V), xe.length > 0 && ks(xe, N, V), Ae.length > 0 && ks(Ae, N, V), J.buffers.depth.setTest(!0), J.buffers.depth.setMask(!0), J.buffers.color.setMask(!0), J.setPolygonOffset(!1); - } - function Od(E, N, V, F) { - let k = ie.isWebGL2; - we === null && (we = new qt(1, 1, { - generateMipmaps: !0, - type: X.has("EXT_color_buffer_half_float") ? Ts : On, - minFilter: li, - samples: k ? 4 : 0 - })), x1.getDrawingBufferSize(Te), k ? we.setSize(Te.x, Te.y) : we.setSize(Wr(Te.x), Wr(Te.y)); - let xe = x1.getRenderTarget(); - x1.setRenderTarget(we), x1.getClearColor($), U = x1.getClearAlpha(), U < 1 && x1.setClearColor(16777215, .5), x1.clear(); - let Ae = x1.toneMapping; - x1.toneMapping = Nn, ks(E, V, F), ye.updateMultisampleRenderTarget(we), ye.updateRenderTargetMipmap(we); - let Ue = !1; - for(let De = 0, We = N.length; De < We; De++){ - let Pe = N[De], Ve = Pe.object, at = Pe.geometry, lt = Pe.material, Ht = Pe.group; - if (lt.side === gn && Ve.layers.test(F.layers)) { - let an = lt.side; - lt.side = Ft, lt.needsUpdate = !0, tl(Ve, V, F, at, lt, Ht), lt.side = an, lt.needsUpdate = !0, Ue = !0; - } - } - Ue === !0 && (ye.updateMultisampleRenderTarget(we), ye.updateRenderTargetMipmap(we)), x1.setRenderTarget(xe), x1.setClearColor($, U), x1.toneMapping = Ae; - } - function ks(E, N, V) { - let F = N.isScene === !0 ? N.overrideMaterial : null; - for(let k = 0, xe = E.length; k < xe; k++){ - let Ae = E[k], Ue = Ae.object, De = Ae.geometry, We = F === null ? Ae.material : F, Pe = Ae.group; - Ue.layers.test(V.layers) && tl(Ue, N, V, De, We, Pe); - } - } - function tl(E, N, V, F, k, xe) { - E.onBeforeRender(x1, N, V, F, k, xe), E.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse, E.matrixWorld), E.normalMatrix.getNormalMatrix(E.modelViewMatrix), k.onBeforeRender(x1, N, V, F, E, xe), k.transparent === !0 && k.side === gn && k.forceSinglePass === !1 ? (k.side = Ft, k.needsUpdate = !0, x1.renderBufferDirect(V, N, F, k, E, xe), k.side = Bn, k.needsUpdate = !0, x1.renderBufferDirect(V, N, F, k, E, xe), k.side = gn) : x1.renderBufferDirect(V, N, F, k, E, xe), E.onAfterRender(x1, N, V, F, k, xe); - } - function Hs(E, N, V) { - N.isScene !== !0 && (N = it); - let F = me.get(E), k = g.state.lights, xe = g.state.shadowsArray, Ae = k.state.version, Ue = B.getParameters(E, k.state, xe, N, V), De = B.getProgramCacheKey(Ue), We = F.programs; - F.environment = E.isMeshStandardMaterial ? N.environment : null, F.fog = N.fog, F.envMap = (E.isMeshStandardMaterial ? qe : Ne).get(E.envMap || F.environment), We === void 0 && (E.addEventListener("dispose", ue), We = new Map, F.programs = We); - let Pe = We.get(De); - if (Pe !== void 0) { - if (F.currentProgram === Pe && F.lightsStateVersion === Ae) return nl(E, Ue), Pe; - } else Ue.uniforms = B.getUniforms(E), E.onBuild(V, Ue, x1), E.onBeforeCompile(Ue, x1), Pe = B.acquireProgram(Ue, De), We.set(De, Pe), F.uniforms = Ue.uniforms; - let Ve = F.uniforms; - (!E.isShaderMaterial && !E.isRawShaderMaterial || E.clipping === !0) && (Ve.clippingPlanes = Me.uniform), nl(E, Ue), F.needsLights = zd(E), F.lightsStateVersion = Ae, F.needsLights && (Ve.ambientLightColor.value = k.state.ambient, Ve.lightProbe.value = k.state.probe, Ve.directionalLights.value = k.state.directional, Ve.directionalLightShadows.value = k.state.directionalShadow, Ve.spotLights.value = k.state.spot, Ve.spotLightShadows.value = k.state.spotShadow, Ve.rectAreaLights.value = k.state.rectArea, Ve.ltc_1.value = k.state.rectAreaLTC1, Ve.ltc_2.value = k.state.rectAreaLTC2, Ve.pointLights.value = k.state.point, Ve.pointLightShadows.value = k.state.pointShadow, Ve.hemisphereLights.value = k.state.hemi, Ve.directionalShadowMap.value = k.state.directionalShadowMap, Ve.directionalShadowMatrix.value = k.state.directionalShadowMatrix, Ve.spotShadowMap.value = k.state.spotShadowMap, Ve.spotLightMatrix.value = k.state.spotLightMatrix, Ve.spotLightMap.value = k.state.spotLightMap, Ve.pointShadowMap.value = k.state.pointShadowMap, Ve.pointShadowMatrix.value = k.state.pointShadowMatrix); - let at = Pe.getUniforms(), lt = qi.seqWithValue(at.seq, Ve); - return F.currentProgram = Pe, F.uniformsList = lt, Pe; - } - function nl(E, N) { - let V = me.get(E); - V.outputColorSpace = N.outputColorSpace, V.instancing = N.instancing, V.instancingColor = N.instancingColor, V.skinning = N.skinning, V.morphTargets = N.morphTargets, V.morphNormals = N.morphNormals, V.morphColors = N.morphColors, V.morphTargetsCount = N.morphTargetsCount, V.numClippingPlanes = N.numClippingPlanes, V.numIntersection = N.numClipIntersection, V.vertexAlphas = N.vertexAlphas, V.vertexTangents = N.vertexTangents, V.toneMapping = N.toneMapping; - } - function Fd(E, N, V, F, k) { - N.isScene !== !0 && (N = it), ye.resetTextureUnits(); - let xe = N.fog, Ae = F.isMeshStandardMaterial ? N.environment : null, Ue = R === null ? x1.outputColorSpace : R.isXRRenderTarget === !0 ? R.texture.colorSpace : Mn, De = (F.isMeshStandardMaterial ? qe : Ne).get(F.envMap || Ae), We = F.vertexColors === !0 && !!V.attributes.color && V.attributes.color.itemSize === 4, Pe = !!V.attributes.tangent && (!!F.normalMap || F.anisotropy > 0), Ve = !!V.morphAttributes.position, at = !!V.morphAttributes.normal, lt = !!V.morphAttributes.color, Ht = Nn; - F.toneMapped && (R === null || R.isXRRenderTarget === !0) && (Ht = x1.toneMapping); - let an = V.morphAttributes.position || V.morphAttributes.normal || V.morphAttributes.color, ut = an !== void 0 ? an.length : 0, Xe = me.get(F), Sa = g.state.lights; - if (fe === !0 && (_e === !0 || E !== M)) { - let Bt = E === M && F.id === I; - Me.setState(F, E, Bt); - } - let dt = !1; - F.version === Xe.__version ? (Xe.needsLights && Xe.lightsStateVersion !== Sa.state.version || Xe.outputColorSpace !== Ue || k.isInstancedMesh && Xe.instancing === !1 || !k.isInstancedMesh && Xe.instancing === !0 || k.isSkinnedMesh && Xe.skinning === !1 || !k.isSkinnedMesh && Xe.skinning === !0 || k.isInstancedMesh && Xe.instancingColor === !0 && k.instanceColor === null || k.isInstancedMesh && Xe.instancingColor === !1 && k.instanceColor !== null || Xe.envMap !== De || F.fog === !0 && Xe.fog !== xe || Xe.numClippingPlanes !== void 0 && (Xe.numClippingPlanes !== Me.numPlanes || Xe.numIntersection !== Me.numIntersection) || Xe.vertexAlphas !== We || Xe.vertexTangents !== Pe || Xe.morphTargets !== Ve || Xe.morphNormals !== at || Xe.morphColors !== lt || Xe.toneMapping !== Ht || ie.isWebGL2 === !0 && Xe.morphTargetsCount !== ut) && (dt = !0) : (dt = !0, Xe.__version = F.version); - let Hn = Xe.currentProgram; - dt === !0 && (Hn = Hs(F, N, k)); - let il = !1, os = !1, ba = !1, Ct = Hn.getUniforms(), Gn = Xe.uniforms; - if (J.useProgram(Hn.program) && (il = !0, os = !0, ba = !0), F.id !== I && (I = F.id, os = !0), il || M !== E) { - Ct.setValue(L, "projectionMatrix", E.projectionMatrix), Ct.setValue(L, "viewMatrix", E.matrixWorldInverse); - let Bt = Ct.map.cameraPosition; - Bt !== void 0 && Bt.setValue(L, Ye.setFromMatrixPosition(E.matrixWorld)), ie.logarithmicDepthBuffer && Ct.setValue(L, "logDepthBufFC", 2 / (Math.log(E.far + 1) / Math.LN2)), (F.isMeshPhongMaterial || F.isMeshToonMaterial || F.isMeshLambertMaterial || F.isMeshBasicMaterial || F.isMeshStandardMaterial || F.isShaderMaterial) && Ct.setValue(L, "isOrthographic", E.isOrthographicCamera === !0), M !== E && (M = E, os = !0, ba = !0); - } - if (k.isSkinnedMesh) { - Ct.setOptional(L, k, "bindMatrix"), Ct.setOptional(L, k, "bindMatrixInverse"); - let Bt = k.skeleton; - Bt && (ie.floatVertexTextures ? (Bt.boneTexture === null && Bt.computeBoneTexture(), Ct.setValue(L, "boneTexture", Bt.boneTexture, ye), Ct.setValue(L, "boneTextureSize", Bt.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.")); - } - let Ea = V.morphAttributes; - if ((Ea.position !== void 0 || Ea.normal !== void 0 || Ea.color !== void 0 && ie.isWebGL2 === !0) && Le.update(k, V, Hn), (os || Xe.receiveShadow !== k.receiveShadow) && (Xe.receiveShadow = k.receiveShadow, Ct.setValue(L, "receiveShadow", k.receiveShadow)), F.isMeshGouraudMaterial && F.envMap !== null && (Gn.envMap.value = De, Gn.flipEnvMap.value = De.isCubeTexture && De.isRenderTargetTexture === !1 ? -1 : 1), os && (Ct.setValue(L, "toneMappingExposure", x1.toneMappingExposure), Xe.needsLights && Bd(Gn, ba), xe && F.fog === !0 && ee.refreshFogUniforms(Gn, xe), ee.refreshMaterialUniforms(Gn, F, H, q, we), qi.upload(L, Xe.uniformsList, Gn, ye)), F.isShaderMaterial && F.uniformsNeedUpdate === !0 && (qi.upload(L, Xe.uniformsList, Gn, ye), F.uniformsNeedUpdate = !1), F.isSpriteMaterial && Ct.setValue(L, "center", k.center), Ct.setValue(L, "modelViewMatrix", k.modelViewMatrix), Ct.setValue(L, "normalMatrix", k.normalMatrix), Ct.setValue(L, "modelMatrix", k.matrixWorld), F.isShaderMaterial || F.isRawShaderMaterial) { - let Bt = F.uniformsGroups; - for(let Ta = 0, Vd = Bt.length; Ta < Vd; Ta++)if (ie.isWebGL2) { - let sl = Bt[Ta]; - Ie.update(sl, Hn), Ie.bind(sl, Hn); - } else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2."); - } - return Hn; - } - function Bd(E, N) { - E.ambientLightColor.needsUpdate = N, E.lightProbe.needsUpdate = N, E.directionalLights.needsUpdate = N, E.directionalLightShadows.needsUpdate = N, E.pointLights.needsUpdate = N, E.pointLightShadows.needsUpdate = N, E.spotLights.needsUpdate = N, E.spotLightShadows.needsUpdate = N, E.rectAreaLights.needsUpdate = N, E.hemisphereLights.needsUpdate = N; - } - function zd(E) { - return E.isMeshLambertMaterial || E.isMeshToonMaterial || E.isMeshPhongMaterial || E.isMeshStandardMaterial || E.isShadowMaterial || E.isShaderMaterial && E.lights === !0; - } - this.getActiveCubeFace = function() { - return b; - }, this.getActiveMipmapLevel = function() { - return w; - }, this.getRenderTarget = function() { - return R; - }, this.setRenderTargetTextures = function(E, N, V) { - me.get(E.texture).__webglTexture = N, me.get(E.depthTexture).__webglTexture = V; - let F = me.get(E); - F.__hasExternalTextures = !0, F.__hasExternalTextures && (F.__autoAllocateDepthBuffer = V === void 0, F.__autoAllocateDepthBuffer || X.has("WEBGL_multisampled_render_to_texture") === !0 && (console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"), F.__useRenderToTexture = !1)); - }, this.setRenderTargetFramebuffer = function(E, N) { - let V = me.get(E); - V.__webglFramebuffer = N, V.__useDefaultFramebuffer = N === void 0; - }, this.setRenderTarget = function(E, N = 0, V = 0) { - R = E, b = N, w = V; - let F = !0, k = null, xe = !1, Ae = !1; - if (E) { - let De = me.get(E); - De.__useDefaultFramebuffer !== void 0 ? (J.bindFramebuffer(L.FRAMEBUFFER, null), F = !1) : De.__webglFramebuffer === void 0 ? ye.setupRenderTarget(E) : De.__hasExternalTextures && ye.rebindTextures(E, me.get(E.texture).__webglTexture, me.get(E.depthTexture).__webglTexture); - let We = E.texture; - (We.isData3DTexture || We.isDataArrayTexture || We.isCompressedArrayTexture) && (Ae = !0); - let Pe = me.get(E).__webglFramebuffer; - E.isWebGLCubeRenderTarget ? (Array.isArray(Pe[N]) ? k = Pe[N][V] : k = Pe[N], xe = !0) : ie.isWebGL2 && E.samples > 0 && ye.useMultisampledRTT(E) === !1 ? k = me.get(E).__webglMultisampledFramebuffer : Array.isArray(Pe) ? k = Pe[V] : k = Pe, T.copy(E.viewport), O.copy(E.scissor), Y = E.scissorTest; - } else T.copy(K).multiplyScalar(H).floor(), O.copy(D).multiplyScalar(H).floor(), Y = G; - if (J.bindFramebuffer(L.FRAMEBUFFER, k) && ie.drawBuffers && F && J.drawBuffers(E, k), J.viewport(T), J.scissor(O), J.setScissorTest(Y), xe) { - let De = me.get(E.texture); - L.framebufferTexture2D(L.FRAMEBUFFER, L.COLOR_ATTACHMENT0, L.TEXTURE_CUBE_MAP_POSITIVE_X + N, De.__webglTexture, V); - } else if (Ae) { - let De = me.get(E.texture), We = N || 0; - L.framebufferTextureLayer(L.FRAMEBUFFER, L.COLOR_ATTACHMENT0, De.__webglTexture, V || 0, We); - } - I = -1; - }, this.readRenderTargetPixels = function(E, N, V, F, k, xe, Ae) { - if (!(E && E.isWebGLRenderTarget)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); - return; - } - let Ue = me.get(E).__webglFramebuffer; - if (E.isWebGLCubeRenderTarget && Ae !== void 0 && (Ue = Ue[Ae]), Ue) { - J.bindFramebuffer(L.FRAMEBUFFER, Ue); - try { - let De = E.texture, We = De.format, Pe = De.type; - if (We !== Wt && $e.convert(We) !== L.getParameter(L.IMPLEMENTATION_COLOR_READ_FORMAT)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); - return; - } - let Ve = Pe === Ts && (X.has("EXT_color_buffer_half_float") || ie.isWebGL2 && X.has("EXT_color_buffer_float")); - if (Pe !== On && $e.convert(Pe) !== L.getParameter(L.IMPLEMENTATION_COLOR_READ_TYPE) && !(Pe === xn && (ie.isWebGL2 || X.has("OES_texture_float") || X.has("WEBGL_color_buffer_float"))) && !Ve) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); - return; - } - N >= 0 && N <= E.width - F && V >= 0 && V <= E.height - k && L.readPixels(N, V, F, k, $e.convert(We), $e.convert(Pe), xe); - } finally{ - let De = R !== null ? me.get(R).__webglFramebuffer : null; - J.bindFramebuffer(L.FRAMEBUFFER, De); - } - } - }, this.copyFramebufferToTexture = function(E, N, V = 0) { - let F = Math.pow(2, -V), k = Math.floor(N.image.width * F), xe = Math.floor(N.image.height * F); - ye.setTexture2D(N, 0), L.copyTexSubImage2D(L.TEXTURE_2D, V, 0, 0, E.x, E.y, k, xe), J.unbindTexture(); - }, this.copyTextureToTexture = function(E, N, V, F = 0) { - let k = N.image.width, xe = N.image.height, Ae = $e.convert(V.format), Ue = $e.convert(V.type); - ye.setTexture2D(V, 0), L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL, V.flipY), L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL, V.premultiplyAlpha), L.pixelStorei(L.UNPACK_ALIGNMENT, V.unpackAlignment), N.isDataTexture ? L.texSubImage2D(L.TEXTURE_2D, F, E.x, E.y, k, xe, Ae, Ue, N.image.data) : N.isCompressedTexture ? L.compressedTexSubImage2D(L.TEXTURE_2D, F, E.x, E.y, N.mipmaps[0].width, N.mipmaps[0].height, Ae, N.mipmaps[0].data) : L.texSubImage2D(L.TEXTURE_2D, F, E.x, E.y, Ae, Ue, N.image), F === 0 && V.generateMipmaps && L.generateMipmap(L.TEXTURE_2D), J.unbindTexture(); - }, this.copyTextureToTexture3D = function(E, N, V, F, k = 0) { - if (x1.isWebGL1Renderer) { - console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2."); - return; - } - let xe = E.max.x - E.min.x + 1, Ae = E.max.y - E.min.y + 1, Ue = E.max.z - E.min.z + 1, De = $e.convert(F.format), We = $e.convert(F.type), Pe; - if (F.isData3DTexture) ye.setTexture3D(F, 0), Pe = L.TEXTURE_3D; - else if (F.isDataArrayTexture) ye.setTexture2DArray(F, 0), Pe = L.TEXTURE_2D_ARRAY; - else { - console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray."); - return; - } - L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL, F.flipY), L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL, F.premultiplyAlpha), L.pixelStorei(L.UNPACK_ALIGNMENT, F.unpackAlignment); - let Ve = L.getParameter(L.UNPACK_ROW_LENGTH), at = L.getParameter(L.UNPACK_IMAGE_HEIGHT), lt = L.getParameter(L.UNPACK_SKIP_PIXELS), Ht = L.getParameter(L.UNPACK_SKIP_ROWS), an = L.getParameter(L.UNPACK_SKIP_IMAGES), ut = V.isCompressedTexture ? V.mipmaps[0] : V.image; - L.pixelStorei(L.UNPACK_ROW_LENGTH, ut.width), L.pixelStorei(L.UNPACK_IMAGE_HEIGHT, ut.height), L.pixelStorei(L.UNPACK_SKIP_PIXELS, E.min.x), L.pixelStorei(L.UNPACK_SKIP_ROWS, E.min.y), L.pixelStorei(L.UNPACK_SKIP_IMAGES, E.min.z), V.isDataTexture || V.isData3DTexture ? L.texSubImage3D(Pe, k, N.x, N.y, N.z, xe, Ae, Ue, De, We, ut.data) : V.isCompressedArrayTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), L.compressedTexSubImage3D(Pe, k, N.x, N.y, N.z, xe, Ae, Ue, De, ut.data)) : L.texSubImage3D(Pe, k, N.x, N.y, N.z, xe, Ae, Ue, De, We, ut), L.pixelStorei(L.UNPACK_ROW_LENGTH, Ve), L.pixelStorei(L.UNPACK_IMAGE_HEIGHT, at), L.pixelStorei(L.UNPACK_SKIP_PIXELS, lt), L.pixelStorei(L.UNPACK_SKIP_ROWS, Ht), L.pixelStorei(L.UNPACK_SKIP_IMAGES, an), k === 0 && F.generateMipmaps && L.generateMipmap(Pe), J.unbindTexture(); - }, this.initTexture = function(E) { - E.isCubeTexture ? ye.setTextureCube(E, 0) : E.isData3DTexture ? ye.setTexture3D(E, 0) : E.isDataArrayTexture || E.isCompressedArrayTexture ? ye.setTexture2DArray(E, 0) : ye.setTexture2D(E, 0), J.unbindTexture(); - }, this.resetState = function() { - b = 0, w = 0, R = null, J.reset(), Oe.reset(); - }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { - detail: this - })); + setMaxDistance(t) { + return this.panner.maxDistance = t, this; } - get coordinateSystem() { - return vn; + setDirectionalCone(t, e, i) { + return this.panner.coneInnerAngle = t, this.panner.coneOuterAngle = e, this.panner.coneOuterGain = i, this; } - get outputColorSpace() { - return this._outputColorSpace; + updateMatrixWorld(t) { + if (super.updateMatrixWorld(t), this.hasPlaybackControl === !0 && this.isPlaying === !1) return; + this.matrixWorld.decompose(Pe, Ph, _d), Oe.set(0, 0, 1).applyQuaternion(Ph); + let e = this.panner; + if (e.positionX) { + let i = this.context.currentTime + this.listener.timeDelta; + e.positionX.linearRampToValueAtTime(Pe.x, i), e.positionY.linearRampToValueAtTime(Pe.y, i), e.positionZ.linearRampToValueAtTime(Pe.z, i), e.orientationX.linearRampToValueAtTime(Oe.x, i), e.orientationY.linearRampToValueAtTime(Oe.y, i), e.orientationZ.linearRampToValueAtTime(Oe.z, i); + } else e.setPosition(Pe.x, Pe.y, Pe.z), e.setOrientation(Oe.x, Oe.y, Oe.z); } - set outputColorSpace(e) { - this._outputColorSpace = e; - let t = this.getContext(); - t.drawingBufferColorSpace = e === qc ? "display-p3" : "srgb", t.unpackColorSpace = Qe.workingColorSpace === va ? "display-p3" : "srgb"; +}, Nh = class { + constructor(t, e = 2048){ + this.analyser = t.context.createAnalyser(), this.analyser.fftSize = e, this.data = new Uint8Array(this.analyser.frequencyBinCount), t.getOutput().connect(this.analyser); } - get physicallyCorrectLights() { - return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."), !this.useLegacyLights; + getFrequencyData() { + return this.analyser.getByteFrequencyData(this.data), this.data; } - set physicallyCorrectLights(e) { - console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."), this.useLegacyLights = !e; + getAverageFrequency() { + let t = 0, e = this.getFrequencyData(); + for(let i = 0; i < e.length; i++)t += e[i]; + return t / e.length; + } +}, Po = class { + constructor(t, e, i){ + this.binding = t, this.valueSize = i; + let s, n, r; + switch(e){ + case "quaternion": + s = this._slerp, n = this._slerpAdditive, r = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(i * 6), this._workIndex = 5; + break; + case "string": + case "bool": + s = this._select, n = this._select, r = this._setAdditiveIdentityOther, this.buffer = new Array(i * 5); + break; + default: + s = this._lerp, n = this._lerpAdditive, r = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(i * 5); + } + this._mixBufferRegion = s, this._mixBufferRegionAdditive = n, this._setIdentity = r, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0; } - get outputEncoding() { - return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."), this.outputColorSpace === vt ? ri : vd; + accumulate(t, e) { + let i = this.buffer, s = this.valueSize, n = t * s + s, r = this.cumulativeWeight; + if (r === 0) { + for(let o = 0; o !== s; ++o)i[n + o] = i[o]; + r = e; + } else { + r += e; + let o = e / r; + this._mixBufferRegion(i, n, 0, o, s); + } + this.cumulativeWeight = r; } - set outputEncoding(e) { - console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."), this.outputColorSpace = e === ri ? vt : Mn; + accumulateAdditive(t) { + let e = this.buffer, i = this.valueSize, s = i * this._addIndex; + this.cumulativeWeightAdditive === 0 && this._setIdentity(), this._mixBufferRegionAdditive(e, s, 0, t, i), this.cumulativeWeightAdditive += t; } - get useLegacyLights() { - return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."), this._useLegacyLights; + apply(t) { + let e = this.valueSize, i = this.buffer, s = t * e + e, n = this.cumulativeWeight, r = this.cumulativeWeightAdditive, o = this.binding; + if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, n < 1) { + let a = e * this._origIndex; + this._mixBufferRegion(i, s, a, 1 - n, e); + } + r > 0 && this._mixBufferRegionAdditive(i, s, this._addIndex * e, 1, e); + for(let a = e, l = e + e; a !== l; ++a)if (i[a] !== i[a + e]) { + o.setValue(i, s); + break; + } } - set useLegacyLights(e) { - console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."), this._useLegacyLights = e; + saveOriginalState() { + let t = this.binding, e = this.buffer, i = this.valueSize, s = i * this._origIndex; + t.getValue(e, s); + for(let n = i, r = s; n !== r; ++n)e[n] = e[s + n % i]; + this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0; } -}, Co = class extends Ro { -}; -Co.prototype.isWebGL1Renderer = !0; -var Po = class s1 { - constructor(e, t = 25e-5){ - this.isFogExp2 = !0, this.name = "", this.color = new pe(e), this.density = t; + restoreOriginalState() { + let t = this.valueSize * 3; + this.binding.setValue(this.buffer, t); } - clone() { - return new s1(this.color, this.density); + _setAdditiveIdentityNumeric() { + let t = this._addIndex * this.valueSize, e = t + this.valueSize; + for(let i = t; i < e; i++)this.buffer[i] = 0; } - toJSON() { - return { - type: "FogExp2", - name: this.name, - color: this.color.getHex(), - density: this.density - }; + _setAdditiveIdentityQuaternion() { + this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1; } -}, Lo = class s1 { - constructor(e, t = 1, n = 1e3){ - this.isFog = !0, this.name = "", this.color = new pe(e), this.near = t, this.far = n; + _setAdditiveIdentityOther() { + let t = this._origIndex * this.valueSize, e = this._addIndex * this.valueSize; + for(let i = 0; i < this.valueSize; i++)this.buffer[e + i] = this.buffer[t + i]; } - clone() { - return new s1(this.color, this.near, this.far); + _select(t, e, i, s, n) { + if (s >= .5) for(let r = 0; r !== n; ++r)t[e + r] = t[i + r]; } - toJSON() { - return { - type: "Fog", - name: this.name, - color: this.color.getHex(), - near: this.near, - far: this.far - }; + _slerp(t, e, i, s) { + bt.slerpFlat(t, e, t, e, t, i, s); } -}, Io = class extends Je { - 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 - })); + _slerpAdditive(t, e, i, s, n) { + let r = this._workIndex * n; + bt.multiplyQuaternionsFlat(t, r, t, e, t, i), bt.slerpFlat(t, e, t, e, t, r, s); } - 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; + _lerp(t, e, i, s, n) { + let r = 1 - s; + for(let o = 0; o !== n; ++o){ + let a = e + o; + t[a] = t[a] * r + t[i + o] * s; + } } - toJSON(e) { - let 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; + _lerpAdditive(t, e, i, s, n) { + for(let r = 0; r !== n; ++r){ + let o = e + r; + t[o] = t[o] + t[i + r] * s; + } } -}, Is = class { - constructor(e, t){ - this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Hr, this.updateRange = { - offset: 0, - count: -1 - }, this.version = 0, this.uuid = kt(); +}, Jo = "\\[\\]\\.:\\/", vd = new RegExp("[" + Jo + "]", "g"), Zo = "[^" + Jo + "]", Ad = "[^" + Jo.replace("\\.", "") + "]", Sd = /((?:WC+[\/:])*)/.source.replace("WC", Zo), Td = /(WCOD+)?/.source.replace("WCOD", Ad), Id = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Zo), Cd = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Zo), zd = new RegExp("^" + Sd + Td + Id + Cd + "$"), Fd = [ + "material", + "materials", + "bones", + "map" +], Oo = class { + constructor(t, e, i){ + let s = i || J.parseTrackName(e); + this._targetGroup = t, this._bindings = t.subscribe_(e, s); } - onUploadCallback() {} - set needsUpdate(e) { - e === !0 && this.version++; + getValue(t, e) { + this.bind(); + let i = this._targetGroup.nCachedObjects_, s = this._bindings[i]; + s !== void 0 && s.getValue(t, e); } - setUsage(e) { - return this.usage = e, this; + setValue(t, e) { + let i = this._bindings; + for(let s = this._targetGroup.nCachedObjects_, n = i.length; s !== n; ++s)i[s].setValue(t, e); } - copy(e) { - return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this; + bind() { + let t = this._bindings; + for(let e = this._targetGroup.nCachedObjects_, i = t.length; e !== i; ++e)t[e].bind(); } - copyAt(e, t, n) { - e *= this.stride, n *= t.stride; - for(let i = 0, r = this.stride; i < r; i++)this.array[e + i] = t.array[n + i]; - return this; + unbind() { + let t = this._bindings; + for(let e = this._targetGroup.nCachedObjects_, i = t.length; e !== i; ++e)t[e].unbind(); } - set(e, t = 0) { - return this.array.set(e, t), this; +}, J = class h { + constructor(t, e, i){ + this.path = e, this.parsedPath = i || h.parseTrackName(e), this.node = h.findNode(t, this.parsedPath.nodeName), this.rootNode = t, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } - clone(e) { - e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = kt()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer); - let t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), n = new this.constructor(t, this.stride); - return n.setUsage(this.usage), n; + static create(t, e, i) { + return t && t.isAnimationObjectGroup ? new h.Composite(t, e, i) : new h(t, e, i); } - onUpload(e) { - return this.onUploadCallback = e, this; + static sanitizeNodeName(t) { + return t.replace(/\s/g, "_").replace(vd, ""); } - toJSON(e) { - return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = kt()), 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 - }; + static parseTrackName(t) { + let e = zd.exec(t); + if (e === null) throw new Error("PropertyBinding: Cannot parse trackName: " + t); + let i = { + nodeName: e[2], + objectName: e[3], + objectIndex: e[4], + propertyName: e[5], + propertyIndex: e[6] + }, s = i.nodeName && i.nodeName.lastIndexOf("."); + if (s !== void 0 && s !== -1) { + let n = i.nodeName.substring(s + 1); + Fd.indexOf(n) !== -1 && (i.nodeName = i.nodeName.substring(0, s), i.objectName = n); + } + if (i.propertyName === null || i.propertyName.length === 0) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + t); + return i; } -}, Pt = new A, Qi = class s1 { - constructor(e, t, n, i = !1){ - this.isInterleavedBufferAttribute = !0, this.name = "", this.data = e, this.itemSize = t, this.offset = n, this.normalized = i; + static findNode(t, e) { + if (e === void 0 || e === "" || e === "." || e === -1 || e === t.name || e === t.uuid) return t; + if (t.skeleton) { + let i = t.skeleton.getBoneByName(e); + if (i !== void 0) return i; + } + if (t.children) { + let i = function(n) { + for(let r = 0; r < n.length; r++){ + let o = n[r]; + if (o.name === e || o.uuid === e) return o; + let a = i(o.children); + if (a) return a; + } + return null; + }, s = i(t.children); + if (s) return s; + } + return null; } - get count() { - return this.data.count; + _getValue_unavailable() {} + _setValue_unavailable() {} + _getValue_direct(t, e) { + t[e] = this.targetObject[this.propertyName]; } - get array() { - return this.data.array; + _getValue_array(t, e) { + let i = this.resolvedProperty; + for(let s = 0, n = i.length; s !== n; ++s)t[e++] = i[s]; } - set needsUpdate(e) { - this.data.needsUpdate = e; + _getValue_arrayElement(t, e) { + t[e] = this.resolvedProperty[this.propertyIndex]; } - applyMatrix4(e) { - for(let t = 0, n = this.data.count; t < n; t++)Pt.fromBufferAttribute(this, t), Pt.applyMatrix4(e), this.setXYZ(t, Pt.x, Pt.y, Pt.z); - return this; + _getValue_toArray(t, e) { + this.resolvedProperty.toArray(t, e); } - applyNormalMatrix(e) { - for(let t = 0, n = this.count; t < n; t++)Pt.fromBufferAttribute(this, t), Pt.applyNormalMatrix(e), this.setXYZ(t, Pt.x, Pt.y, Pt.z); - return this; + _setValue_direct(t, e) { + this.targetObject[this.propertyName] = t[e]; } - transformDirection(e) { - for(let t = 0, n = this.count; t < n; t++)Pt.fromBufferAttribute(this, t), Pt.transformDirection(e), this.setXYZ(t, Pt.x, Pt.y, Pt.z); - return this; + _setValue_direct_setNeedsUpdate(t, e) { + this.targetObject[this.propertyName] = t[e], this.targetObject.needsUpdate = !0; } - setX(e, t) { - return this.normalized && (t = Be(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this; + _setValue_direct_setMatrixWorldNeedsUpdate(t, e) { + this.targetObject[this.propertyName] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0; } - setY(e, t) { - return this.normalized && (t = Be(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this; + _setValue_array(t, e) { + let i = this.resolvedProperty; + for(let s = 0, n = i.length; s !== n; ++s)i[s] = t[e++]; } - setZ(e, t) { - return this.normalized && (t = Be(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this; + _setValue_array_setNeedsUpdate(t, e) { + let i = this.resolvedProperty; + for(let s = 0, n = i.length; s !== n; ++s)i[s] = t[e++]; + this.targetObject.needsUpdate = !0; } - setW(e, t) { - return this.normalized && (t = Be(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this; + _setValue_array_setMatrixWorldNeedsUpdate(t, e) { + let i = this.resolvedProperty; + for(let s = 0, n = i.length; s !== n; ++s)i[s] = t[e++]; + this.targetObject.matrixWorldNeedsUpdate = !0; } - getX(e) { - let t = this.data.array[e * this.data.stride + this.offset]; - return this.normalized && (t = Ot(t, this.array)), t; + _setValue_arrayElement(t, e) { + this.resolvedProperty[this.propertyIndex] = t[e]; } - getY(e) { - let t = this.data.array[e * this.data.stride + this.offset + 1]; - return this.normalized && (t = Ot(t, this.array)), t; + _setValue_arrayElement_setNeedsUpdate(t, e) { + this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.needsUpdate = !0; } - getZ(e) { - let t = this.data.array[e * this.data.stride + this.offset + 2]; - return this.normalized && (t = Ot(t, this.array)), t; + _setValue_arrayElement_setMatrixWorldNeedsUpdate(t, e) { + this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0; } - getW(e) { - let t = this.data.array[e * this.data.stride + this.offset + 3]; - return this.normalized && (t = Ot(t, this.array)), t; + _setValue_fromArray(t, e) { + this.resolvedProperty.fromArray(t, e); } - setXY(e, t, n) { - return e = e * this.data.stride + this.offset, this.normalized && (t = Be(t, this.array), n = Be(n, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this; + _setValue_fromArray_setNeedsUpdate(t, e) { + this.resolvedProperty.fromArray(t, e), this.targetObject.needsUpdate = !0; } - setXYZ(e, t, n, i) { - return e = e * this.data.stride + this.offset, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this; + _setValue_fromArray_setMatrixWorldNeedsUpdate(t, e) { + this.resolvedProperty.fromArray(t, e), this.targetObject.matrixWorldNeedsUpdate = !0; } - setXYZW(e, t, n, i, r) { - return e = e * this.data.stride + this.offset, this.normalized && (t = Be(t, this.array), n = Be(n, this.array), i = Be(i, this.array), r = Be(r, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this.data.array[e + 3] = r, this; + _getValue_unbound(t, e) { + this.bind(), this.getValue(t, e); } - clone(e) { - if (e === void 0) { - console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data."); - let t = []; - for(let n = 0; n < this.count; n++){ - let i = n * this.data.stride + this.offset; - for(let r = 0; r < this.itemSize; r++)t.push(this.data.array[i + r]); - } - return new et(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 s1(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); + _setValue_unbound(t, e) { + this.bind(), this.setValue(t, e); } - toJSON(e) { - if (e === void 0) { - console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data."); - let t = []; - for(let n = 0; n < this.count; n++){ - let i = n * this.data.stride + this.offset; - for(let r = 0; r < this.itemSize; r++)t.push(this.data.array[i + r]); + bind() { + let t = this.node, e = this.parsedPath, i = e.objectName, s = e.propertyName, n = e.propertyIndex; + if (t || (t = h.findNode(this.rootNode, e.nodeName), this.node = t), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !t) { + console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + "."); + return; + } + if (i) { + let l = e.objectIndex; + switch(i){ + case "materials": + if (!t.material) { + console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); + return; + } + if (!t.material.materials) { + console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); + return; + } + t = t.material.materials; + break; + case "bones": + if (!t.skeleton) { + console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); + return; + } + t = t.skeleton.bones; + for(let c = 0; c < t.length; c++)if (t[c].name === l) { + l = c; + break; + } + break; + case "map": + if ("map" in t) { + t = t.map; + break; + } + if (!t.material) { + console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); + return; + } + if (!t.material.map) { + console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this); + return; + } + t = t.material.map; + break; + default: + if (t[i] === void 0) { + console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); + return; + } + t = t[i]; + } + if (l !== void 0) { + if (t[l] === void 0) { + console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, t); + return; + } + t = t[l]; } - 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 - }; - } -}, ea = class extends bt { - constructor(e){ - super(), this.isSpriteMaterial = !0, this.type = "SpriteMaterial", this.color = new pe(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.rotation = e.rotation, this.sizeAttenuation = e.sizeAttenuation, this.fog = e.fog, this; - } -}, Ii, ds = new A, Ui = new A, Di = new A, Ni = new Z, fs = new Z, Cd = new ze, hr = new A, ps = new A, ur = new A, Lh = new Z, ja = new Z, Ih = new Z, Uo = class extends Je { - constructor(e = new ea){ - if (super(), this.isSprite = !0, this.type = "Sprite", Ii === void 0) { - Ii = new Ge; - let t = new Float32Array([ - -.5, - -.5, - 0, - 0, - 0, - .5, - -.5, - 0, - 1, - 0, - .5, - .5, - 0, - 1, - 1, - -.5, - .5, - 0, - 0, - 1 - ]), n = new Is(t, 5); - Ii.setIndex([ - 0, - 1, - 2, - 0, - 2, - 3 - ]), Ii.setAttribute("position", new Qi(n, 3, 0, !1)), Ii.setAttribute("uv", new Qi(n, 2, 3, !1)); - } - this.geometry = Ii, this.material = e, this.center = new Z(.5, .5); - } - raycast(e, t) { - e.camera === null && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), Ui.setFromMatrixScale(this.matrixWorld), Cd.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), Di.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && Ui.multiplyScalar(-Di.z); - let n = this.material.rotation, i, r; - n !== 0 && (r = Math.cos(n), i = Math.sin(n)); - let a = this.center; - dr(hr.set(-.5, -.5, 0), Di, a, Ui, i, r), dr(ps.set(.5, -.5, 0), Di, a, Ui, i, r), dr(ur.set(.5, .5, 0), Di, a, Ui, i, r), Lh.set(0, 0), ja.set(1, 0), Ih.set(1, 1); - let o = e.ray.intersectTriangle(hr, ps, ur, !1, ds); - if (o === null && (dr(ps.set(-.5, .5, 0), Di, a, Ui, i, r), ja.set(0, 1), o = e.ray.intersectTriangle(hr, ur, ps, !1, ds), o === null)) return; - let c = e.ray.origin.distanceTo(ds); - c < e.near || c > e.far || t.push({ - distance: c, - point: ds.clone(), - uv: Un.getInterpolation(ds, hr, ps, ur, Lh, ja, Ih, new Z), - face: null, - object: this - }); + } + let r = t[s]; + if (r === void 0) { + let l = e.nodeName; + console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + s + " but it wasn't found.", t); + return; + } + let o = this.Versioning.None; + this.targetObject = t, t.isMaterial === !0 ? o = this.Versioning.NeedsUpdate : t.isObject3D === !0 && (o = this.Versioning.MatrixWorldNeedsUpdate); + let a = this.BindingType.Direct; + if (n !== void 0) { + if (s === "morphTargetInfluences") { + if (!t.geometry) { + console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); + return; + } + if (!t.geometry.morphAttributes) { + console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); + return; + } + t.morphTargetDictionary[n] !== void 0 && (n = t.morphTargetDictionary[n]); + } + a = this.BindingType.ArrayElement, this.resolvedProperty = r, this.propertyIndex = n; + } else r.fromArray !== void 0 && r.toArray !== void 0 ? (a = this.BindingType.HasFromToArray, this.resolvedProperty = r) : Array.isArray(r) ? (a = this.BindingType.EntireArray, this.resolvedProperty = r) : this.propertyName = s; + this.getValue = this.GetterByBindingType[a], this.setValue = this.SetterByBindingTypeAndVersioning[a][o]; } - copy(e, t) { - return super.copy(e, t), e.center !== void 0 && this.center.copy(e.center), this.material = e.material, this; + unbind() { + this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } }; -function dr(s1, e, t, n, i, r) { - Ni.subVectors(s1, t).addScalar(.5).multiply(n), i !== void 0 ? (fs.x = r * Ni.x - i * Ni.y, fs.y = i * Ni.x + r * Ni.y) : fs.copy(Ni), s1.copy(e), s1.x += fs.x, s1.y += fs.y, s1.applyMatrix4(Cd); -} -var fr = new A, Uh = new A, Do = class extends Je { +J.Composite = Oo; +J.prototype.BindingType = { + Direct: 0, + EntireArray: 1, + ArrayElement: 2, + HasFromToArray: 3 +}; +J.prototype.Versioning = { + None: 0, + NeedsUpdate: 1, + MatrixWorldNeedsUpdate: 2 +}; +J.prototype.GetterByBindingType = [ + J.prototype._getValue_direct, + J.prototype._getValue_array, + J.prototype._getValue_arrayElement, + J.prototype._getValue_toArray +]; +J.prototype.SetterByBindingTypeAndVersioning = [ + [ + J.prototype._setValue_direct, + J.prototype._setValue_direct_setNeedsUpdate, + J.prototype._setValue_direct_setMatrixWorldNeedsUpdate + ], + [ + J.prototype._setValue_array, + J.prototype._setValue_array_setNeedsUpdate, + J.prototype._setValue_array_setMatrixWorldNeedsUpdate + ], + [ + J.prototype._setValue_arrayElement, + J.prototype._setValue_arrayElement_setNeedsUpdate, + J.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate + ], + [ + J.prototype._setValue_fromArray, + J.prototype._setValue_fromArray_setNeedsUpdate, + J.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate + ] +]; +var Vh = class { constructor(){ - super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { - levels: { - enumerable: !0, - value: [] + this.isAnimationObjectGroup = !0, this.uuid = It(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; + let t = {}; + this._indicesByUUID = t; + for(let i = 0, s = arguments.length; i !== s; ++i)t[arguments[i].uuid] = i; + this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; + let e = this; + this.stats = { + objects: { + get total () { + return e._objects.length; + }, + get inUse () { + return this.total - e.nCachedObjects_; + } }, - isLOD: { - value: !0 + get bindingsPerObject () { + return e._bindings.length; } - }), this.autoUpdate = !0; - } - copy(e) { - super.copy(e, !1); - let t = e.levels; - for(let n = 0, i = t.length; n < i; n++){ - let r = t[n]; - this.addLevel(r.object.clone(), r.distance, r.hysteresis); - } - return this.autoUpdate = e.autoUpdate, this; - } - addLevel(e, t = 0, n = 0) { - t = Math.abs(t); - let i = this.levels, r; - for(r = 0; r < i.length && !(t < i[r].distance); r++); - return i.splice(r, 0, { - distance: t, - hysteresis: n, - object: e - }), this.add(e), this; + }; } - getCurrentLevel() { - return this._currentLevel; + add() { + let t = this._objects, e = this._indicesByUUID, i = this._paths, s = this._parsedPaths, n = this._bindings, r = n.length, o, a = t.length, l = this.nCachedObjects_; + for(let c = 0, u = arguments.length; c !== u; ++c){ + let d = arguments[c], p = d.uuid, f = e[p]; + if (f === void 0) { + f = a++, e[p] = f, t.push(d); + for(let m = 0, y1 = r; m !== y1; ++m)n[m].push(new J(d, i[m], s[m])); + } else if (f < l) { + o = t[f]; + let m = --l, y1 = t[m]; + e[y1.uuid] = f, t[f] = y1, e[p] = m, t[m] = d; + for(let g = 0, x1 = r; g !== x1; ++g){ + let b = n[g], M = b[m], _ = b[f]; + b[f] = M, _ === void 0 && (_ = new J(d, i[g], s[g])), b[m] = _; + } + } else t[f] !== o && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); + } + this.nCachedObjects_ = l; } - getObjectForDistance(e) { - let t = this.levels; - if (t.length > 0) { - let n, i; - for(n = 1, i = t.length; n < i; n++){ - let r = t[n].distance; - if (t[n].object.visible && (r -= r * t[n].hysteresis), e < r) break; + remove() { + let t = this._objects, e = this._indicesByUUID, i = this._bindings, s = i.length, n = this.nCachedObjects_; + for(let r = 0, o = arguments.length; r !== o; ++r){ + let a = arguments[r], l = a.uuid, c = e[l]; + if (c !== void 0 && c >= n) { + let u = n++, d = t[u]; + e[d.uuid] = c, t[c] = d, e[l] = u, t[u] = a; + for(let p = 0, f = s; p !== f; ++p){ + let m = i[p], y1 = m[u], g = m[c]; + m[c] = y1, m[u] = g; + } } - return t[n - 1].object; } - return null; + this.nCachedObjects_ = n; } - raycast(e, t) { - if (this.levels.length > 0) { - fr.setFromMatrixPosition(this.matrixWorld); - let i = e.ray.origin.distanceTo(fr); - this.getObjectForDistance(i).raycast(e, t); - } - } - update(e) { - let t = this.levels; - if (t.length > 1) { - fr.setFromMatrixPosition(e.matrixWorld), Uh.setFromMatrixPosition(this.matrixWorld); - let n = fr.distanceTo(Uh) / e.zoom; - t[0].object.visible = !0; - let i, r; - for(i = 1, r = t.length; i < r; i++){ - let a = t[i].distance; - if (t[i].object.visible && (a -= a * t[i].hysteresis), n >= a) t[i - 1].object.visible = !1, t[i].object.visible = !0; - else break; + uncache() { + let t = this._objects, e = this._indicesByUUID, i = this._bindings, s = i.length, n = this.nCachedObjects_, r = t.length; + for(let o = 0, a = arguments.length; o !== a; ++o){ + let l = arguments[o], c = l.uuid, u = e[c]; + if (u !== void 0) if (delete e[c], u < n) { + let d = --n, p = t[d], f = --r, m = t[f]; + e[p.uuid] = u, t[u] = p, e[m.uuid] = d, t[d] = m, t.pop(); + for(let y1 = 0, g = s; y1 !== g; ++y1){ + let x1 = i[y1], b = x1[d], M = x1[f]; + x1[u] = b, x1[d] = M, x1.pop(); + } + } else { + let d = --r, p = t[d]; + d > 0 && (e[p.uuid] = u), t[u] = p, t.pop(); + for(let f = 0, m = s; f !== m; ++f){ + let y1 = i[f]; + y1[u] = y1[d], y1.pop(); + } } - for(this._currentLevel = i - 1; i < r; i++)t[i].object.visible = !1; } + this.nCachedObjects_ = n; } - toJSON(e) { - let t = super.toJSON(e); - this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = []; - let n = this.levels; - for(let i = 0, r = n.length; i < r; i++){ - let a = n[i]; - t.object.levels.push({ - object: a.object.uuid, - distance: a.distance, - hysteresis: a.hysteresis - }); + subscribe_(t, e) { + let i = this._bindingsIndicesByPath, s = i[t], n = this._bindings; + if (s !== void 0) return n[s]; + let r = this._paths, o = this._parsedPaths, a = this._objects, l = a.length, c = this.nCachedObjects_, u = new Array(l); + s = n.length, i[t] = s, r.push(t), o.push(e), n.push(u); + for(let d = c, p = a.length; d !== p; ++d){ + let f = a[d]; + u[d] = new J(f, t, e); } - return t; + return u; } -}, Dh = new A, Nh = new je, Oh = new je, W0 = new A, Fh = new ze, Oi = new A, eo = new Yt, Bh = new ze, to = new hi, No = class extends Mt { - constructor(e, t){ - super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new ze, this.bindMatrixInverse = new ze, this.boundingBox = null, this.boundingSphere = null; + unsubscribe_(t) { + let e = this._bindingsIndicesByPath, i = e[t]; + if (i !== void 0) { + let s = this._paths, n = this._parsedPaths, r = this._bindings, o = r.length - 1, a = r[o], l = t[o]; + e[l] = i, r[i] = a, r.pop(), n[i] = n[o], n.pop(), s[i] = s[o], s.pop(); + } } - computeBoundingBox() { - let e = this.geometry; - this.boundingBox === null && (this.boundingBox = new Qt), this.boundingBox.makeEmpty(); - let t = e.getAttribute("position"); - for(let n = 0; n < t.count; n++)Oi.fromBufferAttribute(t, n), this.applyBoneTransform(n, Oi), this.boundingBox.expandByPoint(Oi); +}, No = class { + constructor(t, e, i = null, s = e.blendMode){ + this._mixer = t, this._clip = e, this._localRoot = i, this.blendMode = s; + let n = e.tracks, r = n.length, o = new Array(r), a = { + endingStart: hi, + endingEnd: hi + }; + for(let l = 0; l !== r; ++l){ + let c = n[l].createInterpolant(null); + o[l] = c, c.settings = a; + } + this._interpolantSettings = a, this._interpolants = o, this._propertyBindings = new Array(r), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = Gc, 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; } - computeBoundingSphere() { - let e = this.geometry; - this.boundingSphere === null && (this.boundingSphere = new Yt), this.boundingSphere.makeEmpty(); - let t = e.getAttribute("position"); - for(let n = 0; n < t.count; n++)Oi.fromBufferAttribute(t, n), this.applyBoneTransform(n, Oi), this.boundingSphere.expandByPoint(Oi); + 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(); } - copy(e, t) { - return super.copy(e, t), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this; + isRunning() { + return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); } - raycast(e, t) { - let n = this.material, i = this.matrixWorld; - n !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), eo.copy(this.boundingSphere), eo.applyMatrix4(i), e.ray.intersectsSphere(eo) !== !1 && (Bh.copy(i).invert(), to.copy(e.ray).applyMatrix4(Bh), !(this.boundingBox !== null && to.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, to))); + isScheduled() { + return this._mixer._isActiveAction(this); } - getVertexPosition(e, t) { - return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t; + startAt(t) { + return this._startTime = t, 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(); + setLoop(t, e) { + return this.loop = t, this.repetitions = e, this; } - pose() { - this.skeleton.pose(); + setEffectiveWeight(t) { + return this.weight = t, this._effectiveWeight = this.enabled ? t : 0, this.stopFading(); } - normalizeSkinWeights() { - let e = new je, t = this.geometry.attributes.skinWeight; - for(let n = 0, i = t.count; n < i; n++){ - e.fromBufferAttribute(t, n); - let r = 1 / e.manhattanLength(); - r !== 1 / 0 ? e.multiplyScalar(r) : e.set(1, 0, 0, 0), t.setXYZW(n, e.x, e.y, e.z, e.w); - } + getEffectiveWeight() { + return this._effectiveWeight; } - 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); + fadeIn(t) { + return this._scheduleFading(t, 0, 1); } - applyBoneTransform(e, t) { - let n = this.skeleton, i = this.geometry; - Nh.fromBufferAttribute(i.attributes.skinIndex, e), Oh.fromBufferAttribute(i.attributes.skinWeight, e), Dh.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0); - for(let r = 0; r < 4; r++){ - let a = Oh.getComponent(r); - if (a !== 0) { - let o = Nh.getComponent(r); - Fh.multiplyMatrices(n.bones[o].matrixWorld, n.boneInverses[o]), t.addScaledVector(W0.copy(Dh).applyMatrix4(Fh), a); - } + fadeOut(t) { + return this._scheduleFading(t, 1, 0); + } + crossFadeFrom(t, e, i) { + if (t.fadeOut(e), this.fadeIn(e), i) { + let s = this._clip.duration, n = t._clip.duration, r = n / s, o = s / n; + t.warp(1, r, e), this.warp(o, 1, e); } - return t.applyMatrix4(this.bindMatrixInverse); + return this; } - boneTransform(e, t) { - return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."), this.applyBoneTransform(e, t); + crossFadeTo(t, e, i) { + return t.crossFadeFrom(this, e, i); } -}, ta = class extends Je { - constructor(){ - super(), this.isBone = !0, this.type = "Bone"; + stopFading() { + let t = this._weightInterpolant; + return t !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this; } -}, oi = class extends St { - constructor(e = null, t = 1, n = 1, i, r, a, o, c, l = pt, h = pt, u, d){ - super(null, a, o, c, l, h, i, r, u, d), this.isDataTexture = !0, this.image = { - data: e, - width: t, - height: n - }, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; + setEffectiveTimeScale(t) { + return this.timeScale = t, this._effectiveTimeScale = this.paused ? 0 : t, this.stopWarping(); } -}, zh = new ze, X0 = new ze, Oo = class s1 { - constructor(e = [], t = []){ - this.uuid = kt(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.boneTextureSize = 0, this.init(); + getEffectiveTimeScale() { + return this._effectiveTimeScale; } - init() { - let 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 ze); - } + setDuration(t) { + return this.timeScale = this._clip.duration / t, this.stopWarping(); } - calculateInverses() { - this.boneInverses.length = 0; - for(let e = 0, t = this.bones.length; e < t; e++){ - let n = new ze; - this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(n); - } + syncWith(t) { + return this.time = t.time, this.timeScale = t.timeScale, this.stopWarping(); } - pose() { - for(let e = 0, t = this.bones.length; e < t; e++){ - let n = this.bones[e]; - n && n.matrixWorld.copy(this.boneInverses[e]).invert(); - } - for(let e = 0, t = this.bones.length; e < t; e++){ - let 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)); - } + halt(t) { + return this.warp(this._effectiveTimeScale, 0, t); } - update() { - let e = this.bones, t = this.boneInverses, n = this.boneMatrices, i = this.boneTexture; - for(let r = 0, a = e.length; r < a; r++){ - let o = e[r] ? e[r].matrixWorld : X0; - zh.multiplyMatrices(o, t[r]), zh.toArray(n, r * 16); - } - i !== null && (i.needsUpdate = !0); + warp(t, e, i) { + let s = this._mixer, n = s.time, r = this.timeScale, o = this._timeScaleInterpolant; + o === null && (o = s._lendControlInterpolant(), this._timeScaleInterpolant = o); + let a = o.parameterPositions, l = o.sampleValues; + return a[0] = n, a[1] = n + i, l[0] = t / r, l[1] = e / r, this; } - clone() { - return new s1(this.bones, this.boneInverses); + stopWarping() { + let t = this._timeScaleInterpolant; + return t !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this; } - computeBoneTexture() { - let e = Math.sqrt(this.bones.length * 4); - e = yd(e), e = Math.max(e, 4); - let t = new Float32Array(e * e * 4); - t.set(this.boneMatrices); - let n = new oi(t, e, e, Wt, 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++){ - let i = this.bones[t]; - if (i.name === e) return i; - } + getMixer() { + return this._mixer; } - dispose() { - this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null); + getClip() { + return this._clip; } - fromJSON(e, t) { - this.uuid = e.uuid; - for(let n = 0, i = e.bones.length; n < i; n++){ - let r = e.bones[n], a = t[r]; - a === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", r), a = new ta), this.bones.push(a), this.boneInverses.push(new ze().fromArray(e.boneInverses[n])); - } - return this.init(), this; + getRoot() { + return this._localRoot || this._mixer._root; } - toJSON() { - let e = { - metadata: { - version: 4.6, - type: "Skeleton", - generator: "Skeleton.toJSON" - }, - bones: [], - boneInverses: [] - }; - e.uuid = this.uuid; - let t = this.bones, n = this.boneInverses; - for(let i = 0, r = t.length; i < r; i++){ - let a = t[i]; - e.bones.push(a.uuid); - let o = n[i]; - e.boneInverses.push(o.toArray()); + _update(t, e, i, s) { + if (!this.enabled) { + this._updateWeight(t); + return; + } + let n = this._startTime; + if (n !== null) { + let a = (t - n) * i; + a < 0 || i === 0 ? e = 0 : (this._startTime = null, e = i * a); + } + e *= this._updateTimeScale(t); + let r = this._updateTime(e), o = this._updateWeight(t); + if (o > 0) { + let a = this._interpolants, l = this._propertyBindings; + switch(this.blendMode){ + case Cl: + for(let c = 0, u = a.length; c !== u; ++c)a[c].evaluate(r), l[c].accumulateAdditive(o); + break; + case Ho: + default: + for(let c = 0, u = a.length; c !== u; ++c)a[c].evaluate(r), l[c].accumulate(s, o); + } } - return e; } -}, ui = class extends et { - constructor(e, t, n, i = 1){ - super(e, t, n), this.isInstancedBufferAttribute = !0, this.meshPerAttribute = i; + _updateWeight(t) { + let e = 0; + if (this.enabled) { + e = this.weight; + let i = this._weightInterpolant; + if (i !== null) { + let s = i.evaluate(t)[0]; + e *= s, t > i.parameterPositions[1] && (this.stopFading(), s === 0 && (this.enabled = !1)); + } + } + return this._effectiveWeight = e, e; } - copy(e) { - return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; + _updateTimeScale(t) { + let e = 0; + if (!this.paused) { + e = this.timeScale; + let i = this._timeScaleInterpolant; + if (i !== null) { + let s = i.evaluate(t)[0]; + e *= s, t > i.parameterPositions[1] && (this.stopWarping(), e === 0 ? this.paused = !0 : this.timeScale = e); + } + } + return this._effectiveTimeScale = e, e; } - toJSON() { - let e = super.toJSON(); - return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e; + _updateTime(t) { + let e = this._clip.duration, i = this.loop, s = this.time + t, n = this._loopCount, r = i === Xc; + if (t === 0) return n === -1 ? s : r && (n & 1) === 1 ? e - s : s; + if (i === qc) { + n === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1)); + t: { + if (s >= e) s = e; + else if (s < 0) s = 0; + else { + this.time = s; + break t; + } + this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = s, this._mixer.dispatchEvent({ + type: "finished", + action: this, + direction: t < 0 ? -1 : 1 + }); + } + } else { + if (n === -1 && (t >= 0 ? (n = 0, this._setEndings(!0, this.repetitions === 0, r)) : this._setEndings(this.repetitions === 0, !0, r)), s >= e || s < 0) { + let o = Math.floor(s / e); + s -= e * o, n += Math.abs(o); + let a = this.repetitions - n; + if (a <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, s = t > 0 ? e : 0, this.time = s, this._mixer.dispatchEvent({ + type: "finished", + action: this, + direction: t > 0 ? 1 : -1 + }); + else { + if (a === 1) { + let l = t < 0; + this._setEndings(l, !l, r); + } else this._setEndings(!1, !1, r); + this._loopCount = n, this.time = s, this._mixer.dispatchEvent({ + type: "loop", + action: this, + loopDelta: o + }); + } + } else this.time = s; + if (r && (n & 1) === 1) return e - s; + } + return s; + } + _setEndings(t, e, i) { + let s = this._interpolantSettings; + i ? (s.endingStart = li, s.endingEnd = li) : (t ? s.endingStart = this.zeroSlopeAtStart ? li : hi : s.endingStart = Xs, e ? s.endingEnd = this.zeroSlopeAtEnd ? li : hi : s.endingEnd = Xs); + } + _scheduleFading(t, e, i) { + let s = this._mixer, n = s.time, r = this._weightInterpolant; + r === null && (r = s._lendControlInterpolant(), this._weightInterpolant = r); + let o = r.parameterPositions, a = r.sampleValues; + return o[0] = n, a[0] = e, o[1] = n + t, a[1] = i, this; + } +}, Bd = new Float32Array(1), Dh = class extends qt { + constructor(t){ + super(), this._root = t, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1; + } + _bindAction(t, e) { + let i = t._localRoot || this._root, s = t._clip.tracks, n = s.length, r = t._propertyBindings, o = t._interpolants, a = i.uuid, l = this._bindingsByRootAndName, c = l[a]; + c === void 0 && (c = {}, l[a] = c); + for(let u = 0; u !== n; ++u){ + let d = s[u], p = d.name, f = c[p]; + if (f !== void 0) ++f.referenceCount, r[u] = f; + else { + if (f = r[u], f !== void 0) { + f._cacheIndex === null && (++f.referenceCount, this._addInactiveBinding(f, a, p)); + continue; + } + let m = e && e._propertyBindings[u].binding.parsedPath; + f = new Po(J.create(i, p, m), d.ValueTypeName, d.getValueSize()), ++f.referenceCount, this._addInactiveBinding(f, a, p), r[u] = f; + } + o[u].resultBuffer = f.buffer; + } } -}, Fi = new ze, Vh = new ze, pr = [], kh = new Qt, q0 = new ze, ms = new Mt, gs = new Yt, Fo = class extends Mt { - constructor(e, t, n){ - super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new ui(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, q0); + _activateAction(t) { + if (!this._isActiveAction(t)) { + if (t._cacheIndex === null) { + let i = (t._localRoot || this._root).uuid, s = t._clip.uuid, n = this._actionsByClip[s]; + this._bindAction(t, n && n.knownActions[0]), this._addInactiveAction(t, s, i); + } + let e = t._propertyBindings; + for(let i = 0, s = e.length; i !== s; ++i){ + let n = e[i]; + n.useCount++ === 0 && (this._lendBinding(n), n.saveOriginalState()); + } + this._lendAction(t); + } } - computeBoundingBox() { - let e = this.geometry, t = this.count; - this.boundingBox === null && (this.boundingBox = new Qt), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty(); - for(let n = 0; n < t; n++)this.getMatrixAt(n, Fi), kh.copy(e.boundingBox).applyMatrix4(Fi), this.boundingBox.union(kh); + _deactivateAction(t) { + if (this._isActiveAction(t)) { + let e = t._propertyBindings; + for(let i = 0, s = e.length; i !== s; ++i){ + let n = e[i]; + --n.useCount === 0 && (n.restoreOriginalState(), this._takeBackBinding(n)); + } + this._takeBackAction(t); + } } - computeBoundingSphere() { - let e = this.geometry, t = this.count; - this.boundingSphere === null && (this.boundingSphere = new Yt), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty(); - for(let n = 0; n < t; n++)this.getMatrixAt(n, Fi), gs.copy(e.boundingSphere).applyMatrix4(Fi), this.boundingSphere.union(gs); + _initMemoryManager() { + this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; + let t = this; + this.stats = { + actions: { + get total () { + return t._actions.length; + }, + get inUse () { + return t._nActiveActions; + } + }, + bindings: { + get total () { + return t._bindings.length; + }, + get inUse () { + return t._nActiveBindings; + } + }, + controlInterpolants: { + get total () { + return t._controlInterpolants.length; + }, + get inUse () { + return t._nActiveControlInterpolants; + } + } + }; } - copy(e, t) { - return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this; + _isActiveAction(t) { + let e = t._cacheIndex; + return e !== null && e < this._nActiveActions; } - getColorAt(e, t) { - t.fromArray(this.instanceColor.array, e * 3); + _addInactiveAction(t, e, i) { + let s = this._actions, n = this._actionsByClip, r = n[e]; + if (r === void 0) r = { + knownActions: [ + t + ], + actionByRoot: {} + }, t._byClipCacheIndex = 0, n[e] = r; + else { + let o = r.knownActions; + t._byClipCacheIndex = o.length, o.push(t); + } + t._cacheIndex = s.length, s.push(t), r.actionByRoot[i] = t; } - getMatrixAt(e, t) { - t.fromArray(this.instanceMatrix.array, e * 16); + _removeInactiveAction(t) { + let e = this._actions, i = e[e.length - 1], s = t._cacheIndex; + i._cacheIndex = s, e[s] = i, e.pop(), t._cacheIndex = null; + let n = t._clip.uuid, r = this._actionsByClip, o = r[n], a = o.knownActions, l = a[a.length - 1], c = t._byClipCacheIndex; + l._byClipCacheIndex = c, a[c] = l, a.pop(), t._byClipCacheIndex = null; + let u = o.actionByRoot, d = (t._localRoot || this._root).uuid; + delete u[d], a.length === 0 && delete r[n], this._removeInactiveBindingsForAction(t); } - raycast(e, t) { - let n = this.matrixWorld, i = this.count; - if (ms.geometry = this.geometry, ms.material = this.material, ms.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), gs.copy(this.boundingSphere), gs.applyMatrix4(n), e.ray.intersectsSphere(gs) !== !1)) for(let r = 0; r < i; r++){ - this.getMatrixAt(r, Fi), Vh.multiplyMatrices(n, Fi), ms.matrixWorld = Vh, ms.raycast(e, pr); - for(let a = 0, o = pr.length; a < o; a++){ - let c = pr[a]; - c.instanceId = r, c.object = this, t.push(c); - } - pr.length = 0; + _removeInactiveBindingsForAction(t) { + let e = t._propertyBindings; + for(let i = 0, s = e.length; i !== s; ++i){ + let n = e[i]; + --n.referenceCount === 0 && this._removeInactiveBinding(n); } } - setColorAt(e, t) { - this.instanceColor === null && (this.instanceColor = new ui(new Float32Array(this.instanceMatrix.count * 3), 3)), t.toArray(this.instanceColor.array, e * 3); - } - setMatrixAt(e, t) { - t.toArray(this.instanceMatrix.array, e * 16); + _lendAction(t) { + let e = this._actions, i = t._cacheIndex, s = this._nActiveActions++, n = e[s]; + t._cacheIndex = s, e[s] = t, n._cacheIndex = i, e[i] = n; } - updateMorphTargets() {} - dispose() { - this.dispatchEvent({ - type: "dispose" - }); + _takeBackAction(t) { + let e = this._actions, i = t._cacheIndex, s = --this._nActiveActions, n = e[s]; + t._cacheIndex = s, e[s] = t, n._cacheIndex = i, e[i] = n; } -}, wt = class extends bt { - constructor(e){ - super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new pe(16777215), this.map = null, this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.fog = !0, this.setValues(e); + _addInactiveBinding(t, e, i) { + let s = this._bindingsByRootAndName, n = this._bindings, r = s[e]; + r === void 0 && (r = {}, s[e] = r), r[i] = t, t._cacheIndex = n.length, n.push(t); } - 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; + _removeInactiveBinding(t) { + let e = this._bindings, i = t.binding, s = i.rootNode.uuid, n = i.path, r = this._bindingsByRootAndName, o = r[s], a = e[e.length - 1], l = t._cacheIndex; + a._cacheIndex = l, e[l] = a, e.pop(), delete o[n], Object.keys(o).length === 0 && delete r[s]; } -}, Hh = new A, Gh = new A, Wh = new ze, no = new hi, mr = new Yt, bn = class extends Je { - constructor(e = new Ge, t = new wt){ - super(), this.isLine = !0, this.type = "Line", this.geometry = e, this.material = t, this.updateMorphTargets(); + _lendBinding(t) { + let e = this._bindings, i = t._cacheIndex, s = this._nActiveBindings++, n = e[s]; + t._cacheIndex = s, e[s] = t, n._cacheIndex = i, e[i] = n; } - copy(e, t) { - return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this; + _takeBackBinding(t) { + let e = this._bindings, i = t._cacheIndex, s = --this._nActiveBindings, n = e[s]; + t._cacheIndex = s, e[s] = t, n._cacheIndex = i, e[i] = n; } - computeLineDistances() { - let e = this.geometry; - if (e.index === null) { - let t = e.attributes.position, n = [ - 0 - ]; - for(let i = 1, r = t.count; i < r; i++)Hh.fromBufferAttribute(t, i - 1), Gh.fromBufferAttribute(t, i), n[i] = n[i - 1], n[i] += Hh.distanceTo(Gh); - e.setAttribute("lineDistance", new ve(n, 1)); - } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); - return this; + _lendControlInterpolant() { + let t = this._controlInterpolants, e = this._nActiveControlInterpolants++, i = t[e]; + return i === void 0 && (i = new gn(new Float32Array(2), new Float32Array(2), 1, Bd), i.__cacheIndex = e, t[e] = i), i; } - raycast(e, t) { - let n = this.geometry, i = this.matrixWorld, r = e.params.Line.threshold, a = n.drawRange; - if (n.boundingSphere === null && n.computeBoundingSphere(), mr.copy(n.boundingSphere), mr.applyMatrix4(i), mr.radius += r, e.ray.intersectsSphere(mr) === !1) return; - Wh.copy(i).invert(), no.copy(e.ray).applyMatrix4(Wh); - let o = r / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = o * o, l = new A, h = new A, u = new A, d = new A, f = this.isLineSegments ? 2 : 1, m = n.index, g = n.attributes.position; - if (m !== null) { - let p = Math.max(0, a.start), v = Math.min(m.count, a.start + a.count); - for(let x1 = p, y1 = v - 1; x1 < y1; x1 += f){ - let b = m.getX(x1), w = m.getX(x1 + 1); - if (l.fromBufferAttribute(g, b), h.fromBufferAttribute(g, w), no.distanceSqToSegment(l, h, d, u) > c) continue; - d.applyMatrix4(this.matrixWorld); - let I = e.ray.origin.distanceTo(d); - I < e.near || I > e.far || t.push({ - distance: I, - point: u.clone().applyMatrix4(this.matrixWorld), - index: x1, - face: null, - faceIndex: null, - object: this - }); - } - } else { - let p = Math.max(0, a.start), v = Math.min(g.count, a.start + a.count); - for(let x1 = p, y1 = v - 1; x1 < y1; x1 += f){ - if (l.fromBufferAttribute(g, x1), h.fromBufferAttribute(g, x1 + 1), no.distanceSqToSegment(l, h, d, u) > c) continue; - d.applyMatrix4(this.matrixWorld); - let w = e.ray.origin.distanceTo(d); - w < e.near || w > e.far || t.push({ - distance: w, - point: u.clone().applyMatrix4(this.matrixWorld), - index: x1, - face: null, - faceIndex: null, - object: this - }); - } - } + _takeBackControlInterpolant(t) { + let e = this._controlInterpolants, i = t.__cacheIndex, s = --this._nActiveControlInterpolants, n = e[s]; + t.__cacheIndex = s, e[s] = t, n.__cacheIndex = i, e[i] = n; } - updateMorphTargets() { - let t = this.geometry.morphAttributes, n = Object.keys(t); - if (n.length > 0) { - let i = t[n[0]]; - if (i !== void 0) { - this.morphTargetInfluences = [], this.morphTargetDictionary = {}; - for(let r = 0, a = i.length; r < a; r++){ - let o = i[r].name || String(r); - this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r; - } - } + clipAction(t, e, i) { + let s = e || this._root, n = s.uuid, r = typeof t == "string" ? wi.findByName(s, t) : t, o = r !== null ? r.uuid : t, a = this._actionsByClip[o], l = null; + if (i === void 0 && (r !== null ? i = r.blendMode : i = Ho), a !== void 0) { + let u = a.actionByRoot[n]; + if (u !== void 0 && u.blendMode === i) return u; + l = a.knownActions[0], r === null && (r = l._clip); } + if (r === null) return null; + let c = new No(this, r, e, i); + return this._bindAction(c, l), this._addInactiveAction(c, o, n), c; } -}, Xh = new A, qh = new A, en = class extends bn { - constructor(e, t){ - super(e, t), this.isLineSegments = !0, this.type = "LineSegments"; + existingAction(t, e) { + let i = e || this._root, s = i.uuid, n = typeof t == "string" ? wi.findByName(i, t) : t, r = n ? n.uuid : t, o = this._actionsByClip[r]; + return o !== void 0 && o.actionByRoot[s] || null; } - computeLineDistances() { - let e = this.geometry; - if (e.index === null) { - let t = e.attributes.position, n = []; - for(let i = 0, r = t.count; i < r; i += 2)Xh.fromBufferAttribute(t, i), qh.fromBufferAttribute(t, i + 1), n[i] = i === 0 ? 0 : n[i - 1], n[i + 1] = n[i] + Xh.distanceTo(qh); - e.setAttribute("lineDistance", new ve(n, 1)); - } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); + stopAllAction() { + let t = this._actions, e = this._nActiveActions; + for(let i = e - 1; i >= 0; --i)t[i].stop(); return this; } -}, Bo = class extends bn { - constructor(e, t){ - super(e, t), this.isLineLoop = !0, this.type = "LineLoop"; - } -}, na = class extends bt { - constructor(e){ - super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new pe(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; + update(t) { + t *= this.timeScale; + let e = this._actions, i = this._nActiveActions, s = this.time += t, n = Math.sign(t), r = this._accuIndex ^= 1; + for(let l = 0; l !== i; ++l)e[l]._update(s, t, n, r); + let o = this._bindings, a = this._nActiveBindings; + for(let l = 0; l !== a; ++l)o[l].apply(r); + return this; } -}, Yh = new ze, zo = new hi, gr = new Yt, _r = new A, Vo = class extends Je { - constructor(e = new Ge, t = new na){ - super(), this.isPoints = !0, this.type = "Points", this.geometry = e, this.material = t, this.updateMorphTargets(); + setTime(t) { + this.time = 0; + for(let e = 0; e < this._actions.length; e++)this._actions[e].time = 0; + return this.update(t); } - copy(e, t) { - return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this; + getRoot() { + return this._root; } - raycast(e, t) { - let n = this.geometry, i = this.matrixWorld, r = e.params.Points.threshold, a = n.drawRange; - if (n.boundingSphere === null && n.computeBoundingSphere(), gr.copy(n.boundingSphere), gr.applyMatrix4(i), gr.radius += r, e.ray.intersectsSphere(gr) === !1) return; - Yh.copy(i).invert(), zo.copy(e.ray).applyMatrix4(Yh); - let o = r / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = o * o, l = n.index, u = n.attributes.position; - if (l !== null) { - let d = Math.max(0, a.start), f = Math.min(l.count, a.start + a.count); - for(let m = d, _ = f; m < _; m++){ - let g = l.getX(m); - _r.fromBufferAttribute(u, g), Zh(_r, g, c, i, e, t, this); + uncacheClip(t) { + let e = this._actions, i = t.uuid, s = this._actionsByClip, n = s[i]; + if (n !== void 0) { + let r = n.knownActions; + for(let o = 0, a = r.length; o !== a; ++o){ + let l = r[o]; + this._deactivateAction(l); + let c = l._cacheIndex, u = e[e.length - 1]; + l._cacheIndex = null, l._byClipCacheIndex = null, u._cacheIndex = c, e[c] = u, e.pop(), this._removeInactiveBindingsForAction(l); } - } else { - let d = Math.max(0, a.start), f = Math.min(u.count, a.start + a.count); - for(let m = d, _ = f; m < _; m++)_r.fromBufferAttribute(u, m), Zh(_r, m, c, i, e, t, this); + delete s[i]; } } - updateMorphTargets() { - let t = this.geometry.morphAttributes, n = Object.keys(t); - if (n.length > 0) { - let i = t[n[0]]; - if (i !== void 0) { - this.morphTargetInfluences = [], this.morphTargetDictionary = {}; - for(let r = 0, a = i.length; r < a; r++){ - let o = i[r].name || String(r); - this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r; - } - } + uncacheRoot(t) { + let e = t.uuid, i = this._actionsByClip; + for(let r in i){ + let o = i[r].actionByRoot, a = o[e]; + a !== void 0 && (this._deactivateAction(a), this._removeInactiveAction(a)); } - } -}; -function Zh(s1, e, t, n, i, r, a) { - let o = zo.distanceSqToPoint(s1); - if (o < t) { - let c = new A; - zo.closestPointToPoint(s1, c), c.applyMatrix4(n); - let l = i.ray.origin.distanceTo(c); - if (l < i.near || l > i.far) return; - r.push({ - distance: l, - distanceToRay: Math.sqrt(o), - point: c, - index: e, - face: null, - object: a - }); - } -} -var Jh = class extends St { - constructor(e, t, n, i, r, a, o, c, l){ - super(e, t, n, i, r, a, o, c, l), this.isVideoTexture = !0, this.minFilter = a !== void 0 ? a : mt, this.magFilter = r !== void 0 ? r : mt, this.generateMipmaps = !1; - let h = this; - function u() { - h.needsUpdate = !0, e.requestVideoFrameCallback(u); + let s = this._bindingsByRootAndName, n = s[e]; + if (n !== void 0) for(let r in n){ + let o = n[r]; + o.restoreOriginalState(), this._removeInactiveBinding(o); } - "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(u); - } - clone() { - return new this.constructor(this.image).copy(this); - } - update() { - let e = this.image; - "requestVideoFrameCallback" in e === !1 && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0); } -}, $h = class extends St { - constructor(e, t){ - super({ - width: e, - height: t - }), this.isFramebufferTexture = !0, this.magFilter = pt, this.minFilter = pt, this.generateMipmaps = !1, this.needsUpdate = !0; + uncacheAction(t, e) { + let i = this.existingAction(t, e); + i !== null && (this._deactivateAction(i), this._removeInactiveAction(i)); } -}, Us = class extends St { - constructor(e, t, n, i, r, a, o, c, l, h, u, d){ - super(null, a, o, c, l, h, i, r, u, d), this.isCompressedTexture = !0, this.image = { - width: t, - height: n - }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1; +}, Lh = class extends Wi { + constructor(t = 1, e = 1, i = 1, s = {}){ + super(t, e, s), this.isRenderTarget3D = !0, this.depth = i, this.texture = new Qs(null, t, e, i), this.texture.isRenderTargetTexture = !0; } -}, Kh = class extends Us { - constructor(e, t, n, i, r, a){ - super(e, t, n, r, a), this.isCompressedArrayTexture = !0, this.image.depth = i, this.wrapR = It; +}, Uh = class extends Wi { + constructor(t = 1, e = 1, i = 1, s = {}){ + super(t, e, s), this.isRenderTargetArray = !0, this.depth = i, this.texture = new $s(null, t, e, i), this.texture.isRenderTargetTexture = !0; } -}, Qh = class extends Us { - constructor(e, t, n){ - super(void 0, e[0].width, e[0].height, t, n, zn), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e; +}, Wh = class h { + constructor(t){ + this.value = t; } -}, jh = class extends St { - constructor(e, t, n, i, r, a, o, c, l){ - super(e, t, n, i, r, a, o, c, l), this.isCanvasTexture = !0, this.needsUpdate = !0; + clone() { + return new h(this.value.clone === void 0 ? this.value : this.value.clone()); } -}, Zt = class { +}, Ed = 0, Hh = class extends qt { constructor(){ - this.type = "Curve", this.arcLengthDivisions = 200; - } - getPoint() { - return console.warn("THREE.Curve: .getPoint() not implemented."), null; - } - getPointAt(e, t) { - let n = this.getUtoTmapping(e); - return this.getPoint(n, t); + super(), this.isUniformsGroup = !0, Object.defineProperty(this, "id", { + value: Ed++ + }), this.name = "", this.usage = Js, this.uniforms = []; } - getPoints(e = 5) { - let t = []; - for(let n = 0; n <= e; n++)t.push(this.getPoint(n / e)); - return t; + add(t) { + return this.uniforms.push(t), this; } - getSpacedPoints(e = 5) { - let t = []; - for(let n = 0; n <= e; n++)t.push(this.getPointAt(n / e)); - return t; + remove(t) { + let e = this.uniforms.indexOf(t); + return e !== -1 && this.uniforms.splice(e, 1), this; } - getLength() { - let e = this.getLengths(); - return e[e.length - 1]; + setName(t) { + return this.name = t, this; } - getLengths(e = this.arcLengthDivisions) { - if (this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths; - this.needsUpdate = !1; - let t = [], n, i = this.getPoint(0), r = 0; - t.push(0); - for(let a = 1; a <= e; a++)n = this.getPoint(a / e), r += n.distanceTo(i), t.push(r), i = n; - return this.cacheArcLengths = t, t; + setUsage(t) { + return this.usage = t, this; } - updateArcLengths() { - this.needsUpdate = !0, this.getLengths(); + dispose() { + return this.dispatchEvent({ + type: "dispose" + }), this; } - getUtoTmapping(e, t) { - let n = this.getLengths(), i = 0, r = n.length, a; - t ? a = t : a = e * n[r - 1]; - let o = 0, c = r - 1, l; - for(; o <= c;)if (i = Math.floor(o + (c - o) / 2), l = n[i] - a, l < 0) o = i + 1; - else if (l > 0) c = i - 1; - else { - c = i; - break; - } - if (i = c, n[i] === a) return i / (r - 1); - let h = n[i], d = n[i + 1] - h, f = (a - h) / d; - return (i + f) / (r - 1); - } - getTangent(e, t) { - let i = e - 1e-4, r = e + 1e-4; - i < 0 && (i = 0), r > 1 && (r = 1); - let a = this.getPoint(i), o = this.getPoint(r), c = t || (a.isVector2 ? new Z : new A); - return c.copy(o).sub(a).normalize(), c; - } - getTangentAt(e, t) { - let n = this.getUtoTmapping(e); - return this.getTangent(n, t); - } - computeFrenetFrames(e, t) { - let n = new A, i = [], r = [], a = [], o = new A, c = new ze; - for(let f = 0; f <= e; f++){ - let m = f / e; - i[f] = this.getTangentAt(m, new A); - } - r[0] = new A, a[0] = new A; - let l = Number.MAX_VALUE, h = Math.abs(i[0].x), u = Math.abs(i[0].y), d = Math.abs(i[0].z); - h <= l && (l = h, n.set(1, 0, 0)), u <= l && (l = u, n.set(0, 1, 0)), d <= l && n.set(0, 0, 1), o.crossVectors(i[0], n).normalize(), r[0].crossVectors(i[0], o), a[0].crossVectors(i[0], r[0]); - for(let f = 1; f <= e; f++){ - if (r[f] = r[f - 1].clone(), a[f] = a[f - 1].clone(), o.crossVectors(i[f - 1], i[f]), o.length() > Number.EPSILON) { - o.normalize(); - let m = Math.acos(ct(i[f - 1].dot(i[f]), -1, 1)); - r[f].applyMatrix4(c.makeRotationAxis(o, m)); - } - a[f].crossVectors(i[f], r[f]); - } - if (t === !0) { - let f = Math.acos(ct(r[0].dot(r[e]), -1, 1)); - f /= e, i[0].dot(o.crossVectors(r[0], r[e])) > 0 && (f = -f); - for(let m = 1; m <= e; m++)r[m].applyMatrix4(c.makeRotationAxis(i[m], f * m)), a[m].crossVectors(i[m], r[m]); + copy(t) { + this.name = t.name, this.usage = t.usage; + let e = t.uniforms; + this.uniforms.length = 0; + for(let i = 0, s = e.length; i < s; i++){ + let n = Array.isArray(e[i]) ? e[i] : [ + e[i] + ]; + for(let r = 0; r < n.length; r++)this.uniforms.push(n[r].clone()); } - return { - tangents: i, - normals: r, - binormals: a - }; + return this; } clone() { return new this.constructor().copy(this); } - copy(e) { - return this.arcLengthDivisions = e.arcLengthDivisions, this; +}, qh = class extends Ji { + constructor(t, e, i = 1){ + super(t, e), this.isInstancedInterleavedBuffer = !0, this.meshPerAttribute = i; } - toJSON() { - let e = { - metadata: { - version: 4.6, - type: "Curve", - generator: "Curve.toJSON" - } - }; - return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e; + copy(t) { + return super.copy(t), this.meshPerAttribute = t.meshPerAttribute, this; } - fromJSON(e) { - return this.arcLengthDivisions = e.arcLengthDivisions, this; + clone(t) { + let e = super.clone(t); + return e.meshPerAttribute = this.meshPerAttribute, e; } -}, Ds = class extends Zt { - constructor(e = 0, t = 0, n = 1, i = 1, r = 0, a = Math.PI * 2, o = !1, c = 0){ - super(), this.isEllipseCurve = !0, this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = n, this.yRadius = i, this.aStartAngle = r, this.aEndAngle = a, this.aClockwise = o, this.aRotation = c; + toJSON(t) { + let e = super.toJSON(t); + return e.isInstancedInterleavedBuffer = !0, e.meshPerAttribute = this.meshPerAttribute, e; } - getPoint(e, t) { - let n = t || new Z, i = Math.PI * 2, r = this.aEndAngle - this.aStartAngle, a = Math.abs(r) < Number.EPSILON; - for(; r < 0;)r += i; - for(; r > i;)r -= i; - r < Number.EPSILON && (a ? r = 0 : r = i), this.aClockwise === !0 && !a && (r === i ? r = -i : r = r - i); - let o = this.aStartAngle + e * r, c = this.aX + this.xRadius * Math.cos(o), l = this.aY + this.yRadius * Math.sin(o); - if (this.aRotation !== 0) { - let h = Math.cos(this.aRotation), u = Math.sin(this.aRotation), d = c - this.aX, f = l - this.aY; - c = d * h - f * u + this.aX, l = d * u + f * h + this.aY; - } - return n.set(c, l); +}, Gh = class { + constructor(t, e, i, s, n){ + this.isGLBufferAttribute = !0, this.name = "", this.buffer = t, this.type = e, this.itemSize = i, this.elementSize = s, this.count = n, this.version = 0; } - copy(e) { - return super.copy(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; + set needsUpdate(t) { + t === !0 && this.version++; } - toJSON() { - let e = super.toJSON(); - return e.aX = this.aX, e.aY = this.aY, e.xRadius = this.xRadius, e.yRadius = this.yRadius, e.aStartAngle = this.aStartAngle, e.aEndAngle = this.aEndAngle, e.aClockwise = this.aClockwise, e.aRotation = this.aRotation, e; + setBuffer(t) { + return this.buffer = t, this; } - fromJSON(e) { - return super.fromJSON(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; + setType(t, e) { + return this.type = t, this.elementSize = e, this; } -}, ko = class extends Ds { - constructor(e, t, n, i, r, a){ - super(e, t, n, n, i, r, a), this.isArcCurve = !0, this.type = "ArcCurve"; + setItemSize(t) { + return this.itemSize = t, this; } -}; -function Jc() { - let s1 = 0, e = 0, t = 0, n = 0; - function i(r, a, o, c) { - s1 = r, e = o, t = -3 * r + 3 * a - 2 * o - c, n = 2 * r - 2 * a + o + c; + setCount(t) { + return this.count = t, this; } - return { - initCatmullRom: function(r, a, o, c, l) { - i(a, o, l * (o - r), l * (c - a)); - }, - initNonuniformCatmullRom: function(r, a, o, c, l, h, u) { - let d = (a - r) / l - (o - r) / (l + h) + (o - a) / h, f = (o - a) / h - (c - a) / (h + u) + (c - o) / u; - d *= h, f *= h, i(a, o, d, f); - }, - calc: function(r) { - let a = r * r, o = a * r; - return s1 + e * r + t * a + n * o; - } - }; -} -var xr = new A, io = new Jc, so = new Jc, ro = new Jc, Ho = class extends Zt { - constructor(e = [], t = !1, n = "centripetal", i = .5){ - super(), this.isCatmullRomCurve3 = !0, this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = n, this.tension = i; - } - getPoint(e, t = new A) { - let n = t, i = this.points, r = i.length, a = (r - (this.closed ? 0 : 1)) * e, o = Math.floor(a), c = a - o; - this.closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / r) + 1) * r : c === 0 && o === r - 1 && (o = r - 2, c = 1); - let l, h; - this.closed || o > 0 ? l = i[(o - 1) % r] : (xr.subVectors(i[0], i[1]).add(i[0]), l = xr); - let u = i[o % r], d = i[(o + 1) % r]; - if (this.closed || o + 2 < r ? h = i[(o + 2) % r] : (xr.subVectors(i[r - 1], i[r - 2]).add(i[r - 1]), h = xr), this.curveType === "centripetal" || this.curveType === "chordal") { - let f = this.curveType === "chordal" ? .5 : .25, m = Math.pow(l.distanceToSquared(u), f), _ = Math.pow(u.distanceToSquared(d), f), g = Math.pow(d.distanceToSquared(h), f); - _ < 1e-4 && (_ = 1), m < 1e-4 && (m = _), g < 1e-4 && (g = _), io.initNonuniformCatmullRom(l.x, u.x, d.x, h.x, m, _, g), so.initNonuniformCatmullRom(l.y, u.y, d.y, h.y, m, _, g), ro.initNonuniformCatmullRom(l.z, u.z, d.z, h.z, m, _, g); - } else this.curveType === "catmullrom" && (io.initCatmullRom(l.x, u.x, d.x, h.x, this.tension), so.initCatmullRom(l.y, u.y, d.y, h.y, this.tension), ro.initCatmullRom(l.z, u.z, d.z, h.z, this.tension)); - return n.set(io.calc(c), so.calc(c), ro.calc(c)), n; - } - copy(e) { - super.copy(e), this.points = []; - for(let t = 0, n = e.points.length; t < n; t++){ - let i = e.points[t]; - this.points.push(i.clone()); - } - return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; +}, Xh = new D, Jh = class { + constructor(t, e, i = 0, s = 1 / 0){ + this.ray = new Le(t, e), this.near = i, this.far = s, this.camera = null, this.layers = new js, this.params = { + Mesh: {}, + Line: { + threshold: 1 + }, + LOD: {}, + Points: { + threshold: 1 + }, + Sprite: {} + }; } - toJSON() { - let e = super.toJSON(); - e.points = []; - for(let t = 0, n = this.points.length; t < n; t++){ - let i = this.points[t]; - e.points.push(i.toArray()); - } - return e.closed = this.closed, e.curveType = this.curveType, e.tension = this.tension, e; + set(t, e) { + this.ray.set(t, e); } - fromJSON(e) { - super.fromJSON(e), this.points = []; - for(let t = 0, n = e.points.length; t < n; t++){ - let i = e.points[t]; - this.points.push(new A().fromArray(i)); - } - return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; + setFromCamera(t, e) { + e.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(e.matrixWorld), this.ray.direction.set(t.x, t.y, .5).unproject(e).sub(this.ray.origin).normalize(), this.camera = e) : e.isOrthographicCamera ? (this.ray.origin.set(t.x, t.y, (e.near + e.far) / (e.near - e.far)).unproject(e), this.ray.direction.set(0, 0, -1).transformDirection(e.matrixWorld), this.camera = e) : console.error("THREE.Raycaster: Unsupported camera type: " + e.type); + } + setFromXRController(t) { + return Xh.identity().extractRotation(t.matrixWorld), this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(0, 0, -1).applyMatrix4(Xh), this; + } + intersectObject(t, e = !0, i = []) { + return Vo(t, this, i, e), i.sort(Zh), i; + } + intersectObjects(t, e = !0, i = []) { + for(let s = 0, n = t.length; s < n; s++)Vo(t[s], this, i, e); + return i.sort(Zh), i; } }; -function eu(s1, e, t, n, i) { - let r = (n - e) * .5, a = (i - t) * .5, o = s1 * s1, c = s1 * o; - return (2 * t - 2 * n + r + a) * c + (-3 * t + 3 * n - 2 * r - a) * o + r * s1 + t; -} -function Y0(s1, e) { - let t = 1 - s1; - return t * t * e; -} -function Z0(s1, e) { - return 2 * (1 - s1) * s1 * e; -} -function J0(s1, e) { - return s1 * s1 * e; -} -function bs(s1, e, t, n) { - return Y0(s1, e) + Z0(s1, t) + J0(s1, n); -} -function $0(s1, e) { - let t = 1 - s1; - return t * t * t * e; -} -function K0(s1, e) { - let t = 1 - s1; - return 3 * t * t * s1 * e; +function Zh(h, t) { + return h.distance - t.distance; } -function Q0(s1, e) { - return 3 * (1 - s1) * s1 * s1 * e; -} -function j0(s1, e) { - return s1 * s1 * s1 * e; -} -function Es(s1, e, t, n, i) { - return $0(s1, e) + K0(s1, t) + Q0(s1, n) + j0(s1, i); +function Vo(h, t, e, i) { + let s = !0; + if (h.layers.test(t.layers) && h.raycast(t, e) === !1 && (s = !1), s === !0 && i === !0) { + let n = h.children; + for(let r = 0, o = n.length; r < o; r++)Vo(n[r], t, e, !0); + } } -var ia = class extends Zt { - constructor(e = new Z, t = new Z, n = new Z, i = new Z){ - super(), this.isCubicBezierCurve = !0, this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = i; +var Yh = class { + constructor(t = 1, e = 0, i = 0){ + return this.radius = t, this.phi = e, this.theta = i, this; } - getPoint(e, t = new Z) { - let n = t, i = this.v0, r = this.v1, a = this.v2, o = this.v3; - return n.set(Es(e, i.x, r.x, a.x, o.x), Es(e, i.y, r.y, a.y, o.y)), n; + set(t, e, i) { + return this.radius = t, this.phi = e, this.theta = i, this; } - copy(e) { - return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; + copy(t) { + return this.radius = t.radius, this.phi = t.phi, this.theta = t.theta, this; } - toJSON() { - let e = super.toJSON(); - return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; + makeSafe() { + return this.phi = N(this.phi, 1e-6, Math.PI - 1e-6), this; } - fromJSON(e) { - return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; + setFromVector3(t) { + return this.setFromCartesianCoords(t.x, t.y, t.z); } -}, Go = class extends Zt { - constructor(e = new A, t = new A, n = new A, i = new A){ - super(), this.isCubicBezierCurve3 = !0, this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = i; + setFromCartesianCoords(t, e, i) { + return this.radius = Math.sqrt(t * t + e * e + i * i), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(t, i), this.phi = Math.acos(N(e / this.radius, -1, 1))), this; } - getPoint(e, t = new A) { - let n = t, i = this.v0, r = this.v1, a = this.v2, o = this.v3; - return n.set(Es(e, i.x, r.x, a.x, o.x), Es(e, i.y, r.y, a.y, o.y), Es(e, i.z, r.z, a.z, o.z)), n; + clone() { + return new this.constructor().copy(this); } - copy(e) { - return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; +}, $h = class { + constructor(t = 1, e = 0, i = 0){ + return this.radius = t, this.theta = e, this.y = i, this; } - toJSON() { - let e = super.toJSON(); - return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; + set(t, e, i) { + return this.radius = t, this.theta = e, this.y = i, this; } - fromJSON(e) { - return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; + copy(t) { + return this.radius = t.radius, this.theta = t.theta, this.y = t.y, this; } -}, sa = class extends Zt { - constructor(e = new Z, t = new Z){ - super(), this.isLineCurve = !0, this.type = "LineCurve", this.v1 = e, this.v2 = t; + setFromVector3(t) { + return this.setFromCartesianCoords(t.x, t.y, t.z); } - getPoint(e, t = new Z) { - let n = t; - return e === 1 ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(e).add(this.v1)), n; + setFromCartesianCoords(t, e, i) { + return this.radius = Math.sqrt(t * t + i * i), this.theta = Math.atan2(t, i), this.y = e, this; } - getPointAt(e, t) { - return this.getPoint(e, t); + clone() { + return new this.constructor().copy(this); } - getTangent(e, t = new Z) { - return t.subVectors(this.v2, this.v1).normalize(); +}, Qh = class h { + constructor(t, e, i, s){ + h.prototype.isMatrix2 = !0, this.elements = [ + 1, + 0, + 0, + 1 + ], t !== void 0 && this.set(t, e, i, s); } - getTangentAt(e, t) { - return this.getTangent(e, t); + identity() { + return this.set(1, 0, 0, 1), this; } - copy(e) { - return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; + fromArray(t, e = 0) { + for(let i = 0; i < 4; i++)this.elements[i] = t[i + e]; + return this; } - toJSON() { - let e = super.toJSON(); - return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; + set(t, e, i, s) { + let n = this.elements; + return n[0] = t, n[2] = e, n[1] = i, n[3] = s, this; } - fromJSON(e) { - return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; +}, jh = new T, Kh = class { + constructor(t = new T(1 / 0, 1 / 0), e = new T(-1 / 0, -1 / 0)){ + this.isBox2 = !0, this.min = t, this.max = e; } -}, Wo = class extends Zt { - constructor(e = new A, t = new A){ - super(), this.isLineCurve3 = !0, this.type = "LineCurve3", this.v1 = e, this.v2 = t; + set(t, e) { + return this.min.copy(t), this.max.copy(e), this; } - getPoint(e, t = new A) { - let n = t; - return e === 1 ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(e).add(this.v1)), n; + setFromPoints(t) { + this.makeEmpty(); + for(let e = 0, i = t.length; e < i; e++)this.expandByPoint(t[e]); + return this; } - getPointAt(e, t) { - return this.getPoint(e, t); + setFromCenterAndSize(t, e) { + let i = jh.copy(e).multiplyScalar(.5); + return this.min.copy(t).sub(i), this.max.copy(t).add(i), this; } - getTangent(e, t = new A) { - return t.subVectors(this.v2, this.v1).normalize(); + clone() { + return new this.constructor().copy(this); } - getTangentAt(e, t) { - return this.getTangent(e, t); + copy(t) { + return this.min.copy(t.min), this.max.copy(t.max), this; } - copy(e) { - return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; + makeEmpty() { + return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this; } - toJSON() { - let e = super.toJSON(); - return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; + isEmpty() { + return this.max.x < this.min.x || this.max.y < this.min.y; } - fromJSON(e) { - return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; + getCenter(t) { + return this.isEmpty() ? t.set(0, 0) : t.addVectors(this.min, this.max).multiplyScalar(.5); } -}, ra = class extends Zt { - constructor(e = new Z, t = new Z, n = new Z){ - super(), this.isQuadraticBezierCurve = !0, this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n; + getSize(t) { + return this.isEmpty() ? t.set(0, 0) : t.subVectors(this.max, this.min); } - getPoint(e, t = new Z) { - let n = t, i = this.v0, r = this.v1, a = this.v2; - return n.set(bs(e, i.x, r.x, a.x), bs(e, i.y, r.y, a.y)), n; + expandByPoint(t) { + return this.min.min(t), this.max.max(t), this; } - copy(e) { - return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; + expandByVector(t) { + return this.min.sub(t), this.max.add(t), this; } - toJSON() { - let e = super.toJSON(); - return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; + expandByScalar(t) { + return this.min.addScalar(-t), this.max.addScalar(t), this; } - fromJSON(e) { - return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; + containsPoint(t) { + return t.x >= this.min.x && t.x <= this.max.x && t.y >= this.min.y && t.y <= this.max.y; } -}, aa = class extends Zt { - constructor(e = new A, t = new A, n = new A){ - super(), this.isQuadraticBezierCurve3 = !0, this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n; + containsBox(t) { + return this.min.x <= t.min.x && t.max.x <= this.max.x && this.min.y <= t.min.y && t.max.y <= this.max.y; } - getPoint(e, t = new A) { - let n = t, i = this.v0, r = this.v1, a = this.v2; - return n.set(bs(e, i.x, r.x, a.x), bs(e, i.y, r.y, a.y), bs(e, i.z, r.z, a.z)), n; + getParameter(t, e) { + return e.set((t.x - this.min.x) / (this.max.x - this.min.x), (t.y - this.min.y) / (this.max.y - this.min.y)); } - copy(e) { - return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; + intersectsBox(t) { + return t.max.x >= this.min.x && t.min.x <= this.max.x && t.max.y >= this.min.y && t.min.y <= this.max.y; } - toJSON() { - let e = super.toJSON(); - return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; + clampPoint(t, e) { + return e.copy(t).clamp(this.min, this.max); } - fromJSON(e) { - return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; + distanceToPoint(t) { + return this.clampPoint(t, jh).distanceTo(t); } -}, oa = class extends Zt { - constructor(e = []){ - super(), this.isSplineCurve = !0, this.type = "SplineCurve", this.points = e; + intersect(t) { + return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this; } - getPoint(e, t = new Z) { - let n = t, i = this.points, r = (i.length - 1) * e, a = Math.floor(r), o = r - a, c = i[a === 0 ? a : a - 1], l = i[a], h = i[a > i.length - 2 ? i.length - 1 : a + 1], u = i[a > i.length - 3 ? i.length - 1 : a + 2]; - return n.set(eu(o, c.x, l.x, h.x, u.x), eu(o, c.y, l.y, h.y, u.y)), n; + union(t) { + return this.min.min(t.min), this.max.max(t.max), this; } - copy(e) { - super.copy(e), this.points = []; - for(let t = 0, n = e.points.length; t < n; t++){ - let i = e.points[t]; - this.points.push(i.clone()); - } - return this; + translate(t) { + return this.min.add(t), this.max.add(t), this; } - toJSON() { - let e = super.toJSON(); - e.points = []; - for(let t = 0, n = this.points.length; t < n; t++){ - let i = this.points[t]; - e.points.push(i.toArray()); - } - return e; + equals(t) { + return t.min.equals(this.min) && t.max.equals(this.max); } - fromJSON(e) { - super.fromJSON(e), this.points = []; - for(let t = 0, n = e.points.length; t < n; t++){ - let i = e.points[t]; - this.points.push(new Z().fromArray(i)); - } - return this; +}, tl = new w, Ds = new w, el = class { + constructor(t = new w, e = new w){ + this.start = t, this.end = e; } -}, ca = Object.freeze({ - __proto__: null, - ArcCurve: ko, - CatmullRomCurve3: Ho, - CubicBezierCurve: ia, - CubicBezierCurve3: Go, - EllipseCurve: Ds, - LineCurve: sa, - LineCurve3: Wo, - QuadraticBezierCurve: ra, - QuadraticBezierCurve3: aa, - SplineCurve: oa -}), Xo = class extends Zt { - constructor(){ - super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1; + set(t, e) { + return this.start.copy(t), this.end.copy(e), this; } - add(e) { - this.curves.push(e); + copy(t) { + return this.start.copy(t.start), this.end.copy(t.end), this; } - closePath() { - let e = this.curves[0].getPoint(0), t = this.curves[this.curves.length - 1].getPoint(1); - if (!e.equals(t)) { - let n = e.isVector2 === !0 ? "LineCurve" : "LineCurve3"; - this.curves.push(new ca[n](t, e)); - } - return this; + getCenter(t) { + return t.addVectors(this.start, this.end).multiplyScalar(.5); } - getPoint(e, t) { - let n = e * this.getLength(), i = this.getCurveLengths(), r = 0; - for(; r < i.length;){ - if (i[r] >= n) { - let a = i[r] - n, o = this.curves[r], c = o.getLength(), l = c === 0 ? 0 : 1 - a / c; - return o.getPointAt(l, t); - } - r++; - } - return null; + delta(t) { + return t.subVectors(this.end, this.start); } - getLength() { - let e = this.getCurveLengths(); - return e[e.length - 1]; + distanceSq() { + return this.start.distanceToSquared(this.end); } - updateArcLengths() { - this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths(); + distance() { + return this.start.distanceTo(this.end); } - getCurveLengths() { - if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; - let e = [], t = 0; - for(let n = 0, i = this.curves.length; n < i; n++)t += this.curves[n].getLength(), e.push(t); - return this.cacheLengths = e, e; + at(t, e) { + return this.delta(e).multiplyScalar(t).add(this.start); } - getSpacedPoints(e = 40) { - let t = []; - for(let n = 0; n <= e; n++)t.push(this.getPoint(n / e)); - return this.autoClose && t.push(t[0]), t; + closestPointToPointParameter(t, e) { + tl.subVectors(t, this.start), Ds.subVectors(this.end, this.start); + let i = Ds.dot(Ds), n = Ds.dot(tl) / i; + return e && (n = N(n, 0, 1)), n; } - getPoints(e = 12) { - let t = [], n; - for(let i = 0, r = this.curves; i < r.length; i++){ - let a = r[i], o = a.isEllipseCurve ? e * 2 : a.isLineCurve || a.isLineCurve3 ? 1 : a.isSplineCurve ? e * a.points.length : e, c = a.getPoints(o); - for(let l = 0; l < c.length; l++){ - let h = c[l]; - n && n.equals(h) || (t.push(h), n = h); - } - } - return this.autoClose && t.length > 1 && !t[t.length - 1].equals(t[0]) && t.push(t[0]), t; + closestPointToPoint(t, e, i) { + let s = this.closestPointToPointParameter(t, e); + return this.delta(i).multiplyScalar(s).add(this.start); + } + applyMatrix4(t) { + return this.start.applyMatrix4(t), this.end.applyMatrix4(t), this; + } + equals(t) { + return t.start.equals(this.start) && t.end.equals(this.end); + } + clone() { + return new this.constructor().copy(this); } - copy(e) { - super.copy(e), this.curves = []; - for(let t = 0, n = e.curves.length; t < n; t++){ - let i = e.curves[t]; - this.curves.push(i.clone()); +}, il = new w, sl = class extends G { + constructor(t, e){ + super(), this.light = t, this.matrixAutoUpdate = !1, this.color = e, this.type = "SpotLightHelper"; + let i = new L, s = [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + -1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + -1, + 1 + ]; + for(let r = 0, o = 1, a = 32; r < a; r++, o++){ + let l = r / a * Math.PI * 2, c = o / a * Math.PI * 2; + s.push(Math.cos(l), Math.sin(l), 1, Math.cos(c), Math.sin(c), 1); } - return this.autoClose = e.autoClose, this; + i.setAttribute("position", new E(s, 3)); + let n = new mt({ + fog: !1, + toneMapped: !1 + }); + this.cone = new Wt(i, n), this.add(this.cone), this.update(); } - toJSON() { - let e = super.toJSON(); - e.autoClose = this.autoClose, e.curves = []; - for(let t = 0, n = this.curves.length; t < n; t++){ - let i = this.curves[t]; - e.curves.push(i.toJSON()); + dispose() { + this.cone.geometry.dispose(), this.cone.material.dispose(); + } + update() { + this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1), this.parent ? (this.parent.updateWorldMatrix(!0), this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)) : this.matrix.copy(this.light.matrixWorld), this.matrixWorld.copy(this.light.matrixWorld); + let t = this.light.distance ? this.light.distance : 1e3, e = t * Math.tan(this.light.angle); + this.cone.scale.set(e, e, t), il.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(il), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color); + } +}, ge = new w, Ls = new D, cr = new D, nl = class extends Wt { + constructor(t){ + let e = Nl(t), i = new L, s = [], n = [], r = new P(0, 0, 1), o = new P(0, 1, 0); + for(let l = 0; l < e.length; l++){ + let c = e[l]; + c.parent && c.parent.isBone && (s.push(0, 0, 0), s.push(0, 0, 0), n.push(r.r, r.g, r.b), n.push(o.r, o.g, o.b)); + } + i.setAttribute("position", new E(s, 3)), i.setAttribute("color", new E(n, 3)); + let a = new mt({ + vertexColors: !0, + depthTest: !1, + depthWrite: !1, + toneMapped: !1, + transparent: !0 + }); + super(i, a), this.isSkeletonHelper = !0, this.type = "SkeletonHelper", this.root = t, this.bones = e, this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1; + } + updateMatrixWorld(t) { + let e = this.bones, i = this.geometry, s = i.getAttribute("position"); + cr.copy(this.root.matrixWorld).invert(); + for(let n = 0, r = 0; n < e.length; n++){ + let o = e[n]; + o.parent && o.parent.isBone && (Ls.multiplyMatrices(cr, o.matrixWorld), ge.setFromMatrixPosition(Ls), s.setXYZ(r, ge.x, ge.y, ge.z), Ls.multiplyMatrices(cr, o.parent.matrixWorld), ge.setFromMatrixPosition(Ls), s.setXYZ(r + 1, ge.x, ge.y, ge.z), r += 2); } - return e; + i.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(t); + } + dispose() { + this.geometry.dispose(), this.material.dispose(); + } +}; +function Nl(h) { + let t = []; + h.isBone === !0 && t.push(h); + for(let e = 0; e < h.children.length; e++)t.push.apply(t, Nl(h.children[e])); + return t; +} +var rl = class extends Ct { + constructor(t, e, i){ + let s = new mn(e, 4, 2), n = new _e({ + wireframe: !0, + fog: !1, + toneMapped: !1 + }); + super(s, n), this.light = t, this.color = i, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update(); } - fromJSON(e) { - super.fromJSON(e), this.autoClose = e.autoClose, this.curves = []; - for(let t = 0, n = e.curves.length; t < n; t++){ - let i = e.curves[t]; - this.curves.push(new ca[i.type]().fromJSON(i)); - } - return this; + dispose() { + this.geometry.dispose(), this.material.dispose(); } -}, ji = class extends Xo { - constructor(e){ - super(), this.type = "Path", this.currentPoint = new Z, e && this.setFromPoints(e); + update() { + this.light.updateWorldMatrix(!0, !1), this.color !== void 0 ? this.material.color.set(this.color) : this.material.color.copy(this.light.color); } - setFromPoints(e) { - this.moveTo(e[0].x, e[0].y); - for(let t = 1, n = e.length; t < n; t++)this.lineTo(e[t].x, e[t].y); - return this; +}, Rd = new w, ol = new P, al = new P, hl = class extends G { + constructor(t, e, i){ + super(), this.light = t, this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = i, this.type = "HemisphereLightHelper"; + let s = new fn(e); + s.rotateY(Math.PI * .5), this.material = new _e({ + wireframe: !0, + fog: !1, + toneMapped: !1 + }), this.color === void 0 && (this.material.vertexColors = !0); + let n = s.getAttribute("position"), r = new Float32Array(n.count * 3); + s.setAttribute("color", new Z(r, 3)), this.add(new Ct(s, this.material)), this.update(); } - moveTo(e, t) { - return this.currentPoint.set(e, t), this; + dispose() { + this.children[0].geometry.dispose(), this.children[0].material.dispose(); } - lineTo(e, t) { - let n = new sa(this.currentPoint.clone(), new Z(e, t)); - return this.curves.push(n), this.currentPoint.set(e, t), this; + update() { + let t = this.children[0]; + if (this.color !== void 0) this.material.color.set(this.color); + else { + let e = t.geometry.getAttribute("color"); + ol.copy(this.light.color), al.copy(this.light.groundColor); + for(let i = 0, s = e.count; i < s; i++){ + let n = i < s / 2 ? ol : al; + e.setXYZ(i, n.r, n.g, n.b); + } + e.needsUpdate = !0; + } + this.light.updateWorldMatrix(!0, !1), t.lookAt(Rd.setFromMatrixPosition(this.light.matrixWorld).negate()); + } +}, ll = class extends Wt { + constructor(t = 10, e = 10, i = 4473924, s = 8947848){ + i = new P(i), s = new P(s); + let n = e / 2, r = t / e, o = t / 2, a = [], l = []; + for(let d = 0, p = 0, f = -o; d <= e; d++, f += r){ + a.push(-o, 0, f, o, 0, f), a.push(f, 0, -o, f, 0, o); + let m = d === n ? i : s; + m.toArray(l, p), p += 3, m.toArray(l, p), p += 3, m.toArray(l, p), p += 3, m.toArray(l, p), p += 3; + } + let c = new L; + c.setAttribute("position", new E(a, 3)), c.setAttribute("color", new E(l, 3)); + let u = new mt({ + vertexColors: !0, + toneMapped: !1 + }); + super(c, u), this.type = "GridHelper"; } - quadraticCurveTo(e, t, n, i) { - let r = new ra(this.currentPoint.clone(), new Z(e, t), new Z(n, i)); - return this.curves.push(r), this.currentPoint.set(n, i), this; + dispose() { + this.geometry.dispose(), this.material.dispose(); } - bezierCurveTo(e, t, n, i, r, a) { - let o = new ia(this.currentPoint.clone(), new Z(e, t), new Z(n, i), new Z(r, a)); - return this.curves.push(o), this.currentPoint.set(r, a), this; +}, cl = class extends Wt { + constructor(t = 10, e = 16, i = 8, s = 64, n = 4473924, r = 8947848){ + n = new P(n), r = new P(r); + let o = [], a = []; + if (e > 1) for(let u = 0; u < e; u++){ + let d = u / e * (Math.PI * 2), p = Math.sin(d) * t, f = Math.cos(d) * t; + o.push(0, 0, 0), o.push(p, 0, f); + let m = u & 1 ? n : r; + a.push(m.r, m.g, m.b), a.push(m.r, m.g, m.b); + } + for(let u = 0; u < i; u++){ + let d = u & 1 ? n : r, p = t - t / i * u; + for(let f = 0; f < s; f++){ + let m = f / s * (Math.PI * 2), y1 = Math.sin(m) * p, g = Math.cos(m) * p; + o.push(y1, 0, g), a.push(d.r, d.g, d.b), m = (f + 1) / s * (Math.PI * 2), y1 = Math.sin(m) * p, g = Math.cos(m) * p, o.push(y1, 0, g), a.push(d.r, d.g, d.b); + } + } + let l = new L; + l.setAttribute("position", new E(o, 3)), l.setAttribute("color", new E(a, 3)); + let c = new mt({ + vertexColors: !0, + toneMapped: !1 + }); + super(l, c), this.type = "PolarGridHelper"; } - splineThru(e) { - let t = [ - this.currentPoint.clone() - ].concat(e), n = new oa(t); - return this.curves.push(n), this.currentPoint.copy(e[e.length - 1]), this; + dispose() { + this.geometry.dispose(), this.material.dispose(); } - arc(e, t, n, i, r, a) { - let o = this.currentPoint.x, c = this.currentPoint.y; - return this.absarc(e + o, t + c, n, i, r, a), this; +}, ul = new w, Us = new w, dl = new w, pl = class extends G { + constructor(t, e, i){ + super(), this.light = t, this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = i, this.type = "DirectionalLightHelper", e === void 0 && (e = 1); + let s = new L; + s.setAttribute("position", new E([ + -e, + e, + 0, + e, + e, + 0, + e, + -e, + 0, + -e, + -e, + 0, + -e, + e, + 0 + ], 3)); + let n = new mt({ + fog: !1, + toneMapped: !1 + }); + this.lightPlane = new le(s, n), this.add(this.lightPlane), s = new L, s.setAttribute("position", new E([ + 0, + 0, + 0, + 0, + 0, + 1 + ], 3)), this.targetLine = new le(s, n), this.add(this.targetLine), this.update(); } - absarc(e, t, n, i, r, a) { - return this.absellipse(e, t, n, n, i, r, a), this; + dispose() { + this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose(); } - ellipse(e, t, n, i, r, a, o, c) { - let l = this.currentPoint.x, h = this.currentPoint.y; - return this.absellipse(e + l, t + h, n, i, r, a, o, c), this; + update() { + this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1), ul.setFromMatrixPosition(this.light.matrixWorld), Us.setFromMatrixPosition(this.light.target.matrixWorld), dl.subVectors(Us, ul), this.lightPlane.lookAt(Us), this.color !== void 0 ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(Us), this.targetLine.scale.z = dl.length(); } - absellipse(e, t, n, i, r, a, o, c) { - let l = new Ds(e, t, n, i, r, a, o, c); - if (this.curves.length > 0) { - let u = l.getPoint(0); - u.equals(this.currentPoint) || this.lineTo(u.x, u.y); +}, Ws = new w, et = new Gi, fl = class extends Wt { + constructor(t){ + let e = new L, i = new mt({ + color: 16777215, + vertexColors: !0, + toneMapped: !1 + }), s = [], n = [], r = {}; + o("n1", "n2"), o("n2", "n4"), o("n4", "n3"), o("n3", "n1"), o("f1", "f2"), o("f2", "f4"), o("f4", "f3"), o("f3", "f1"), o("n1", "f1"), o("n2", "f2"), o("n3", "f3"), o("n4", "f4"), o("p", "n1"), o("p", "n2"), o("p", "n3"), o("p", "n4"), o("u1", "u2"), o("u2", "u3"), o("u3", "u1"), o("c", "t"), o("p", "c"), o("cn1", "cn2"), o("cn3", "cn4"), o("cf1", "cf2"), o("cf3", "cf4"); + function o(f, m) { + a(f), a(m); } - this.curves.push(l); - let h = l.getPoint(1); - return this.currentPoint.copy(h), this; + function a(f) { + s.push(0, 0, 0), n.push(0, 0, 0), r[f] === void 0 && (r[f] = []), r[f].push(s.length / 3 - 1); + } + e.setAttribute("position", new E(s, 3)), e.setAttribute("color", new E(n, 3)), super(e, i), this.type = "CameraHelper", this.camera = t, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = r, this.update(); + let l = new P(16755200), c = new P(16711680), u = new P(43775), d = new P(16777215), p = new P(3355443); + this.setColors(l, c, u, d, p); } - copy(e) { - return super.copy(e), this.currentPoint.copy(e.currentPoint), this; + setColors(t, e, i, s, n) { + let o = this.geometry.getAttribute("color"); + o.setXYZ(0, t.r, t.g, t.b), o.setXYZ(1, t.r, t.g, t.b), o.setXYZ(2, t.r, t.g, t.b), o.setXYZ(3, t.r, t.g, t.b), o.setXYZ(4, t.r, t.g, t.b), o.setXYZ(5, t.r, t.g, t.b), o.setXYZ(6, t.r, t.g, t.b), o.setXYZ(7, t.r, t.g, t.b), o.setXYZ(8, t.r, t.g, t.b), o.setXYZ(9, t.r, t.g, t.b), o.setXYZ(10, t.r, t.g, t.b), o.setXYZ(11, t.r, t.g, t.b), o.setXYZ(12, t.r, t.g, t.b), o.setXYZ(13, t.r, t.g, t.b), o.setXYZ(14, t.r, t.g, t.b), o.setXYZ(15, t.r, t.g, t.b), o.setXYZ(16, t.r, t.g, t.b), o.setXYZ(17, t.r, t.g, t.b), o.setXYZ(18, t.r, t.g, t.b), o.setXYZ(19, t.r, t.g, t.b), o.setXYZ(20, t.r, t.g, t.b), o.setXYZ(21, t.r, t.g, t.b), o.setXYZ(22, t.r, t.g, t.b), o.setXYZ(23, t.r, t.g, t.b), o.setXYZ(24, e.r, e.g, e.b), o.setXYZ(25, e.r, e.g, e.b), o.setXYZ(26, e.r, e.g, e.b), o.setXYZ(27, e.r, e.g, e.b), o.setXYZ(28, e.r, e.g, e.b), o.setXYZ(29, e.r, e.g, e.b), o.setXYZ(30, e.r, e.g, e.b), o.setXYZ(31, e.r, e.g, e.b), o.setXYZ(32, i.r, i.g, i.b), o.setXYZ(33, i.r, i.g, i.b), o.setXYZ(34, i.r, i.g, i.b), o.setXYZ(35, i.r, i.g, i.b), o.setXYZ(36, i.r, i.g, i.b), o.setXYZ(37, i.r, i.g, i.b), o.setXYZ(38, s.r, s.g, s.b), o.setXYZ(39, s.r, s.g, s.b), o.setXYZ(40, n.r, n.g, n.b), o.setXYZ(41, n.r, n.g, n.b), o.setXYZ(42, n.r, n.g, n.b), o.setXYZ(43, n.r, n.g, n.b), o.setXYZ(44, n.r, n.g, n.b), o.setXYZ(45, n.r, n.g, n.b), o.setXYZ(46, n.r, n.g, n.b), o.setXYZ(47, n.r, n.g, n.b), o.setXYZ(48, n.r, n.g, n.b), o.setXYZ(49, n.r, n.g, n.b), o.needsUpdate = !0; } - toJSON() { - let e = super.toJSON(); - return e.currentPoint = this.currentPoint.toArray(), e; - } - fromJSON(e) { - return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this; - } -}, la = class s1 extends Ge { - constructor(e = [ - new Z(0, -.5), - new Z(.5, 0), - new Z(0, .5) - ], t = 12, n = 0, i = Math.PI * 2){ - super(), this.type = "LatheGeometry", this.parameters = { - points: e, - segments: t, - phiStart: n, - phiLength: i - }, t = Math.floor(t), i = ct(i, 0, Math.PI * 2); - let r = [], a = [], o = [], c = [], l = [], h = 1 / t, u = new A, d = new Z, f = new A, m = new A, _ = new A, g = 0, p = 0; - for(let v = 0; v <= e.length - 1; v++)switch(v){ - case 0: - g = e[v + 1].x - e[v].x, p = e[v + 1].y - e[v].y, f.x = p * 1, f.y = -g, f.z = p * 0, _.copy(f), f.normalize(), c.push(f.x, f.y, f.z); - break; - case e.length - 1: - c.push(_.x, _.y, _.z); - break; - default: - g = e[v + 1].x - e[v].x, p = e[v + 1].y - e[v].y, f.x = p * 1, f.y = -g, f.z = p * 0, m.copy(f), f.x += _.x, f.y += _.y, f.z += _.z, f.normalize(), c.push(f.x, f.y, f.z), _.copy(m); - } - for(let v = 0; v <= t; v++){ - let x1 = n + v * h * i, y1 = Math.sin(x1), b = Math.cos(x1); - for(let w = 0; w <= e.length - 1; w++){ - u.x = e[w].x * y1, u.y = e[w].y, u.z = e[w].x * b, a.push(u.x, u.y, u.z), d.x = v / t, d.y = w / (e.length - 1), o.push(d.x, d.y); - let R = c[3 * w + 0] * y1, I = c[3 * w + 1], M = c[3 * w + 0] * b; - l.push(R, I, M); - } - } - for(let v = 0; v < t; v++)for(let x1 = 0; x1 < e.length - 1; x1++){ - let y1 = x1 + v * e.length, b = y1, w = y1 + e.length, R = y1 + e.length + 1, I = y1 + 1; - r.push(b, w, I), r.push(R, I, w); - } - this.setIndex(r), this.setAttribute("position", new ve(a, 3)), this.setAttribute("uv", new ve(o, 2)), this.setAttribute("normal", new ve(l, 3)); + update() { + let t = this.geometry, e = this.pointMap, i = 1, s = 1; + et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); + let n = this.camera.coordinateSystem === oe ? -1 : 0; + it("c", e, t, et, 0, 0, n), it("t", e, t, et, 0, 0, 1), it("n1", e, t, et, -i, -s, n), it("n2", e, t, et, i, -s, n), it("n3", e, t, et, -i, s, n), it("n4", e, t, et, i, s, n), it("f1", e, t, et, -i, -s, 1), it("f2", e, t, et, i, -s, 1), it("f3", e, t, et, -i, s, 1), it("f4", e, t, et, i, s, 1), it("u1", e, t, et, i * .7, s * 1.1, n), it("u2", e, t, et, -i * .7, s * 1.1, n), it("u3", e, t, et, 0, s * 2, n), it("cf1", e, t, et, -i, 0, 1), it("cf2", e, t, et, i, 0, 1), it("cf3", e, t, et, 0, -s, 1), it("cf4", e, t, et, 0, s, 1), it("cn1", e, t, et, -i, 0, n), it("cn2", e, t, et, i, 0, n), it("cn3", e, t, et, 0, -s, n), it("cn4", e, t, et, 0, s, n), t.getAttribute("position").needsUpdate = !0; } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + dispose() { + this.geometry.dispose(), this.material.dispose(); } - static fromJSON(e) { - return new s1(e.points, e.segments, e.phiStart, e.phiLength); +}; +function it(h, t, e, i, s, n, r) { + Ws.set(s, n, r).unproject(i); + let o = t[h]; + if (o !== void 0) { + let a = e.getAttribute("position"); + for(let l = 0, c = o.length; l < c; l++)a.setXYZ(o[l], Ws.x, Ws.y, Ws.z); } -}, qo = class s1 extends la { - constructor(e = 1, t = 1, n = 4, i = 8){ - let r = new ji; - r.absarc(0, -t / 2, e, Math.PI * 1.5, 0), r.absarc(0, t / 2, e, 0, Math.PI * .5), super(r.getPoints(n), i), this.type = "CapsuleGeometry", this.parameters = { - radius: e, - length: t, - capSegments: n, - radialSegments: i - }; +} +var Hs = new ft, ml = class extends Wt { + constructor(t, e = 16776960){ + let i = new Uint16Array([ + 0, + 1, + 1, + 2, + 2, + 3, + 3, + 0, + 4, + 5, + 5, + 6, + 6, + 7, + 7, + 4, + 0, + 4, + 1, + 5, + 2, + 6, + 3, + 7 + ]), s = new Float32Array(8 * 3), n = new L; + n.setIndex(new Z(i, 1)), n.setAttribute("position", new Z(s, 3)), super(n, new mt({ + color: e, + toneMapped: !1 + })), this.object = t, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update(); } - static fromJSON(e) { - return new s1(e.radius, e.length, e.capSegments, e.radialSegments); + update(t) { + if (t !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && Hs.setFromObject(this.object), Hs.isEmpty()) return; + let e = Hs.min, i = Hs.max, s = this.geometry.attributes.position, n = s.array; + n[0] = i.x, n[1] = i.y, n[2] = i.z, n[3] = e.x, n[4] = i.y, n[5] = i.z, n[6] = e.x, n[7] = e.y, n[8] = i.z, n[9] = i.x, n[10] = e.y, n[11] = i.z, n[12] = i.x, n[13] = i.y, n[14] = e.z, n[15] = e.x, n[16] = i.y, n[17] = e.z, n[18] = e.x, n[19] = e.y, n[20] = e.z, n[21] = i.x, n[22] = e.y, n[23] = e.z, s.needsUpdate = !0, this.geometry.computeBoundingSphere(); } -}, Yo = class s1 extends Ge { - constructor(e = 1, t = 32, n = 0, i = Math.PI * 2){ - super(), this.type = "CircleGeometry", this.parameters = { - radius: e, - segments: t, - thetaStart: n, - thetaLength: i - }, t = Math.max(3, t); - let r = [], a = [], o = [], c = [], l = new A, h = new Z; - a.push(0, 0, 0), o.push(0, 0, 1), c.push(.5, .5); - for(let u = 0, d = 3; u <= t; u++, d += 3){ - let f = n + u / t * i; - l.x = e * Math.cos(f), l.y = e * Math.sin(f), a.push(l.x, l.y, l.z), o.push(0, 0, 1), h.x = (a[d] / e + 1) / 2, h.y = (a[d + 1] / e + 1) / 2, c.push(h.x, h.y); - } - for(let u = 1; u <= t; u++)r.push(u, u + 1, 0); - this.setIndex(r), this.setAttribute("position", new ve(a, 3)), this.setAttribute("normal", new ve(o, 3)), this.setAttribute("uv", new ve(c, 2)); + setFromObject(t) { + return this.object = t, this.update(), this; } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + copy(t, e) { + return super.copy(t, e), this.object = t.object, this; } - static fromJSON(e) { - return new s1(e.radius, e.segments, e.thetaStart, e.thetaLength); + dispose() { + this.geometry.dispose(), this.material.dispose(); } -}, Ns = class s1 extends Ge { - constructor(e = 1, t = 1, n = 1, i = 32, r = 1, a = !1, o = 0, c = Math.PI * 2){ - super(), this.type = "CylinderGeometry", this.parameters = { - radiusTop: e, - radiusBottom: t, - height: n, - radialSegments: i, - heightSegments: r, - openEnded: a, - thetaStart: o, - thetaLength: c - }; - let l = this; - i = Math.floor(i), r = Math.floor(r); - let h = [], u = [], d = [], f = [], m = 0, _ = [], g = n / 2, p = 0; - v(), a === !1 && (e > 0 && x1(!0), t > 0 && x1(!1)), this.setIndex(h), this.setAttribute("position", new ve(u, 3)), this.setAttribute("normal", new ve(d, 3)), this.setAttribute("uv", new ve(f, 2)); - function v() { - let y1 = new A, b = new A, w = 0, R = (t - e) / n; - for(let I = 0; I <= r; I++){ - let M = [], T = I / r, O = T * (t - e) + e; - for(let Y = 0; Y <= i; Y++){ - let $ = Y / i, U = $ * c + o, z = Math.sin(U), q = Math.cos(U); - b.x = O * z, b.y = -T * n + g, b.z = O * q, u.push(b.x, b.y, b.z), y1.set(z, R, q).normalize(), d.push(y1.x, y1.y, y1.z), f.push($, 1 - T), M.push(m++); - } - _.push(M); - } - for(let I = 0; I < i; I++)for(let M = 0; M < r; M++){ - let T = _[M][I], O = _[M + 1][I], Y = _[M + 1][I + 1], $ = _[M][I + 1]; - h.push(T, O, $), h.push(O, Y, $), w += 6; - } - l.addGroup(p, w, 0), p += w; - } - function x1(y1) { - let b = m, w = new Z, R = new A, I = 0, M = y1 === !0 ? e : t, T = y1 === !0 ? 1 : -1; - for(let Y = 1; Y <= i; Y++)u.push(0, g * T, 0), d.push(0, T, 0), f.push(.5, .5), m++; - let O = m; - for(let Y = 0; Y <= i; Y++){ - let U = Y / i * c + o, z = Math.cos(U), q = Math.sin(U); - R.x = M * q, R.y = g * T, R.z = M * z, u.push(R.x, R.y, R.z), d.push(0, T, 0), w.x = z * .5 + .5, w.y = q * .5 * T + .5, f.push(w.x, w.y), m++; - } - for(let Y = 0; Y < i; Y++){ - let $ = b + Y, U = O + Y; - y1 === !0 ? h.push(U, U + 1, $) : h.push(U + 1, U, $), I += 3; - } - l.addGroup(p, I, y1 === !0 ? 1 : 2), p += I; - } +}, yl = class extends Wt { + constructor(t, e = 16776960){ + let i = new Uint16Array([ + 0, + 1, + 1, + 2, + 2, + 3, + 3, + 0, + 4, + 5, + 5, + 6, + 6, + 7, + 7, + 4, + 0, + 4, + 1, + 5, + 2, + 6, + 3, + 7 + ]), s = [ + 1, + 1, + 1, + -1, + 1, + 1, + -1, + -1, + 1, + 1, + -1, + 1, + 1, + 1, + -1, + -1, + 1, + -1, + -1, + -1, + -1, + 1, + -1, + -1 + ], n = new L; + n.setIndex(new Z(i, 1)), n.setAttribute("position", new E(s, 3)), super(n, new mt({ + color: e, + toneMapped: !1 + })), this.box = t, this.type = "Box3Helper", this.geometry.computeBoundingSphere(); } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + updateMatrixWorld(t) { + let e = this.box; + e.isEmpty() || (e.getCenter(this.position), e.getSize(this.scale), this.scale.multiplyScalar(.5), super.updateMatrixWorld(t)); } - static fromJSON(e) { - return new s1(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); + dispose() { + this.geometry.dispose(), this.material.dispose(); } -}, Zo = class s1 extends Ns { - constructor(e = 1, t = 1, n = 32, i = 1, r = !1, a = 0, o = Math.PI * 2){ - super(0, e, t, n, i, r, a, o), this.type = "ConeGeometry", this.parameters = { - radius: e, - height: t, - radialSegments: n, - heightSegments: i, - openEnded: r, - thetaStart: a, - thetaLength: o - }; +}, gl = class extends le { + constructor(t, e = 1, i = 16776960){ + let s = i, n = [ + 1, + -1, + 0, + -1, + 1, + 0, + -1, + -1, + 0, + 1, + 1, + 0, + -1, + 1, + 0, + -1, + -1, + 0, + 1, + -1, + 0, + 1, + 1, + 0 + ], r = new L; + r.setAttribute("position", new E(n, 3)), r.computeBoundingSphere(), super(r, new mt({ + color: s, + toneMapped: !1 + })), this.type = "PlaneHelper", this.plane = t, this.size = e; + let o = [ + 1, + 1, + 0, + -1, + 1, + 0, + -1, + -1, + 0, + 1, + 1, + 0, + -1, + -1, + 0, + 1, + -1, + 0 + ], a = new L; + a.setAttribute("position", new E(o, 3)), a.computeBoundingSphere(), this.add(new Ct(a, new _e({ + color: s, + opacity: .2, + transparent: !0, + depthWrite: !1, + toneMapped: !1 + }))); } - static fromJSON(e) { - return new s1(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); + updateMatrixWorld(t) { + this.position.set(0, 0, 0), this.scale.set(.5 * this.size, .5 * this.size, 1), this.lookAt(this.plane.normal), this.translateZ(-this.plane.constant), super.updateMatrixWorld(t); } -}, di = class s1 extends Ge { - constructor(e = [], t = [], n = 1, i = 0){ - super(), this.type = "PolyhedronGeometry", this.parameters = { - vertices: e, - indices: t, - radius: n, - detail: i - }; - let r = [], a = []; - o(i), l(n), h(), this.setAttribute("position", new ve(r, 3)), this.setAttribute("normal", new ve(r.slice(), 3)), this.setAttribute("uv", new ve(a, 2)), i === 0 ? this.computeVertexNormals() : this.normalizeNormals(); - function o(v) { - let x1 = new A, y1 = new A, b = new A; - for(let w = 0; w < t.length; w += 3)f(t[w + 0], x1), f(t[w + 1], y1), f(t[w + 2], b), c(x1, y1, b, v); - } - function c(v, x1, y1, b) { - let w = b + 1, R = []; - for(let I = 0; I <= w; I++){ - R[I] = []; - let M = v.clone().lerp(y1, I / w), T = x1.clone().lerp(y1, I / w), O = w - I; - for(let Y = 0; Y <= O; Y++)Y === 0 && I === w ? R[I][Y] = M : R[I][Y] = M.clone().lerp(T, Y / O); - } - for(let I = 0; I < w; I++)for(let M = 0; M < 2 * (w - I) - 1; M++){ - let T = Math.floor(M / 2); - M % 2 === 0 ? (d(R[I][T + 1]), d(R[I + 1][T]), d(R[I][T])) : (d(R[I][T + 1]), d(R[I + 1][T + 1]), d(R[I + 1][T])); - } - } - function l(v) { - let x1 = new A; - for(let y1 = 0; y1 < r.length; y1 += 3)x1.x = r[y1 + 0], x1.y = r[y1 + 1], x1.z = r[y1 + 2], x1.normalize().multiplyScalar(v), r[y1 + 0] = x1.x, r[y1 + 1] = x1.y, r[y1 + 2] = x1.z; - } - function h() { - let v = new A; - for(let x1 = 0; x1 < r.length; x1 += 3){ - v.x = r[x1 + 0], v.y = r[x1 + 1], v.z = r[x1 + 2]; - let y1 = g(v) / 2 / Math.PI + .5, b = p(v) / Math.PI + .5; - a.push(y1, 1 - b); - } - m(), u(); - } - function u() { - for(let v = 0; v < a.length; v += 6){ - let x1 = a[v + 0], y1 = a[v + 2], b = a[v + 4], w = Math.max(x1, y1, b), R = Math.min(x1, y1, b); - w > .9 && R < .1 && (x1 < .2 && (a[v + 0] += 1), y1 < .2 && (a[v + 2] += 1), b < .2 && (a[v + 4] += 1)); - } - } - function d(v) { - r.push(v.x, v.y, v.z); - } - function f(v, x1) { - let y1 = v * 3; - x1.x = e[y1 + 0], x1.y = e[y1 + 1], x1.z = e[y1 + 2]; - } - function m() { - let v = new A, x1 = new A, y1 = new A, b = new A, w = new Z, R = new Z, I = new Z; - for(let M = 0, T = 0; M < r.length; M += 9, T += 6){ - v.set(r[M + 0], r[M + 1], r[M + 2]), x1.set(r[M + 3], r[M + 4], r[M + 5]), y1.set(r[M + 6], r[M + 7], r[M + 8]), w.set(a[T + 0], a[T + 1]), R.set(a[T + 2], a[T + 3]), I.set(a[T + 4], a[T + 5]), b.copy(v).add(x1).add(y1).divideScalar(3); - let O = g(b); - _(w, T + 0, v, O), _(R, T + 2, x1, O), _(I, T + 4, y1, O); - } - } - function _(v, x1, y1, b) { - b < 0 && v.x === 1 && (a[x1] = v.x - 1), y1.x === 0 && y1.z === 0 && (a[x1] = b / 2 / Math.PI + .5); - } - function g(v) { - return Math.atan2(v.z, -v.x); - } - function p(v) { - return Math.atan2(-v.y, Math.sqrt(v.x * v.x + v.z * v.z)); + dispose() { + this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose(); + } +}, xl = new w, qs, ur, bl = class extends G { + constructor(t = new w(0, 0, 1), e = new w(0, 0, 0), i = 1, s = 16776960, n = i * .2, r = n * .2){ + super(), this.type = "ArrowHelper", qs === void 0 && (qs = new L, qs.setAttribute("position", new E([ + 0, + 0, + 0, + 0, + 1, + 0 + ], 3)), ur = new $i(0, .5, 1, 5, 1), ur.translate(0, -.5, 0)), this.position.copy(e), this.line = new le(qs, new mt({ + color: s, + toneMapped: !1 + })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new Ct(ur, new _e({ + color: s, + toneMapped: !1 + })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(t), this.setLength(i, n, r); + } + setDirection(t) { + if (t.y > .99999) this.quaternion.set(0, 0, 0, 1); + else if (t.y < -.99999) this.quaternion.set(1, 0, 0, 0); + else { + xl.set(t.z, 0, -t.x).normalize(); + let e = Math.acos(t.y); + this.quaternion.setFromAxisAngle(xl, e); } } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; + setLength(t, e = t * .2, i = e * .2) { + this.line.scale.set(1, Math.max(1e-4, t - e), 1), this.line.updateMatrix(), this.cone.scale.set(i, e, i), this.cone.position.y = t, this.cone.updateMatrix(); } - static fromJSON(e) { - return new s1(e.vertices, e.indices, e.radius, e.details); + setColor(t) { + this.line.material.color.set(t), this.cone.material.color.set(t); } -}, Jo = class s1 extends di { - constructor(e = 1, t = 0){ - let n = (1 + Math.sqrt(5)) / 2, i = 1 / n, r = [ - -1, - -1, - -1, - -1, - -1, - 1, - -1, - 1, - -1, - -1, - 1, - 1, - 1, - -1, - -1, - 1, - -1, - 1, - 1, - 1, - -1, - 1, - 1, - 1, + copy(t) { + return super.copy(t, !1), this.line.copy(t.line), this.cone.copy(t.cone), this; + } + dispose() { + this.line.geometry.dispose(), this.line.material.dispose(), this.cone.geometry.dispose(), this.cone.material.dispose(); + } +}, wl = class extends Wt { + constructor(t = 1){ + let e = [ 0, - -i, - -n, 0, - -i, - n, 0, - i, - -n, + t, 0, - i, - n, - -i, - -n, 0, - -i, - n, 0, - i, - -n, 0, - i, - n, 0, - -n, 0, - -i, - n, + t, 0, - -i, - -n, 0, - i, - n, 0, - i - ], a = [ - 3, - 11, - 7, - 3, - 7, - 15, - 3, - 15, - 13, - 7, - 19, - 17, - 7, - 17, - 6, - 7, - 6, - 15, - 17, - 4, - 8, - 17, - 8, - 10, - 17, - 10, - 6, - 8, 0, - 16, - 8, - 16, - 2, - 8, - 2, - 10, 0, - 12, - 1, 0, + t + ], i = [ 1, - 18, 0, - 18, - 16, - 6, - 10, - 2, - 6, - 2, - 13, - 6, - 13, - 15, - 2, - 16, - 18, - 2, - 18, - 3, - 2, - 3, - 13, - 18, + 0, 1, - 9, - 18, - 9, - 11, - 18, - 11, - 3, - 4, - 14, - 12, - 4, - 12, + .6, 0, - 4, 0, - 8, - 11, - 9, - 5, - 11, - 5, - 19, - 11, - 19, - 7, - 19, - 5, - 14, - 19, - 14, - 4, - 19, - 4, - 17, 1, - 12, - 14, + 0, + .6, 1, - 14, - 5, + 0, + 0, + 0, 1, - 5, - 9 - ]; - super(r, a, e, t), this.type = "DodecahedronGeometry", this.parameters = { - radius: e, - detail: t - }; + 0, + .6, + 1 + ], s = new L; + s.setAttribute("position", new E(e, 3)), s.setAttribute("color", new E(i, 3)); + let n = new mt({ + vertexColors: !0, + toneMapped: !1 + }); + super(s, n), this.type = "AxesHelper"; } - static fromJSON(e) { - return new s1(e.radius, e.detail); + setColors(t, e, i) { + let s = new P, n = this.geometry.attributes.color.array; + return s.set(t), s.toArray(n, 0), s.toArray(n, 3), s.set(e), s.toArray(n, 6), s.toArray(n, 9), s.set(i), s.toArray(n, 12), s.toArray(n, 15), this.geometry.attributes.color.needsUpdate = !0, this; } -}, vr = new A, yr = new A, ao = new A, Mr = new Un, $o = class extends Ge { - constructor(e = null, t = 1){ - if (super(), this.type = "EdgesGeometry", this.parameters = { - geometry: e, - thresholdAngle: t - }, e !== null) { - let i = Math.pow(10, 4), r = Math.cos(ai * t), a = e.getIndex(), o = e.getAttribute("position"), c = a ? a.count : o.count, l = [ - 0, - 0, - 0 - ], h = [ - "a", - "b", - "c" - ], u = new Array(3), d = {}, f = []; - for(let m = 0; m < c; m += 3){ - a ? (l[0] = a.getX(m), l[1] = a.getX(m + 1), l[2] = a.getX(m + 2)) : (l[0] = m, l[1] = m + 1, l[2] = m + 2); - let { a: _ , b: g , c: p } = Mr; - if (_.fromBufferAttribute(o, l[0]), g.fromBufferAttribute(o, l[1]), p.fromBufferAttribute(o, l[2]), Mr.getNormal(ao), u[0] = `${Math.round(_.x * i)},${Math.round(_.y * i)},${Math.round(_.z * i)}`, u[1] = `${Math.round(g.x * i)},${Math.round(g.y * i)},${Math.round(g.z * i)}`, u[2] = `${Math.round(p.x * i)},${Math.round(p.y * i)},${Math.round(p.z * i)}`, !(u[0] === u[1] || u[1] === u[2] || u[2] === u[0])) for(let v = 0; v < 3; v++){ - let x1 = (v + 1) % 3, y1 = u[v], b = u[x1], w = Mr[h[v]], R = Mr[h[x1]], I = `${y1}_${b}`, M = `${b}_${y1}`; - M in d && d[M] ? (ao.dot(d[M].normal) <= r && (f.push(w.x, w.y, w.z), f.push(R.x, R.y, R.z)), d[M] = null) : I in d || (d[I] = { - index0: l[v], - index1: l[x1], - normal: ao.clone() - }); + dispose() { + this.geometry.dispose(), this.material.dispose(); + } +}, Ml = class { + constructor(){ + this.type = "ShapePath", this.color = new P, this.subPaths = [], this.currentPath = null; + } + moveTo(t, e) { + return this.currentPath = new mi, this.subPaths.push(this.currentPath), this.currentPath.moveTo(t, e), this; + } + lineTo(t, e) { + return this.currentPath.lineTo(t, e), this; + } + quadraticCurveTo(t, e, i, s) { + return this.currentPath.quadraticCurveTo(t, e, i, s), this; + } + bezierCurveTo(t, e, i, s, n, r) { + return this.currentPath.bezierCurveTo(t, e, i, s, n, r), this; + } + splineThru(t) { + return this.currentPath.splineThru(t), this; + } + toShapes(t) { + function e(g) { + let x1 = []; + for(let b = 0, M = g.length; b < M; b++){ + let _ = g[b], v = new Me; + v.curves = _.curves, x1.push(v); + } + return x1; + } + function i(g, x1) { + let b = x1.length, M = !1; + for(let _ = b - 1, v = 0; v < b; _ = v++){ + let S = x1[_], A = x1[v], I = A.x - S.x, C = A.y - S.y; + if (Math.abs(C) > Number.EPSILON) { + if (C < 0 && (S = x1[v], I = -I, A = x1[_], C = -C), g.y < S.y || g.y > A.y) continue; + if (g.y === S.y) { + if (g.x === S.x) return !0; + } else { + let k = C * (g.x - S.x) - I * (g.y - S.y); + if (k === 0) return !0; + if (k < 0) continue; + M = !M; + } + } else { + if (g.y !== S.y) continue; + if (A.x <= g.x && g.x <= S.x || S.x <= g.x && g.x <= A.x) return !0; } } - for(let m in d)if (d[m]) { - let { index0: _ , index1: g } = d[m]; - vr.fromBufferAttribute(o, _), yr.fromBufferAttribute(o, g), f.push(vr.x, vr.y, vr.z), f.push(yr.x, yr.y, yr.z); + return M; + } + let s = he.isClockWise, n = this.subPaths; + if (n.length === 0) return []; + let r, o, a, l = []; + if (n.length === 1) return o = n[0], a = new Me, a.curves = o.curves, l.push(a), l; + let c = !s(n[0].getPoints()); + c = t ? !c : c; + let u = [], d = [], p = [], f = 0, m; + d[f] = void 0, p[f] = []; + for(let g = 0, x1 = n.length; g < x1; g++)o = n[g], m = o.getPoints(), r = s(m), r = t ? !r : r, r ? (!c && d[f] && f++, d[f] = { + s: new Me, + p: m + }, d[f].s.curves = o.curves, c && f++, p[f] = []) : p[f].push({ + h: o, + p: m[0] + }); + if (!d[0]) return e(n); + if (d.length > 1) { + let g = !1, x1 = 0; + for(let b = 0, M = d.length; b < M; b++)u[b] = []; + for(let b = 0, M = d.length; b < M; b++){ + let _ = p[b]; + for(let v = 0; v < _.length; v++){ + let S = _[v], A = !0; + for(let I = 0; I < d.length; I++)i(S.p, d[I].p) && (b !== I && x1++, A ? (A = !1, u[I].push(S)) : g = !0); + A && u[b].push(S); + } } - this.setAttribute("position", new ve(f, 3)); + x1 > 0 && g === !1 && (p = u); } + let y1; + for(let g = 0, x1 = d.length; g < x1; g++){ + a = d[g].s, l.push(a), y1 = p[g]; + for(let b = 0, M = y1.length; b < M; b++)a.holes.push(y1[b].h); + } + return l; } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } -}, Fn = class extends ji { - constructor(e){ - super(e), this.uuid = kt(), this.type = "Shape", this.holes = []; +}, _l = class extends qt { + constructor(t, e = null){ + super(), this.object = t, this.domElement = e, this.enabled = !0, this.state = -1, this.keys = {}, this.mouseButtons = { + LEFT: null, + MIDDLE: null, + RIGHT: null + }, this.touches = { + ONE: null, + TWO: null + }; } - getPointsHoles(e) { - let t = []; - for(let n = 0, i = this.holes.length; n < i; n++)t[n] = this.holes[n].getPoints(e); - return t; + connect() {} + disconnect() {} + dispose() {} + update() {} +}; +function kd(h, t) { + let e = h.image && h.image.width ? h.image.width / h.image.height : 1; + return e > t ? (h.repeat.x = 1, h.repeat.y = e / t, h.offset.x = 0, h.offset.y = (1 - h.repeat.y) / 2) : (h.repeat.x = t / e, h.repeat.y = 1, h.offset.x = (1 - h.repeat.x) / 2, h.offset.y = 0), h; +} +function Pd(h, t) { + let e = h.image && h.image.width ? h.image.width / h.image.height : 1; + return e > t ? (h.repeat.x = t / e, h.repeat.y = 1, h.offset.x = (1 - h.repeat.x) / 2, h.offset.y = 0) : (h.repeat.x = 1, h.repeat.y = e / t, h.offset.x = 0, h.offset.y = (1 - h.repeat.y) / 2), h; +} +function Od(h) { + return h.repeat.x = 1, h.repeat.y = 1, h.offset.x = 0, h.offset.y = 0, h; +} +function Nd(h, t, e, i) { + let s = Vd(i); + switch(e){ + case rc: + return h * t; + case ac: + return h * t; + case hc: + return h * t * 2; + case Tl: + return h * t / s.components * s.byteLength; + case Il: + return h * t / s.components * s.byteLength; + case lc: + return h * t * 2 / s.components * s.byteLength; + case cc: + return h * t * 2 / s.components * s.byteLength; + case oc: + return h * t * 3 / s.components * s.byteLength; + case Li: + return h * t * 4 / s.components * s.byteLength; + case uc: + return h * t * 4 / s.components * s.byteLength; + case dc: + case pc: + return Math.floor((h + 3) / 4) * Math.floor((t + 3) / 4) * 8; + case fc: + case mc: + return Math.floor((h + 3) / 4) * Math.floor((t + 3) / 4) * 16; + case gc: + case bc: + return Math.max(h, 16) * Math.max(t, 8) / 4; + case yc: + case xc: + return Math.max(h, 8) * Math.max(t, 8) / 2; + case wc: + case Mc: + return Math.floor((h + 3) / 4) * Math.floor((t + 3) / 4) * 8; + case _c: + return Math.floor((h + 3) / 4) * Math.floor((t + 3) / 4) * 16; + case vc: + return Math.floor((h + 3) / 4) * Math.floor((t + 3) / 4) * 16; + case Ac: + return Math.floor((h + 4) / 5) * Math.floor((t + 3) / 4) * 16; + case Sc: + return Math.floor((h + 4) / 5) * Math.floor((t + 4) / 5) * 16; + case Tc: + return Math.floor((h + 5) / 6) * Math.floor((t + 4) / 5) * 16; + case Ic: + return Math.floor((h + 5) / 6) * Math.floor((t + 5) / 6) * 16; + case Cc: + return Math.floor((h + 7) / 8) * Math.floor((t + 4) / 5) * 16; + case zc: + return Math.floor((h + 7) / 8) * Math.floor((t + 5) / 6) * 16; + case Fc: + return Math.floor((h + 7) / 8) * Math.floor((t + 7) / 8) * 16; + case Bc: + return Math.floor((h + 9) / 10) * Math.floor((t + 4) / 5) * 16; + case Ec: + return Math.floor((h + 9) / 10) * Math.floor((t + 5) / 6) * 16; + case Rc: + return Math.floor((h + 9) / 10) * Math.floor((t + 7) / 8) * 16; + case kc: + return Math.floor((h + 9) / 10) * Math.floor((t + 9) / 10) * 16; + case Pc: + return Math.floor((h + 11) / 12) * Math.floor((t + 9) / 10) * 16; + case Oc: + return Math.floor((h + 11) / 12) * Math.floor((t + 11) / 12) * 16; + case Nc: + case Vc: + case Dc: + return Math.ceil(h / 4) * Math.ceil(t / 4) * 16; + case Lc: + case Uc: + return Math.ceil(h / 4) * Math.ceil(t / 4) * 8; + case Wc: + case Hc: + return Math.ceil(h / 4) * Math.ceil(t / 4) * 16; + } + throw new Error(`Unable to determine texture byte length for ${e} format.`); +} +function Vd(h) { + switch(h){ + case Sl: + case $l: + return { + byteLength: 1, + components: 1 + }; + case jl: + case Ql: + case tc: + return { + byteLength: 2, + components: 1 + }; + case ec: + case ic: + return { + byteLength: 2, + components: 4 + }; + case Wo: + case Kl: + case pi: + return { + byteLength: 4, + components: 1 + }; + case nc: + return { + byteLength: 4, + components: 3 + }; } - extractPoints(e) { - return { - shape: this.getPoints(e), - holes: this.getPointsHoles(e) - }; + throw new Error(`Unknown texture type ${h}.`); +} +var Of = { + contain: kd, + cover: Pd, + fill: Od, + getByteLength: Nd +}; +typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { + detail: { + revision: vl } - copy(e) { - super.copy(e), this.holes = []; - for(let t = 0, n = e.holes.length; t < n; t++){ - let i = e.holes[t]; - this.holes.push(i.clone()); - } - return this; +})); +typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = vl); +function br1() { + let e = null, n = !1, t = null, i = null; + function c(s, h) { + t(s, h), i = e.requestAnimationFrame(c); } - toJSON() { - let e = super.toJSON(); - e.uuid = this.uuid, e.holes = []; - for(let t = 0, n = this.holes.length; t < n; t++){ - let i = this.holes[t]; - e.holes.push(i.toJSON()); + return { + start: function() { + n !== !0 && t !== null && (i = e.requestAnimationFrame(c), n = !0); + }, + stop: function() { + e.cancelAnimationFrame(i), n = !1; + }, + setAnimationLoop: function(s) { + t = s; + }, + setContext: function(s) { + e = s; } - return e; + }; +} +function uo1(e) { + let n = new WeakMap; + function t(d, I) { + let T = d.array, C = d.usage, R = T.byteLength, S = e.createBuffer(); + e.bindBuffer(I, S), e.bufferData(I, T, C), d.onUploadCallback(); + let x1; + if (T instanceof Float32Array) x1 = e.FLOAT; + else if (T instanceof Uint16Array) d.isFloat16BufferAttribute ? x1 = e.HALF_FLOAT : x1 = e.UNSIGNED_SHORT; + else if (T instanceof Int16Array) x1 = e.SHORT; + else if (T instanceof Uint32Array) x1 = e.UNSIGNED_INT; + else if (T instanceof Int32Array) x1 = e.INT; + else if (T instanceof Int8Array) x1 = e.BYTE; + else if (T instanceof Uint8Array) x1 = e.UNSIGNED_BYTE; + else if (T instanceof Uint8ClampedArray) x1 = e.UNSIGNED_BYTE; + else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: " + T); + return { + buffer: S, + type: x1, + bytesPerElement: T.BYTES_PER_ELEMENT, + version: d.version, + size: R + }; } - fromJSON(e) { - super.fromJSON(e), this.uuid = e.uuid, this.holes = []; - for(let t = 0, n = e.holes.length; t < n; t++){ - let i = e.holes[t]; - this.holes.push(new ji().fromJSON(i)); + function i(d, I, T) { + let C = I.array, R = I.updateRanges; + if (e.bindBuffer(T, d), R.length === 0) e.bufferSubData(T, 0, C); + else { + R.sort((x1, O)=>x1.start - O.start); + let S = 0; + for(let x1 = 1; x1 < R.length; x1++){ + let O = R[S], L = R[x1]; + L.start <= O.start + O.count + 1 ? O.count = Math.max(O.count, L.start + L.count - O.start) : (++S, R[S] = L); + } + R.length = S + 1; + for(let x1 = 0, O = R.length; x1 < O; x1++){ + let L = R[x1]; + e.bufferSubData(T, L.start * C.BYTES_PER_ELEMENT, C, L.start, L.count); + } + I.clearUpdateRanges(); + } + I.onUploadCallback(); + } + function c(d) { + return d.isInterleavedBufferAttribute && (d = d.data), n.get(d); + } + function s(d) { + d.isInterleavedBufferAttribute && (d = d.data); + let I = n.get(d); + I && (e.deleteBuffer(I.buffer), n.delete(d)); + } + function h(d, I) { + if (d.isInterleavedBufferAttribute && (d = d.data), d.isGLBufferAttribute) { + let C = n.get(d); + (!C || C.version < d.version) && n.set(d, { + buffer: d.buffer, + type: d.type, + bytesPerElement: d.elementSize, + version: d.version + }); + return; } - return this; - } -}, ex = { - triangulate: function(s1, e, t = 2) { - let n = e && e.length, i = n ? e[0] * t : s1.length, r = Pd(s1, 0, i, t, !0), a = []; - if (!r || r.next === r.prev) return a; - let o, c, l, h, u, d, f; - if (n && (r = rx(s1, e, r, t)), s1.length > 80 * t) { - o = l = s1[0], c = h = s1[1]; - for(let m = t; m < i; m += t)u = s1[m], d = s1[m + 1], u < o && (o = u), d < c && (c = d), u > l && (l = u), d > h && (h = d); - f = Math.max(l - o, h - c), f = f !== 0 ? 32767 / f : 0; + let T = n.get(d); + if (T === void 0) n.set(d, t(d, I)); + else if (T.version < d.version) { + if (T.size !== d.array.byteLength) throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported."); + i(T.buffer, d, I), T.version = d.version; } - return Os(r, a, t, o, c, f, 0), a; } + return { + get: c, + remove: s, + update: h + }; +} +var po1 = `#ifdef USE_ALPHAHASH + if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; +#endif`, ho1 = `#ifdef USE_ALPHAHASH + const float ALPHA_HASH_SCALE = 0.05; + float hash2D( vec2 value ) { + return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); + } + float hash3D( vec3 value ) { + return hash2D( vec2( hash2D( value.xy ), value.z ) ); + } + float getAlphaHashThreshold( vec3 position ) { + float maxDeriv = max( + length( dFdx( position.xyz ) ), + length( dFdy( position.xyz ) ) + ); + float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); + vec2 pixScales = vec2( + exp2( floor( log2( pixScale ) ) ), + exp2( ceil( log2( pixScale ) ) ) + ); + vec2 alpha = vec2( + hash3D( floor( pixScales.x * position.xyz ) ), + hash3D( floor( pixScales.y * position.xyz ) ) + ); + float lerpFactor = fract( log2( pixScale ) ); + float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; + float a = min( lerpFactor, 1.0 - lerpFactor ); + vec3 cases = vec3( + x * x / ( 2.0 * a * ( 1.0 - a ) ), + ( x - 0.5 * a ) / ( 1.0 - a ), + 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) + ); + float threshold = ( x < ( 1.0 - a ) ) + ? ( ( x < a ) ? cases.x : cases.y ) + : cases.z; + return clamp( threshold , 1.0e-6, 1.0 ); + } +#endif`, mo1 = `#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; +#endif`, _o1 = `#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`, vo1 = `#ifdef USE_ALPHATEST + #ifdef ALPHA_TO_COVERAGE + diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); + if ( diffuseColor.a == 0.0 ) discard; + #else + if ( diffuseColor.a < alphaTest ) discard; + #endif +#endif`, go1 = `#ifdef USE_ALPHATEST + uniform float alphaTest; +#endif`, So1 = `#ifdef USE_AOMAP + float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; + reflectedLight.indirectDiffuse *= ambientOcclusion; + #if defined( USE_CLEARCOAT ) + clearcoatSpecularIndirect *= ambientOcclusion; + #endif + #if defined( USE_SHEEN ) + sheenSpecularIndirect *= ambientOcclusion; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) + float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); + reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); + #endif +#endif`, Eo1 = `#ifdef USE_AOMAP + uniform sampler2D aoMap; + uniform float aoMapIntensity; +#endif`, Mo1 = `#ifdef USE_BATCHING + #if ! defined( GL_ANGLE_multi_draw ) + #define gl_DrawID _gl_DrawID + uniform int _gl_DrawID; + #endif + uniform highp sampler2D batchingTexture; + uniform highp usampler2D batchingIdTexture; + mat4 getBatchingMatrix( const in float i ) { + int size = textureSize( batchingTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } + float getIndirectIndex( const in int i ) { + int size = textureSize( batchingIdTexture, 0 ).x; + int x = i % size; + int y = i / size; + return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); + } +#endif +#ifdef USE_BATCHING_COLOR + uniform sampler2D batchingColorTexture; + vec3 getBatchingColor( const in float i ) { + int size = textureSize( batchingColorTexture, 0 ).x; + int j = int( i ); + int x = j % size; + int y = j / size; + return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; + } +#endif`, To1 = `#ifdef USE_BATCHING + mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); +#endif`, xo1 = `vec3 transformed = vec3( position ); +#ifdef USE_ALPHAHASH + vPosition = vec3( position ); +#endif`, Ao1 = `vec3 objectNormal = vec3( normal ); +#ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); +#endif`, Ro1 = `float G_BlinnPhong_Implicit( ) { + return 0.25; +} +float D_BlinnPhong( const in float shininess, const in float dotNH ) { + return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); +} +vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( specularColor, 1.0, dotVH ); + float G = G_BlinnPhong_Implicit( ); + float D = D_BlinnPhong( shininess, dotNH ); + return F * ( G * D ); +} // validated`, Co1 = `#ifdef USE_IRIDESCENCE + const mat3 XYZ_TO_REC709 = mat3( + 3.2404542, -0.9692660, 0.0556434, + -1.5371385, 1.8760108, -0.2040259, + -0.4985314, 0.0415560, 1.0572252 + ); + vec3 Fresnel0ToIor( vec3 fresnel0 ) { + vec3 sqrtF0 = sqrt( fresnel0 ); + return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); + } + vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { + return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); + } + float IorToFresnel0( float transmittedIor, float incidentIor ) { + return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); + } + vec3 evalSensitivity( float OPD, vec3 shift ) { + float phase = 2.0 * PI * OPD * 1.0e-9; + vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); + vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); + vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); + vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); + 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 ) ); + xyz /= 1.0685e-7; + vec3 rgb = XYZ_TO_REC709 * xyz; + return rgb; + } + vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { + vec3 I; + float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); + float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); + float cosTheta2Sq = 1.0 - sinTheta2Sq; + if ( cosTheta2Sq < 0.0 ) { + return vec3( 1.0 ); + } + float cosTheta2 = sqrt( cosTheta2Sq ); + float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); + float R12 = F_Schlick( R0, 1.0, cosTheta1 ); + float T121 = 1.0 - R12; + float phi12 = 0.0; + if ( iridescenceIOR < outsideIOR ) phi12 = PI; + float phi21 = PI - phi12; + vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); + vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); + vec3 phi23 = vec3( 0.0 ); + if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; + if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; + if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; + float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; + vec3 phi = vec3( phi21 ) + phi23; + vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); + vec3 r123 = sqrt( R123 ); + vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); + vec3 C0 = R12 + Rs; + I = C0; + vec3 Cm = Rs - T121; + for ( int m = 1; m <= 2; ++ m ) { + Cm *= r123; + vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); + I += Cm * Sm; + } + return max( I, vec3( 0.0 ) ); + } +#endif`, bo1 = `#ifdef USE_BUMPMAP + uniform sampler2D bumpMap; + uniform float bumpScale; + vec2 dHdxy_fwd() { + vec2 dSTdx = dFdx( vBumpMapUv ); + vec2 dSTdy = dFdy( vBumpMapUv ); + float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; + return vec2( dBx, dBy ); + } + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { + vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); + vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); + vec3 vN = surf_norm; + vec3 R1 = cross( vSigmaY, vN ); + vec3 R2 = cross( vN, vSigmaX ); + float fDet = dot( vSigmaX, R1 ) * faceDirection; + vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); + return normalize( abs( fDet ) * surf_norm - vGrad ); + } +#endif`, Po1 = `#if NUM_CLIPPING_PLANES > 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`, Lo1 = `#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`, Uo1 = `#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`, Do1 = `#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`, wo1 = `#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`, Io1 = `#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`, yo1 = `#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`, No1 = `#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`, Oo1 = `#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; }; -function Pd(s1, e, t, n, i) { - let r, a; - if (i === gx(s1, e, t, n) > 0) for(r = e; r < t; r += n)a = tu(r, s1[r], s1[r + 1], a); - else for(r = t - n; r >= e; r -= n)a = tu(r, s1[r], s1[r + 1], a); - return a && Ma(a, a.next) && (Bs(a), a = a.next), a; -} -function fi(s1, e) { - if (!s1) return s1; - e || (e = s1); - let t = s1, n; - do if (n = !1, !t.steiner && (Ma(t, t.next) || st(t.prev, t, t.next) === 0)) { - if (Bs(t), t = e = t.prev, t === t.next) break; - n = !0; - } else t = t.next; - while (n || t !== e) - return e; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`, Fo1 = `#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`, Bo1 = `vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`, Go1 = `#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`, Ho1 = `#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`, Vo1 = `#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`, ko1 = `#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`, zo1 = "gl_FragColor = linearToOutputTexel( gl_FragColor );", Wo1 = `vec4 LinearTransferOETF( in vec4 value ) { + return value; } -function Os(s1, e, t, n, i, r, a) { - if (!s1) return; - !a && r && hx(s1, n, i, r); - let o = s1, c, l; - for(; s1.prev !== s1.next;){ - if (c = s1.prev, l = s1.next, r ? nx(s1, n, i, r) : tx(s1)) { - e.push(c.i / t | 0), e.push(s1.i / t | 0), e.push(l.i / t | 0), Bs(s1), s1 = l.next, o = l.next; - continue; - } - if (s1 = l, s1 === o) { - a ? a === 1 ? (s1 = ix(fi(s1), e, t), Os(s1, e, t, n, i, r, 2)) : a === 2 && sx(s1, e, t, n, i, r) : Os(fi(s1), e, t, n, i, r, 1); - break; - } - } +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } -function tx(s1) { - let e = s1.prev, t = s1, n = s1.next; - if (st(e, t, n) >= 0) return !1; - let i = e.x, r = t.x, a = n.x, o = e.y, c = t.y, l = n.y, h = i < r ? i < a ? i : a : r < a ? r : a, u = o < c ? o < l ? o : l : c < l ? c : l, d = i > r ? i > a ? i : a : r > a ? r : a, f = o > c ? o > l ? o : l : c > l ? c : l, m = n.next; - for(; m !== e;){ - if (m.x >= h && m.x <= d && m.y >= u && m.y <= f && Gi(i, o, r, c, a, l, m.x, m.y) && st(m.prev, m, m.next) >= 0) return !1; - m = m.next; - } - return !0; +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`, Xo1 = `#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`, Yo = `#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`, qo1 = `#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`, Ko = `#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`, $o = `#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`, Zo1 = `#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`, Qo = `#ifdef USE_FOG + varying float vFogDepth; +#endif`, Jo1 = `#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`, jo = `#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`, es = `#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`, ts1 = `#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`, ns1 = `LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`, is = `varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -function nx(s1, e, t, n) { - let i = s1.prev, r = s1, a = s1.next; - if (st(i, r, a) >= 0) return !1; - let o = i.x, c = r.x, l = a.x, h = i.y, u = r.y, d = a.y, f = o < c ? o < l ? o : l : c < l ? c : l, m = h < u ? h < d ? h : d : u < d ? u : d, _ = o > c ? o > l ? o : l : c > l ? c : l, g = h > u ? h > d ? h : d : u > d ? u : d, p = Ko(f, m, e, t, n), v = Ko(_, g, e, t, n), x1 = s1.prevZ, y1 = s1.nextZ; - for(; x1 && x1.z >= p && y1 && y1.z <= v;){ - if (x1.x >= f && x1.x <= _ && x1.y >= m && x1.y <= g && x1 !== i && x1 !== a && Gi(o, h, c, u, l, d, x1.x, x1.y) && st(x1.prev, x1, x1.next) >= 0 || (x1 = x1.prevZ, y1.x >= f && y1.x <= _ && y1.y >= m && y1.y <= g && y1 !== i && y1 !== a && Gi(o, h, c, u, l, d, y1.x, y1.y) && st(y1.prev, y1, y1.next) >= 0)) return !1; - y1 = y1.nextZ; - } - for(; x1 && x1.z >= p;){ - if (x1.x >= f && x1.x <= _ && x1.y >= m && x1.y <= g && x1 !== i && x1 !== a && Gi(o, h, c, u, l, d, x1.x, x1.y) && st(x1.prev, x1, x1.next) >= 0) return !1; - x1 = x1.prevZ; - } - for(; y1 && y1.z <= v;){ - if (y1.x >= f && y1.x <= _ && y1.y >= m && y1.y <= g && y1 !== i && y1 !== a && Gi(o, h, c, u, l, d, y1.x, y1.y) && st(y1.prev, y1, y1.next) >= 0) return !1; - y1 = y1.nextZ; - } - return !0; +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -function ix(s1, e, t) { - let n = s1; - do { - let i = n.prev, r = n.next.next; - !Ma(i, r) && Ld(i, n, n.next, r) && Fs(i, r) && Fs(r, i) && (e.push(i.i / t | 0), e.push(n.i / t | 0), e.push(r.i / t | 0), Bs(n), Bs(n.next), n = s1 = r), n = n.next; - }while (n !== s1) - return fi(n); +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`, rs1 = `uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; } -function sx(s1, e, t, n, i, r) { - let a = s1; - do { - let o = a.next.next; - for(; o !== a.prev;){ - if (a.i !== o.i && fx(a, o)) { - let c = Id(a, o); - a = fi(a, a.next), c = fi(c, c.next), Os(a, e, t, n, i, r, 0), Os(c, e, t, n, i, r, 0); - return; - } - o = o.next; - } - a = a.next; - }while (a !== s1) +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; } -function rx(s1, e, t, n) { - let i = [], r, a, o, c, l; - for(r = 0, a = e.length; r < a; r++)o = e[r] * n, c = r < a - 1 ? e[r + 1] * n : s1.length, l = Pd(s1, o, c, n, !1), l === l.next && (l.steiner = !0), i.push(dx(l)); - for(i.sort(ax), r = 0; r < i.length; r++)t = ox(i[r], t); - return t; +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; } -function ax(s1, e) { - return s1.x - e.x; +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; } -function ox(s1, e) { - let t = cx(s1, e); - if (!t) return e; - let n = Id(t, s1); - return fi(n, n.next), fi(t, t.next); +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); } -function cx(s1, e) { - let t = e, n = -1 / 0, i, r = s1.x, a = s1.y; - do { - if (a <= t.y && a >= t.next.y && t.next.y !== t.y) { - let d = t.x + (a - t.y) * (t.next.x - t.x) / (t.next.y - t.y); - if (d <= r && d > n && (n = d, i = t.x < t.next.x ? t : t.next, d === r)) return i; - } - t = t.next; - }while (t !== e) - if (!i) return null; - let o = i, c = i.x, l = i.y, h = 1 / 0, u; - t = i; - do r >= t.x && t.x >= c && r !== t.x && Gi(a < l ? r : n, a, c, l, a < l ? n : r, a, t.x, t.y) && (u = Math.abs(a - t.y) / (r - t.x), Fs(t, s1) && (u < h || u === h && (t.x > i.x || t.x === i.x && lx(i, t))) && (i = t, h = u)), t = t.next; - while (t !== o) - return i; +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`, as1 = `#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`, os1 = `ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`, ss1 = `varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -function lx(s1, e) { - return st(s1.prev, s1, e.prev) < 0 && st(e.next, s1, s1.next) < 0; +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -function hx(s1, e, t, n) { - let i = s1; - do i.z === 0 && (i.z = Ko(i.x, i.y, e, t, n)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next; - while (i !== s1) - i.prevZ.nextZ = null, i.prevZ = null, ux(i); +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`, cs1 = `BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`, ls1 = `varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } -function ux(s1) { - let e, t, n, i, r, a, o, c, l = 1; - do { - for(t = s1, s1 = null, r = null, a = 0; t;){ - for(a++, n = t, o = 0, e = 0; e < l && (o++, n = n.nextZ, !!n); e++); - for(c = l; o > 0 || c > 0 && n;)o !== 0 && (c === 0 || !n || t.z <= n.z) ? (i = t, t = t.nextZ, o--) : (i = n, n = n.nextZ, c--), r ? r.nextZ = i : s1 = i, i.prevZ = r, r = i; - t = n; - } - r.nextZ = null, l *= 2; - }while (a > 1) - return s1; -} -function Ko(s1, e, t, n, i) { - return s1 = (s1 - t) * i | 0, e = (e - n) * i | 0, s1 = (s1 | s1 << 8) & 16711935, s1 = (s1 | s1 << 4) & 252645135, s1 = (s1 | s1 << 2) & 858993459, s1 = (s1 | s1 << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, s1 | e << 1; -} -function dx(s1) { - let e = s1, t = s1; - do (e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next; - while (e !== s1) - return t; +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -function Gi(s1, e, t, n, i, r, a, o) { - return (i - a) * (e - o) >= (s1 - a) * (r - o) && (s1 - a) * (n - o) >= (t - a) * (e - o) && (t - a) * (r - o) >= (i - a) * (n - o); +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`, fs1 = `PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`, ds1 = `struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } -function fx(s1, e) { - return s1.next.i !== e.i && s1.prev.i !== e.i && !px(s1, e) && (Fs(s1, e) && Fs(e, s1) && mx(s1, e) && (st(s1.prev, s1, e.prev) || st(s1, e.prev, e)) || Ma(s1, e) && st(s1.prev, s1, s1.next) > 0 && st(e.prev, e, e.next) > 0); +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); } -function st(s1, e, t) { - return (e.y - s1.y) * (t.x - e.x) - (e.x - s1.x) * (t.y - e.y); +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); } -function Ma(s1, e) { - return s1.x === e.x && s1.y === e.y; +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); } -function Ld(s1, e, t, n) { - let i = br(st(s1, e, t)), r = br(st(s1, e, n)), a = br(st(t, n, s1)), o = br(st(t, n, e)); - return !!(i !== r && a !== o || i === 0 && Sr(s1, t, e) || r === 0 && Sr(s1, n, e) || a === 0 && Sr(t, s1, n) || o === 0 && Sr(t, e, n)); +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; } -function Sr(s1, e, t) { - return e.x <= Math.max(s1.x, t.x) && e.x >= Math.min(s1.x, t.x) && e.y <= Math.max(s1.y, t.y) && e.y >= Math.min(s1.y, t.y); +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } -function br(s1) { - return s1 > 0 ? 1 : s1 < 0 ? -1 : 0; +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; } -function px(s1, e) { - let t = s1; - do { - if (t.i !== s1.i && t.next.i !== s1.i && t.i !== e.i && t.next.i !== e.i && Ld(t, t.next, s1, e)) return !0; - t = t.next; - }while (t !== s1) - return !1; +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); } -function Fs(s1, e) { - return st(s1.prev, s1, s1.next) < 0 ? st(s1, e, s1.next) >= 0 && st(s1, s1.prev, e) >= 0 : st(s1, e, s1.prev) < 0 || st(s1, s1.next, e) < 0; +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } -function mx(s1, e) { - let t = s1, n = !1, i = (s1.x + e.x) / 2, r = (s1.y + e.y) / 2; - do t.y > r != t.next.y > r && t.next.y !== t.y && i < (t.next.x - t.x) * (r - t.y) / (t.next.y - t.y) + t.x && (n = !n), t = t.next; - while (t !== s1) - return n; +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } -function Id(s1, e) { - let t = new Qo(s1.i, s1.x, s1.y), n = new Qo(e.i, e.x, e.y), i = s1.next, r = e.prev; - return s1.next = e, e.prev = s1, t.next = i, i.prev = t, n.next = t, t.prev = n, r.next = n, n.prev = r, n; +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); } -function tu(s1, e, t, n) { - let i = new Qo(s1, e, t); - return n ? (i.next = n.next, i.prev = n, n.next.prev = i, n.next = i) : (i.prev = i, i.next = i), i; +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); } -function Bs(s1) { - s1.next.prev = s1.prev, s1.prev.next = s1.next, s1.prevZ && (s1.prevZ.nextZ = s1.nextZ), s1.nextZ && (s1.nextZ.prevZ = s1.prevZ); +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; } -function Qo(s1, e, t) { - this.i = s1, this.x = e, this.y = t, this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1; +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; } -function gx(s1, e, t, n) { - let i = 0; - for(let r = e, a = t - n; r < t; r += n)i += (s1[a] - s1[r]) * (s1[r + 1] + s1[a + 1]), a = r; - return i; +#ifdef USE_IRIDESCENCE +void 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 ) { +#else +void 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 ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; } -var yn = class s1 { - static area(e) { - let t = e.length, n = 0; - for(let i = t - 1, r = 0; r < t; i = r++)n += e[i].x * e[r].y - e[r].x * e[i].y; - return n * .5; - } - static isClockWise(e) { - return s1.area(e) < 0; - } - static triangulateShape(e, t) { - let n = [], i = [], r = []; - nu(e), iu(n, e); - let a = e.length; - t.forEach(nu); - for(let c = 0; c < t.length; c++)i.push(a), a += t[c].length, iu(n, t[c]); - let o = ex.triangulate(n, i); - for(let c = 0; c < o.length; c += 3)r.push(o.slice(c, c + 3)); - return r; - } -}; -function nu(s1) { - let e = s1.length; - e > 2 && s1[e - 1].equals(s1[0]) && s1.pop(); -} -function iu(s1, e) { - for(let t = 0; t < e.length; t++)s1.push(e[t].x), s1.push(e[t].y); -} -var jo = class s1 extends Ge { - constructor(e = new Fn([ - new Z(.5, .5), - new Z(-.5, .5), - new Z(-.5, -.5), - new Z(.5, -.5) - ]), t = {}){ - super(), this.type = "ExtrudeGeometry", this.parameters = { - shapes: e, - options: t - }, e = Array.isArray(e) ? e : [ - e - ]; - let n = this, i = [], r = []; - for(let o = 0, c = e.length; o < c; o++){ - let l = e[o]; - a(l); - } - this.setAttribute("position", new ve(i, 3)), this.setAttribute("uv", new ve(r, 2)), this.computeVertexNormals(); - function a(o) { - let c = [], l = t.curveSegments !== void 0 ? t.curveSegments : 12, h = t.steps !== void 0 ? t.steps : 1, u = t.depth !== void 0 ? t.depth : 1, d = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, f = t.bevelThickness !== void 0 ? t.bevelThickness : .2, m = t.bevelSize !== void 0 ? t.bevelSize : f - .1, _ = t.bevelOffset !== void 0 ? t.bevelOffset : 0, g = t.bevelSegments !== void 0 ? t.bevelSegments : 3, p = t.extrudePath, v = t.UVGenerator !== void 0 ? t.UVGenerator : _x, x1, y1 = !1, b, w, R, I; - p && (x1 = p.getSpacedPoints(h), y1 = !0, d = !1, b = p.computeFrenetFrames(h, !1), w = new A, R = new A, I = new A), d || (g = 0, f = 0, m = 0, _ = 0); - let M = o.extractPoints(l), T = M.shape, O = M.holes; - if (!yn.isClockWise(T)) { - T = T.reverse(); - for(let L = 0, oe = O.length; L < oe; L++){ - let X = O[L]; - yn.isClockWise(X) && (O[L] = X.reverse()); - } - } - let $ = yn.triangulateShape(T, O), U = T; - for(let L = 0, oe = O.length; L < oe; L++){ - let X = O[L]; - T = T.concat(X); - } - function z(L, oe, X) { - return oe || console.error("THREE.ExtrudeGeometry: vec does not exist"), L.clone().addScaledVector(oe, X); - } - let q = T.length, H = $.length; - function ne(L, oe, X) { - let ie, J, Se, me = L.x - oe.x, ye = L.y - oe.y, Ne = X.x - L.x, qe = X.y - L.y, rt = me * me + ye * ye, C = me * qe - ye * Ne; - if (Math.abs(C) > Number.EPSILON) { - let S = Math.sqrt(rt), B = Math.sqrt(Ne * Ne + qe * qe), ee = oe.x - ye / S, j = oe.y + me / S, te = X.x - qe / B, Me = X.y + Ne / B, re = ((te - ee) * qe - (Me - j) * Ne) / (me * qe - ye * Ne); - ie = ee + me * re - L.x, J = j + ye * re - L.y; - let de = ie * ie + J * J; - if (de <= 2) return new Z(ie, J); - Se = Math.sqrt(de / 2); - } else { - let S = !1; - me > Number.EPSILON ? Ne > Number.EPSILON && (S = !0) : me < -Number.EPSILON ? Ne < -Number.EPSILON && (S = !0) : Math.sign(ye) === Math.sign(qe) && (S = !0), S ? (ie = -ye, J = me, Se = Math.sqrt(rt)) : (ie = me, J = ye, Se = Math.sqrt(rt / 2)); - } - return new Z(ie / Se, J / Se); - } - let W = []; - for(let L = 0, oe = U.length, X = oe - 1, ie = L + 1; L < oe; L++, X++, ie++)X === oe && (X = 0), ie === oe && (ie = 0), W[L] = ne(U[L], U[X], U[ie]); - let K = [], D, G = W.concat(); - for(let L = 0, oe = O.length; L < oe; L++){ - let X = O[L]; - D = []; - for(let ie = 0, J = X.length, Se = J - 1, me = ie + 1; ie < J; ie++, Se++, me++)Se === J && (Se = 0), me === J && (me = 0), D[ie] = ne(X[ie], X[Se], X[me]); - K.push(D), G = G.concat(D); - } - for(let L = 0; L < g; L++){ - let oe = L / g, X = f * Math.cos(oe * Math.PI / 2), ie = m * Math.sin(oe * Math.PI / 2) + _; - for(let J = 0, Se = U.length; J < Se; J++){ - let me = z(U[J], W[J], ie); - Ee(me.x, me.y, -X); - } - for(let J = 0, Se = O.length; J < Se; J++){ - let me = O[J]; - D = K[J]; - for(let ye = 0, Ne = me.length; ye < Ne; ye++){ - let qe = z(me[ye], D[ye], ie); - Ee(qe.x, qe.y, -X); - } - } - } - let he = m + _; - for(let L = 0; L < q; L++){ - let oe = d ? z(T[L], G[L], he) : T[L]; - y1 ? (R.copy(b.normals[0]).multiplyScalar(oe.x), w.copy(b.binormals[0]).multiplyScalar(oe.y), I.copy(x1[0]).add(R).add(w), Ee(I.x, I.y, I.z)) : Ee(oe.x, oe.y, 0); - } - for(let L = 1; L <= h; L++)for(let oe = 0; oe < q; oe++){ - let X = d ? z(T[oe], G[oe], he) : T[oe]; - y1 ? (R.copy(b.normals[L]).multiplyScalar(X.x), w.copy(b.binormals[L]).multiplyScalar(X.y), I.copy(x1[L]).add(R).add(w), Ee(I.x, I.y, I.z)) : Ee(X.x, X.y, u / h * L); - } - for(let L = g - 1; L >= 0; L--){ - let oe = L / g, X = f * Math.cos(oe * Math.PI / 2), ie = m * Math.sin(oe * Math.PI / 2) + _; - for(let J = 0, Se = U.length; J < Se; J++){ - let me = z(U[J], W[J], ie); - Ee(me.x, me.y, u + X); - } - for(let J = 0, Se = O.length; J < Se; J++){ - let me = O[J]; - D = K[J]; - for(let ye = 0, Ne = me.length; ye < Ne; ye++){ - let qe = z(me[ye], D[ye], ie); - y1 ? Ee(qe.x, qe.y + x1[h - 1].y, x1[h - 1].x + X) : Ee(qe.x, qe.y, u + X); - } - } - } - fe(), _e(); - function fe() { - let L = i.length / 3; - if (d) { - let oe = 0, X = q * oe; - for(let ie = 0; ie < H; ie++){ - let J = $[ie]; - Te(J[2] + X, J[1] + X, J[0] + X); - } - oe = h + g * 2, X = q * oe; - for(let ie = 0; ie < H; ie++){ - let J = $[ie]; - Te(J[0] + X, J[1] + X, J[2] + X); - } - } else { - for(let oe = 0; oe < H; oe++){ - let X = $[oe]; - Te(X[2], X[1], X[0]); - } - for(let oe = 0; oe < H; oe++){ - let X = $[oe]; - Te(X[0] + q * h, X[1] + q * h, X[2] + q * h); - } - } - n.addGroup(L, i.length / 3 - L, 0); - } - function _e() { - let L = i.length / 3, oe = 0; - we(U, oe), oe += U.length; - for(let X = 0, ie = O.length; X < ie; X++){ - let J = O[X]; - we(J, oe), oe += J.length; - } - n.addGroup(L, i.length / 3 - L, 1); - } - function we(L, oe) { - let X = L.length; - for(; --X >= 0;){ - let ie = X, J = X - 1; - J < 0 && (J = L.length - 1); - for(let Se = 0, me = h + g * 2; Se < me; Se++){ - let ye = q * Se, Ne = q * (Se + 1), qe = oe + ie + ye, rt = oe + J + ye, C = oe + J + Ne, S = oe + ie + Ne; - Ye(qe, rt, C, S); - } - } - } - function Ee(L, oe, X) { - c.push(L), c.push(oe), c.push(X); - } - function Te(L, oe, X) { - it(L), it(oe), it(X); - let ie = i.length / 3, J = v.generateTopUV(n, i, ie - 3, ie - 2, ie - 1); - Ce(J[0]), Ce(J[1]), Ce(J[2]); - } - function Ye(L, oe, X, ie) { - it(L), it(oe), it(ie), it(oe), it(X), it(ie); - let J = i.length / 3, Se = v.generateSideWallUV(n, i, J - 6, J - 3, J - 2, J - 1); - Ce(Se[0]), Ce(Se[1]), Ce(Se[3]), Ce(Se[1]), Ce(Se[2]), Ce(Se[3]); - } - function it(L) { - i.push(c[L * 3 + 0]), i.push(c[L * 3 + 1]), i.push(c[L * 3 + 2]); - } - function Ce(L) { - r.push(L.x), r.push(L.y); - } - } - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - toJSON() { - let e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options; - return xx(t, n, e); - } - static fromJSON(e, t) { - let n = []; - for(let r = 0, a = e.shapes.length; r < a; r++){ - let o = t[e.shapes[r]]; - n.push(o); - } - let i = e.options.extrudePath; - return i !== void 0 && (e.options.extrudePath = new ca[i.type]().fromJSON(i)), new s1(n, e.options); - } -}, _x = { - generateTopUV: function(s1, e, t, n, i) { - let r = e[t * 3], a = e[t * 3 + 1], o = e[n * 3], c = e[n * 3 + 1], l = e[i * 3], h = e[i * 3 + 1]; - return [ - new Z(r, a), - new Z(o, c), - new Z(l, h) - ]; - }, - generateSideWallUV: function(s1, e, t, n, i, r) { - let a = e[t * 3], o = e[t * 3 + 1], c = e[t * 3 + 2], l = e[n * 3], h = e[n * 3 + 1], u = e[n * 3 + 2], d = e[i * 3], f = e[i * 3 + 1], m = e[i * 3 + 2], _ = e[r * 3], g = e[r * 3 + 1], p = e[r * 3 + 2]; - return Math.abs(o - h) < Math.abs(a - l) ? [ - new Z(a, 1 - c), - new Z(l, 1 - u), - new Z(d, 1 - m), - new Z(_, 1 - p) - ] : [ - new Z(o, 1 - c), - new Z(h, 1 - u), - new Z(f, 1 - m), - new Z(g, 1 - p) - ]; - } -}; -function xx(s1, e, t) { - if (t.shapes = [], Array.isArray(s1)) for(let n = 0, i = s1.length; n < i; n++){ - let r = s1[n]; - t.shapes.push(r.uuid); - } - else t.shapes.push(s1.uuid); - return t.options = Object.assign({}, e), e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t; +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } -var ec = class s1 extends di { - constructor(e = 1, t = 0){ - let n = (1 + Math.sqrt(5)) / 2, i = [ - -1, - n, - 0, - 1, - n, - 0, - -1, - -n, - 0, - 1, - -n, - 0, - 0, - -1, - n, - 0, - 1, - n, - 0, - -1, - -n, - 0, - 1, - -n, - n, - 0, - -1, - n, - 0, - 1, - -n, - 0, - -1, - -n, - 0, - 1 - ], r = [ - 0, - 11, - 5, - 0, - 5, - 1, - 0, - 1, - 7, - 0, - 7, - 10, - 0, - 10, - 11, - 1, - 5, - 9, - 5, - 11, - 4, - 11, - 10, - 2, - 10, - 7, - 6, - 7, - 1, - 8, - 3, - 9, - 4, - 3, - 4, - 2, - 3, - 2, - 6, - 3, - 6, - 8, - 3, - 8, - 9, - 4, - 9, - 5, - 2, - 4, - 11, - 6, - 2, - 10, - 8, - 6, - 7, - 9, - 8, - 1 - ]; - super(i, r, e, t), this.type = "IcosahedronGeometry", this.parameters = { - radius: e, - detail: t - }; - } - static fromJSON(e) { - return new s1(e.radius, e.detail); - } -}, ha = class s1 extends di { - constructor(e = 1, t = 0){ - let n = [ - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1 - ], i = [ - 0, - 2, - 4, - 0, - 4, - 3, - 0, - 3, - 5, - 0, - 5, - 2, - 1, - 2, - 5, - 1, - 5, - 3, - 1, - 3, - 4, - 1, - 4, - 2 - ]; - super(n, i, e, t), this.type = "OctahedronGeometry", this.parameters = { - radius: e, - detail: t - }; - } - static fromJSON(e) { - return new s1(e.radius, e.detail); - } -}, tc = class s1 extends Ge { - constructor(e = .5, t = 1, n = 32, i = 1, r = 0, a = Math.PI * 2){ - super(), this.type = "RingGeometry", this.parameters = { - innerRadius: e, - outerRadius: t, - thetaSegments: n, - phiSegments: i, - thetaStart: r, - thetaLength: a - }, n = Math.max(3, n), i = Math.max(1, i); - let o = [], c = [], l = [], h = [], u = e, d = (t - e) / i, f = new A, m = new Z; - for(let _ = 0; _ <= i; _++){ - for(let g = 0; g <= n; g++){ - let p = r + g / n * a; - f.x = u * Math.cos(p), f.y = u * Math.sin(p), c.push(f.x, f.y, f.z), l.push(0, 0, 1), m.x = (f.x / t + 1) / 2, m.y = (f.y / t + 1) / 2, h.push(m.x, m.y); - } - u += d; - } - for(let _ = 0; _ < i; _++){ - let g = _ * (n + 1); - for(let p = 0; p < n; p++){ - let v = p + g, x1 = v, y1 = v + n + 1, b = v + n + 2, w = v + 1; - o.push(x1, y1, w), o.push(y1, b, w); - } - } - this.setIndex(o), this.setAttribute("position", new ve(c, 3)), this.setAttribute("normal", new ve(l, 3)), this.setAttribute("uv", new ve(h, 2)); - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - static fromJSON(e) { - return new s1(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength); - } -}, nc = class s1 extends Ge { - constructor(e = new Fn([ - new Z(0, .5), - new Z(-.5, -.5), - new Z(.5, -.5) - ]), t = 12){ - super(), this.type = "ShapeGeometry", this.parameters = { - shapes: e, - curveSegments: t - }; - let n = [], i = [], r = [], a = [], o = 0, c = 0; - if (Array.isArray(e) === !1) l(e); - else for(let h = 0; h < e.length; h++)l(e[h]), this.addGroup(o, c, h), o += c, c = 0; - this.setIndex(n), this.setAttribute("position", new ve(i, 3)), this.setAttribute("normal", new ve(r, 3)), this.setAttribute("uv", new ve(a, 2)); - function l(h) { - let u = i.length / 3, d = h.extractPoints(t), f = d.shape, m = d.holes; - yn.isClockWise(f) === !1 && (f = f.reverse()); - for(let g = 0, p = m.length; g < p; g++){ - let v = m[g]; - yn.isClockWise(v) === !0 && (m[g] = v.reverse()); - } - let _ = yn.triangulateShape(f, m); - for(let g = 0, p = m.length; g < p; g++){ - let v = m[g]; - f = f.concat(v); - } - for(let g = 0, p = f.length; g < p; g++){ - let v = f[g]; - i.push(v.x, v.y, 0), r.push(0, 0, 1), a.push(v.x, v.y); - } - for(let g = 0, p = _.length; g < p; g++){ - let v = _[g], x1 = v[0] + u, y1 = v[1] + u, b = v[2] + u; - n.push(x1, y1, b), c += 3; - } - } - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - toJSON() { - let e = super.toJSON(), t = this.parameters.shapes; - return vx(t, e); - } - static fromJSON(e, t) { - let n = []; - for(let i = 0, r = e.shapes.length; i < r; i++){ - let a = t[e.shapes[i]]; - n.push(a); - } - return new s1(n, e.curveSegments); - } -}; -function vx(s1, e) { - if (e.shapes = [], Array.isArray(s1)) for(let t = 0, n = s1.length; t < n; t++){ - let i = s1[t]; - e.shapes.push(i.uuid); - } - else e.shapes.push(s1.uuid); - return e; +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`, us1 = ` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`, ps1 = `#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`, hs1 = `#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`, ms1 = `#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`, _s1 = `#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`, vs1 = `#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`, gs1 = `#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`, Ss1 = `#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`, Es1 = `#ifdef USE_MAP + uniform sampler2D map; +#endif`, Ms1 = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`, Ts1 = `#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`, xs1 = `float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`, As1 = `#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`, Rs1 = `#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`, Cs1 = `#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`, bs1 = `#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`, Ps1 = `#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`, Ls1 = `#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`, Us1 = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`, Ds1 = `#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`, ws1 = `#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`, Is1 = `#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`, ys1 = `#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`, Ns1 = `#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`, Os1 = `#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`, Fs1 = `#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`, Bs1 = `#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`, Gs1 = `#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`, Hs1 = `#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`, Vs1 = `vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`, ks1 = `#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`, zs1 = `vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`, Ws1 = `#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`, Xs1 = `#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`, Ys1 = `float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`, qs1 = `#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`, Ks1 = `#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + 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 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`, $s1 = `#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`, Zs1 = `#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`, Qs1 = `float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`, Js1 = `#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`, js1 = `#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`, ec1 = `#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`, tc1 = `#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`, nc1 = `float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`, ic1 = `#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`, rc1 = `#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`, ac1 = `#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); } -var ua = class s1 extends Ge { - constructor(e = 1, t = 32, n = 16, i = 0, r = Math.PI * 2, a = 0, o = Math.PI){ - super(), this.type = "SphereGeometry", this.parameters = { - radius: e, - widthSegments: t, - heightSegments: n, - phiStart: i, - phiLength: r, - thetaStart: a, - thetaLength: o - }, t = Math.max(3, Math.floor(t)), n = Math.max(2, Math.floor(n)); - let c = Math.min(a + o, Math.PI), l = 0, h = [], u = new A, d = new A, f = [], m = [], _ = [], g = []; - for(let p = 0; p <= n; p++){ - let v = [], x1 = p / n, y1 = 0; - p === 0 && a === 0 ? y1 = .5 / t : p === n && c === Math.PI && (y1 = -.5 / t); - for(let b = 0; b <= t; b++){ - let w = b / t; - u.x = -e * Math.cos(i + w * r) * Math.sin(a + x1 * o), u.y = e * Math.cos(a + x1 * o), u.z = e * Math.sin(i + w * r) * Math.sin(a + x1 * o), m.push(u.x, u.y, u.z), d.copy(u).normalize(), _.push(d.x, d.y, d.z), g.push(w + y1, 1 - x1), v.push(l++); - } - h.push(v); - } - for(let p = 0; p < n; p++)for(let v = 0; v < t; v++){ - let x1 = h[p][v + 1], y1 = h[p][v], b = h[p + 1][v], w = h[p + 1][v + 1]; - (p !== 0 || a > 0) && f.push(x1, y1, w), (p !== n - 1 || c < Math.PI) && f.push(y1, b, w); - } - this.setIndex(f), this.setAttribute("position", new ve(m, 3)), this.setAttribute("normal", new ve(_, 3)), this.setAttribute("uv", new ve(g, 2)); - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - static fromJSON(e) { - return new s1(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength); - } -}, ic = class s1 extends di { - constructor(e = 1, t = 0){ - let n = [ - 1, - 1, - 1, - -1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - -1 - ], i = [ - 2, - 1, - 0, - 0, - 3, - 2, - 1, - 3, - 0, - 2, - 3, - 1 - ]; - super(n, i, e, t), this.type = "TetrahedronGeometry", this.parameters = { - radius: e, - detail: t - }; - } - static fromJSON(e) { - return new s1(e.radius, e.detail); - } -}, sc = class s1 extends Ge { - constructor(e = 1, t = .4, n = 12, i = 48, r = Math.PI * 2){ - super(), this.type = "TorusGeometry", this.parameters = { - radius: e, - tube: t, - radialSegments: n, - tubularSegments: i, - arc: r - }, n = Math.floor(n), i = Math.floor(i); - let a = [], o = [], c = [], l = [], h = new A, u = new A, d = new A; - for(let f = 0; f <= n; f++)for(let m = 0; m <= i; m++){ - let _ = m / i * r, g = f / n * Math.PI * 2; - u.x = (e + t * Math.cos(g)) * Math.cos(_), u.y = (e + t * Math.cos(g)) * Math.sin(_), u.z = t * Math.sin(g), o.push(u.x, u.y, u.z), h.x = e * Math.cos(_), h.y = e * Math.sin(_), d.subVectors(u, h).normalize(), c.push(d.x, d.y, d.z), l.push(m / i), l.push(f / n); - } - for(let f = 1; f <= n; f++)for(let m = 1; m <= i; m++){ - let _ = (i + 1) * f + m - 1, g = (i + 1) * (f - 1) + m - 1, p = (i + 1) * (f - 1) + m, v = (i + 1) * f + m; - a.push(_, g, v), a.push(g, p, v); - } - this.setIndex(a), this.setAttribute("position", new ve(o, 3)), this.setAttribute("normal", new ve(c, 3)), this.setAttribute("uv", new ve(l, 2)); - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - static fromJSON(e) { - return new s1(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc); - } -}, rc = class s1 extends Ge { - constructor(e = 1, t = .4, n = 64, i = 8, r = 2, a = 3){ - super(), this.type = "TorusKnotGeometry", this.parameters = { - radius: e, - tube: t, - tubularSegments: n, - radialSegments: i, - p: r, - q: a - }, n = Math.floor(n), i = Math.floor(i); - let o = [], c = [], l = [], h = [], u = new A, d = new A, f = new A, m = new A, _ = new A, g = new A, p = new A; - for(let x1 = 0; x1 <= n; ++x1){ - let y1 = x1 / n * r * Math.PI * 2; - v(y1, r, a, e, f), v(y1 + .01, r, a, e, m), g.subVectors(m, f), p.addVectors(m, f), _.crossVectors(g, p), p.crossVectors(_, g), _.normalize(), p.normalize(); - for(let b = 0; b <= i; ++b){ - let w = b / i * Math.PI * 2, R = -t * Math.cos(w), I = t * Math.sin(w); - u.x = f.x + (R * p.x + I * _.x), u.y = f.y + (R * p.y + I * _.y), u.z = f.z + (R * p.z + I * _.z), c.push(u.x, u.y, u.z), d.subVectors(u, f).normalize(), l.push(d.x, d.y, d.z), h.push(x1 / n), h.push(b / i); - } - } - for(let x1 = 1; x1 <= n; x1++)for(let y1 = 1; y1 <= i; y1++){ - let b = (i + 1) * (x1 - 1) + (y1 - 1), w = (i + 1) * x1 + (y1 - 1), R = (i + 1) * x1 + y1, I = (i + 1) * (x1 - 1) + y1; - o.push(b, w, I), o.push(w, R, I); - } - this.setIndex(o), this.setAttribute("position", new ve(c, 3)), this.setAttribute("normal", new ve(l, 3)), this.setAttribute("uv", new ve(h, 2)); - function v(x1, y1, b, w, R) { - let I = Math.cos(x1), M = Math.sin(x1), T = b / y1 * x1, O = Math.cos(T); - R.x = w * (2 + O) * .5 * I, R.y = w * (2 + O) * M * .5, R.z = w * Math.sin(T) * .5; - } - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - static fromJSON(e) { - return new s1(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q); - } -}, ac = class s1 extends Ge { - constructor(e = new aa(new A(-1, -1, 0), new A(-1, 1, 0), new A(1, 1, 0)), t = 64, n = 1, i = 8, r = !1){ - super(), this.type = "TubeGeometry", this.parameters = { - path: e, - tubularSegments: t, - radius: n, - radialSegments: i, - closed: r - }; - let a = e.computeFrenetFrames(t, r); - this.tangents = a.tangents, this.normals = a.normals, this.binormals = a.binormals; - let o = new A, c = new A, l = new Z, h = new A, u = [], d = [], f = [], m = []; - _(), this.setIndex(m), this.setAttribute("position", new ve(u, 3)), this.setAttribute("normal", new ve(d, 3)), this.setAttribute("uv", new ve(f, 2)); - function _() { - for(let x1 = 0; x1 < t; x1++)g(x1); - g(r === !1 ? t : 0), v(), p(); - } - function g(x1) { - h = e.getPointAt(x1 / t, h); - let y1 = a.normals[x1], b = a.binormals[x1]; - for(let w = 0; w <= i; w++){ - let R = w / i * Math.PI * 2, I = Math.sin(R), M = -Math.cos(R); - c.x = M * y1.x + I * b.x, c.y = M * y1.y + I * b.y, c.z = M * y1.z + I * b.z, c.normalize(), d.push(c.x, c.y, c.z), o.x = h.x + n * c.x, o.y = h.y + n * c.y, o.z = h.z + n * c.z, u.push(o.x, o.y, o.z); - } - } - function p() { - for(let x1 = 1; x1 <= t; x1++)for(let y1 = 1; y1 <= i; y1++){ - let b = (i + 1) * (x1 - 1) + (y1 - 1), w = (i + 1) * x1 + (y1 - 1), R = (i + 1) * x1 + y1, I = (i + 1) * (x1 - 1) + y1; - m.push(b, w, I), m.push(w, R, I); - } - } - function v() { - for(let x1 = 0; x1 <= t; x1++)for(let y1 = 0; y1 <= i; y1++)l.x = x1 / t, l.y = y1 / i, f.push(l.x, l.y); - } - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } - toJSON() { - let e = super.toJSON(); - return e.path = this.parameters.path.toJSON(), e; - } - static fromJSON(e) { - return new s1(new ca[e.path.type]().fromJSON(e.path), e.tubularSegments, e.radius, e.radialSegments, e.closed); - } -}, oc = class extends Ge { - constructor(e = null){ - if (super(), this.type = "WireframeGeometry", this.parameters = { - geometry: e - }, e !== null) { - let t = [], n = new Set, i = new A, r = new A; - if (e.index !== null) { - let a = e.attributes.position, o = e.index, c = e.groups; - c.length === 0 && (c = [ - { - start: 0, - count: o.count, - materialIndex: 0 - } - ]); - for(let l = 0, h = c.length; l < h; ++l){ - let u = c[l], d = u.start, f = u.count; - for(let m = d, _ = d + f; m < _; m += 3)for(let g = 0; g < 3; g++){ - let p = o.getX(m + g), v = o.getX(m + (g + 1) % 3); - i.fromBufferAttribute(a, p), r.fromBufferAttribute(a, v), su(i, r, n) === !0 && (t.push(i.x, i.y, i.z), t.push(r.x, r.y, r.z)); - } - } - } else { - let a = e.attributes.position; - for(let o = 0, c = a.count / 3; o < c; o++)for(let l = 0; l < 3; l++){ - let h = 3 * o + l, u = 3 * o + (l + 1) % 3; - i.fromBufferAttribute(a, h), r.fromBufferAttribute(a, u), su(i, r, n) === !0 && (t.push(i.x, i.y, i.z), t.push(r.x, r.y, r.z)); - } - } - this.setAttribute("position", new ve(t, 3)); +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`, oc1 = `#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`, sc1 = `#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`, cc1 = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`, lc1 = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`, fc1 = `#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`, dc1 = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`, uc1 = `varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`, pc1 = `uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + 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 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`, hc1 = `varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`, mc1 = `#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`, _c1 = `varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`, vc1 = `uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`, gc1 = `#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`, Sc1 = `#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`, Ec1 = `#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`, Mc1 = `#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`, Tc1 = `varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`, xc1 = `uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`, Ac1 = `uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`, Rc1 = `uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`, Cc1 = `#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`, bc1 = `uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`, Pc1 = `#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`, Lc1 = `#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`, Uc1 = `#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`, Dc1 = `#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`, wc1 = `#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`, Ic1 = `#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`, yc1 = `#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`, Nc1 = `#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`, Oc1 = `#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`, Fc1 = `#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`, Bc1 = `#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`, Gc1 = `#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`, Hc1 = `uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`, Vc1 = `uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`, kc1 = `#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`, zc1 = `uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`, Wc1 = `uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`, Xc1 = `uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`, Pe1 = { + alphahash_fragment: po1, + alphahash_pars_fragment: ho1, + alphamap_fragment: mo1, + alphamap_pars_fragment: _o1, + alphatest_fragment: vo1, + alphatest_pars_fragment: go1, + aomap_fragment: So1, + aomap_pars_fragment: Eo1, + batching_pars_vertex: Mo1, + batching_vertex: To1, + begin_vertex: xo1, + beginnormal_vertex: Ao1, + bsdfs: Ro1, + iridescence_fragment: Co1, + bumpmap_pars_fragment: bo1, + clipping_planes_fragment: Po1, + clipping_planes_pars_fragment: Lo1, + clipping_planes_pars_vertex: Uo1, + clipping_planes_vertex: Do1, + color_fragment: wo1, + color_pars_fragment: Io1, + color_pars_vertex: yo1, + color_vertex: No1, + common: Oo1, + cube_uv_reflection_fragment: Fo1, + defaultnormal_vertex: Bo1, + displacementmap_pars_vertex: Go1, + displacementmap_vertex: Ho1, + emissivemap_fragment: Vo1, + emissivemap_pars_fragment: ko1, + colorspace_fragment: zo1, + colorspace_pars_fragment: Wo1, + envmap_fragment: Xo1, + envmap_common_pars_fragment: Yo, + envmap_pars_fragment: qo1, + envmap_pars_vertex: Ko, + envmap_physical_pars_fragment: as1, + envmap_vertex: $o, + fog_vertex: Zo1, + fog_pars_vertex: Qo, + fog_fragment: Jo1, + fog_pars_fragment: jo, + gradientmap_pars_fragment: es, + lightmap_pars_fragment: ts1, + lights_lambert_fragment: ns1, + lights_lambert_pars_fragment: is, + lights_pars_begin: rs1, + lights_toon_fragment: os1, + lights_toon_pars_fragment: ss1, + lights_phong_fragment: cs1, + lights_phong_pars_fragment: ls1, + lights_physical_fragment: fs1, + lights_physical_pars_fragment: ds1, + lights_fragment_begin: us1, + lights_fragment_maps: ps1, + lights_fragment_end: hs1, + logdepthbuf_fragment: ms1, + logdepthbuf_pars_fragment: _s1, + logdepthbuf_pars_vertex: vs1, + logdepthbuf_vertex: gs1, + map_fragment: Ss1, + map_pars_fragment: Es1, + map_particle_fragment: Ms1, + map_particle_pars_fragment: Ts1, + metalnessmap_fragment: xs1, + metalnessmap_pars_fragment: As1, + morphinstance_vertex: Rs1, + morphcolor_vertex: Cs1, + morphnormal_vertex: bs1, + morphtarget_pars_vertex: Ps1, + morphtarget_vertex: Ls1, + normal_fragment_begin: Us1, + normal_fragment_maps: Ds1, + normal_pars_fragment: ws1, + normal_pars_vertex: Is1, + normal_vertex: ys1, + normalmap_pars_fragment: Ns1, + clearcoat_normal_fragment_begin: Os1, + clearcoat_normal_fragment_maps: Fs1, + clearcoat_pars_fragment: Bs1, + iridescence_pars_fragment: Gs1, + opaque_fragment: Hs1, + packing: Vs1, + premultiplied_alpha_fragment: ks1, + project_vertex: zs1, + dithering_fragment: Ws1, + dithering_pars_fragment: Xs1, + roughnessmap_fragment: Ys1, + roughnessmap_pars_fragment: qs1, + shadowmap_pars_fragment: Ks1, + shadowmap_pars_vertex: $s1, + shadowmap_vertex: Zs1, + shadowmask_pars_fragment: Qs1, + skinbase_vertex: Js1, + skinning_pars_vertex: js1, + skinning_vertex: ec1, + skinnormal_vertex: tc1, + specularmap_fragment: nc1, + specularmap_pars_fragment: ic1, + tonemapping_fragment: rc1, + tonemapping_pars_fragment: ac1, + transmission_fragment: oc1, + transmission_pars_fragment: sc1, + uv_pars_fragment: cc1, + uv_pars_vertex: lc1, + uv_vertex: fc1, + worldpos_vertex: dc1, + background_vert: uc1, + background_frag: pc1, + backgroundCube_vert: hc1, + backgroundCube_frag: mc1, + cube_vert: _c1, + cube_frag: vc1, + depth_vert: gc1, + depth_frag: Sc1, + distanceRGBA_vert: Ec1, + distanceRGBA_frag: Mc1, + equirect_vert: Tc1, + equirect_frag: xc1, + linedashed_vert: Ac1, + linedashed_frag: Rc1, + meshbasic_vert: Cc1, + meshbasic_frag: bc1, + meshlambert_vert: Pc1, + meshlambert_frag: Lc1, + meshmatcap_vert: Uc1, + meshmatcap_frag: Dc1, + meshnormal_vert: wc1, + meshnormal_frag: Ic1, + meshphong_vert: yc1, + meshphong_frag: Nc1, + meshphysical_vert: Oc1, + meshphysical_frag: Fc1, + meshtoon_vert: Bc1, + meshtoon_frag: Gc1, + points_vert: Hc1, + points_frag: Vc1, + shadow_vert: kc1, + shadow_frag: zc1, + sprite_vert: Wc1, + sprite_frag: Xc1 +}, ee1 = { + common: { + diffuse: { + value: new P(16777215) + }, + opacity: { + value: 1 + }, + map: { + value: null + }, + mapTransform: { + value: new Gt + }, + alphaMap: { + value: null + }, + alphaMapTransform: { + value: new Gt + }, + alphaTest: { + value: 0 } - } - copy(e) { - return super.copy(e), this.parameters = Object.assign({}, e.parameters), this; - } -}; -function su(s1, e, t) { - let n = `${s1.x},${s1.y},${s1.z}-${e.x},${e.y},${e.z}`, i = `${e.x},${e.y},${e.z}-${s1.x},${s1.y},${s1.z}`; - return t.has(n) === !0 || t.has(i) === !0 ? !1 : (t.add(n), t.add(i), !0); -} -var ru = Object.freeze({ - __proto__: null, - BoxGeometry: Ji, - CapsuleGeometry: qo, - CircleGeometry: Yo, - ConeGeometry: Zo, - CylinderGeometry: Ns, - DodecahedronGeometry: Jo, - EdgesGeometry: $o, - ExtrudeGeometry: jo, - IcosahedronGeometry: ec, - LatheGeometry: la, - OctahedronGeometry: ha, - PlaneGeometry: $r, - PolyhedronGeometry: di, - RingGeometry: tc, - ShapeGeometry: nc, - SphereGeometry: ua, - TetrahedronGeometry: ic, - TorusGeometry: sc, - TorusKnotGeometry: rc, - TubeGeometry: ac, - WireframeGeometry: oc -}), cc = class extends bt { - constructor(e){ - super(), this.isShadowMaterial = !0, this.type = "ShadowMaterial", this.color = new pe(0), this.transparent = !0, this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.color.copy(e.color), this.fog = e.fog, this; - } -}, lc = class extends jt { - constructor(e){ - super(e), this.isRawShaderMaterial = !0, this.type = "RawShaderMaterial"; - } -}, da = class extends bt { - constructor(e){ - super(), this.isMeshStandardMaterial = !0, this.defines = { - STANDARD: "" - }, this.type = "MeshStandardMaterial", this.color = new pe(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 pe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(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; - } -}, hc = class extends da { - constructor(e){ - super(), this.isMeshPhysicalMaterial = !0, this.defines = { - STANDARD: "", - PHYSICAL: "" - }, this.type = "MeshPhysicalMaterial", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Z(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, "reflectivity", { - get: function() { - return ct(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 pe(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 pe(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new pe(1, 1, 1), this.specularColorMap = null, this._anisotropy = 0, this._clearcoat = 0, this._iridescence = 0, this._sheen = 0, this._transmission = 0, this.setValues(e); - } - get anisotropy() { - return this._anisotropy; - } - set anisotropy(e) { - this._anisotropy > 0 != e > 0 && this.version++, this._anisotropy = e; - } - get clearcoat() { - return this._clearcoat; - } - set clearcoat(e) { - this._clearcoat > 0 != e > 0 && this.version++, this._clearcoat = e; - } - get iridescence() { - return this._iridescence; - } - set iridescence(e) { - this._iridescence > 0 != e > 0 && this.version++, this._iridescence = e; - } - get sheen() { - return this._sheen; - } - set sheen(e) { - this._sheen > 0 != e > 0 && this.version++, this._sheen = e; - } - get transmission() { - return this._transmission; - } - set transmission(e) { - this._transmission > 0 != e > 0 && this.version++, this._transmission = e; - } - copy(e) { - return super.copy(e), this.defines = { - STANDARD: "", - PHYSICAL: "" - }, this.anisotropy = e.anisotropy, this.anisotropyRotation = e.anisotropyRotation, this.anisotropyMap = e.anisotropyMap, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.ior = e.ior, this.iridescence = e.iridescence, this.iridescenceMap = e.iridescenceMap, this.iridescenceIOR = e.iridescenceIOR, this.iridescenceThicknessRange = [ - ...e.iridescenceThicknessRange - ], this.iridescenceThicknessMap = e.iridescenceThicknessMap, this.sheen = e.sheen, this.sheenColor.copy(e.sheenColor), this.sheenColorMap = e.sheenColorMap, this.sheenRoughness = e.sheenRoughness, this.sheenRoughnessMap = e.sheenRoughnessMap, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this.specularIntensity = e.specularIntensity, this.specularIntensityMap = e.specularIntensityMap, this.specularColor.copy(e.specularColor), this.specularColorMap = e.specularColorMap, this; - } -}, uc = class extends bt { - constructor(e){ - super(), this.isMeshPhongMaterial = !0, this.type = "MeshPhongMaterial", this.color = new pe(16777215), this.specular = new pe(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new pe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = xa, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this; - } -}, dc = class extends bt { - constructor(e){ - super(), this.isMeshToonMaterial = !0, this.defines = { - TOON: "" - }, this.type = "MeshToonMaterial", this.color = new pe(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new pe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.color.copy(e.color), this.map = e.map, this.gradientMap = e.gradientMap, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this; - } -}, fc = class extends bt { - constructor(e){ - super(), this.isMeshNormalMaterial = !0, this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.flatShading = !1, this.setValues(e); - } - copy(e) { - return super.copy(e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.flatShading = e.flatShading, this; - } -}, pc = class extends bt { - constructor(e){ - super(), this.isMeshLambertMaterial = !0, this.type = "MeshLambertMaterial", this.color = new pe(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new pe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = xa, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this; - } -}, mc = class extends bt { - constructor(e){ - super(), this.isMeshMatcapMaterial = !0, this.defines = { - MATCAP: "" - }, this.type = "MeshMatcapMaterial", this.color = new pe(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = mi, this.normalScale = new Z(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.flatShading = !1, this.fog = !0, this.setValues(e); - } - copy(e) { - return super.copy(e), this.defines = { - MATCAP: "" - }, this.color.copy(e.color), this.matcap = e.matcap, this.map = e.map, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.flatShading = e.flatShading, this.fog = e.fog, this; - } -}, gc = class extends wt { - constructor(e){ - super(), this.isLineDashedMaterial = !0, this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(e); - } - copy(e) { - return super.copy(e), this.scale = e.scale, this.dashSize = e.dashSize, this.gapSize = e.gapSize, this; - } -}; -function ni(s1, e, t) { - return !s1 || !t && s1.constructor === e ? s1 : typeof e.BYTES_PER_ELEMENT == "number" ? new e(s1) : Array.prototype.slice.call(s1); -} -function Ud(s1) { - return ArrayBuffer.isView(s1) && !(s1 instanceof DataView); -} -function Dd(s1) { - function e(i, r) { - return s1[i] - s1[r]; - } - let t = s1.length, n = new Array(t); - for(let i = 0; i !== t; ++i)n[i] = i; - return n.sort(e), n; -} -function _c(s1, e, t) { - let n = s1.length, i = new s1.constructor(n); - for(let r = 0, a = 0; a !== n; ++r){ - let o = t[r] * e; - for(let c = 0; c !== e; ++c)i[a++] = s1[o + c]; - } - return i; -} -function $c(s1, e, t, n) { - let i = 1, r = s1[0]; - for(; r !== void 0 && r[n] === void 0;)r = s1[i++]; - if (r === void 0) return; - let a = r[n]; - if (a !== void 0) if (Array.isArray(a)) do a = r[n], a !== void 0 && (e.push(r.time), t.push.apply(t, a)), r = s1[i++]; - while (r !== void 0) - else if (a.toArray !== void 0) do a = r[n], a !== void 0 && (e.push(r.time), a.toArray(t, t.length)), r = s1[i++]; - while (r !== void 0) - else do a = r[n], a !== void 0 && (e.push(r.time), t.push(a)), r = s1[i++]; - while (r !== void 0) -} -function yx(s1, e, t, n, i = 30) { - let r = s1.clone(); - r.name = e; - let a = []; - for(let c = 0; c < r.tracks.length; ++c){ - let l = r.tracks[c], h = l.getValueSize(), u = [], d = []; - for(let f = 0; f < l.times.length; ++f){ - let m = l.times[f] * i; - if (!(m < t || m >= n)) { - u.push(l.times[f]); - for(let _ = 0; _ < h; ++_)d.push(l.values[f * h + _]); - } - } - u.length !== 0 && (l.times = ni(u, l.times.constructor), l.values = ni(d, l.values.constructor), a.push(l)); - } - r.tracks = a; - let o = 1 / 0; - for(let c = 0; c < r.tracks.length; ++c)o > r.tracks[c].times[0] && (o = r.tracks[c].times[0]); - for(let c = 0; c < r.tracks.length; ++c)r.tracks[c].shift(-1 * o); - return r.resetDuration(), r; -} -function Mx(s1, e = 0, t = s1, n = 30) { - n <= 0 && (n = 30); - let i = t.tracks.length, r = e / n; - for(let a = 0; a < i; ++a){ - let o = t.tracks[a], c = o.ValueTypeName; - if (c === "bool" || c === "string") continue; - let l = s1.tracks.find(function(p) { - return p.name === o.name && p.ValueTypeName === c; - }); - if (l === void 0) continue; - let h = 0, u = o.getValueSize(); - o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (h = u / 3); - let d = 0, f = l.getValueSize(); - l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = f / 3); - let m = o.times.length - 1, _; - if (r <= o.times[0]) { - let p = h, v = u - h; - _ = o.values.slice(p, v); - } else if (r >= o.times[m]) { - let p = m * u + h, v = p + u - h; - _ = o.values.slice(p, v); - } else { - let p = o.createInterpolant(), v = h, x1 = u - h; - p.evaluate(r), _ = p.resultBuffer.slice(v, x1); - } - c === "quaternion" && new Ut().fromArray(_).normalize().conjugate().toArray(_); - let g = l.times.length; - for(let p = 0; p < g; ++p){ - let v = p * f + d; - if (c === "quaternion") Ut.multiplyQuaternionsFlat(l.values, v, _, 0, l.values, v); - else { - let x1 = f - d * 2; - for(let y1 = 0; y1 < x1; ++y1)l.values[v + y1] -= _[y1]; - } + }, + specularmap: { + specularMap: { + value: null + }, + specularMapTransform: { + value: new Gt } - } - return s1.blendMode = xd, s1; -} -var Sv = { - convertArray: ni, - isTypedArray: Ud, - getKeyframeOrder: Dd, - sortedArray: _c, - flattenJSON: $c, - subclip: yx, - makeClipAdditive: Mx -}, es = class { - 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) { - let t = this.parameterPositions, n = this._cachedIndex, i = t[n], r = t[n - 1]; - e: { - t: { - let a; - n: { - i: if (!(e < i)) { - for(let o = n + 2;;){ - if (i === void 0) { - if (e < r) break i; - return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1); - } - if (n === o) break; - if (r = i, i = t[++n], e < i) break t; - } - a = t.length; - break n; - } - if (!(e >= r)) { - let o = t[1]; - e < o && (n = 2, r = o); - for(let c = n - 2;;){ - if (r === void 0) return this._cachedIndex = 0, this.copySampleValue_(0); - if (n === c) break; - if (i = r, r = t[--n - 1], e >= r) break t; - } - a = n, n = 0; - break n; - } - break e; - } - for(; n < a;){ - let o = n + a >>> 1; - e < t[o] ? a = o : n = o + 1; - } - if (i = t[n], r = t[n - 1], r === void 0) return this._cachedIndex = 0, this.copySampleValue_(0); - if (i === void 0) return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1); - } - this._cachedIndex = n, this.intervalChanged_(n, r, i); + }, + envmap: { + envMap: { + value: null + }, + envMapRotation: { + value: new Gt + }, + flipEnvMap: { + value: -1 + }, + reflectivity: { + value: 1 + }, + ior: { + value: 1.5 + }, + refractionRatio: { + value: .98 } - return this.interpolate_(n, r, e, i); - } - getSettings_() { - return this.settings || this.DefaultSettings_; - } - copySampleValue_(e) { - let t = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = e * i; - for(let a = 0; a !== i; ++a)t[a] = n[r + a]; - return t; - } - interpolate_() { - throw new Error("call to abstract method"); - } - intervalChanged_() {} -}, xc = class extends es { - 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: zi, - endingEnd: zi - }; - } - intervalChanged_(e, t, n) { - let i = this.parameterPositions, r = e - 2, a = e + 1, o = i[r], c = i[a]; - if (o === void 0) switch(this.getSettings_().endingStart){ - case Vi: - r = e, o = 2 * t - n; - break; - case Br: - r = i.length - 2, o = t + i[r] - i[r + 1]; - break; - default: - r = e, o = n; + }, + aomap: { + aoMap: { + value: null + }, + aoMapIntensity: { + value: 1 + }, + aoMapTransform: { + value: new Gt } - if (c === void 0) switch(this.getSettings_().endingEnd){ - case Vi: - a = e, c = 2 * n - t; - break; - case Br: - a = 1, c = n + i[1] - i[0]; - break; - default: - a = e - 1, c = t; + }, + lightmap: { + lightMap: { + value: null + }, + lightMapIntensity: { + value: 1 + }, + lightMapTransform: { + value: new Gt } - let l = (n - t) * .5, h = this.valueSize; - this._weightPrev = l / (t - o), this._weightNext = l / (c - n), this._offsetPrev = r * h, this._offsetNext = a * h; - } - interpolate_(e, t, n, i) { - let r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, c = e * o, l = c - o, h = this._offsetPrev, u = this._offsetNext, d = this._weightPrev, f = this._weightNext, m = (n - t) / (i - t), _ = m * m, g = _ * m, p = -d * g + 2 * d * _ - d * m, v = (1 + d) * g + (-1.5 - 2 * d) * _ + (-.5 + d) * m + 1, x1 = (-1 - f) * g + (1.5 + f) * _ + .5 * m, y1 = f * g - f * _; - for(let b = 0; b !== o; ++b)r[b] = p * a[h + b] + v * a[l + b] + x1 * a[c + b] + y1 * a[u + b]; - return r; - } -}, fa = class extends es { - constructor(e, t, n, i){ - super(e, t, n, i); - } - interpolate_(e, t, n, i) { - let r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, c = e * o, l = c - o, h = (n - t) / (i - t), u = 1 - h; - for(let d = 0; d !== o; ++d)r[d] = a[l + d] * u + a[c + d] * h; - return r; - } -}, vc = class extends es { - constructor(e, t, n, i){ - super(e, t, n, i); - } - interpolate_(e) { - return this.copySampleValue_(e - 1); - } -}, Jt = class { - 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 = ni(t, this.TimeBufferType), this.values = ni(n, this.ValueBufferType), this.setInterpolation(i || this.DefaultInterpolation); - } - static toJSON(e) { - let t = e.constructor, n; - if (t.toJSON !== this.toJSON) n = t.toJSON(e); - else { - n = { - name: e.name, - times: ni(e.times, Array), - values: ni(e.values, Array) - }; - let i = e.getInterpolation(); - i !== e.DefaultInterpolation && (n.interpolation = i); + }, + bumpmap: { + bumpMap: { + value: null + }, + bumpMapTransform: { + value: new Gt + }, + bumpScale: { + value: 1 } - return n.type = e.ValueTypeName, n; - } - InterpolantFactoryMethodDiscrete(e) { - return new vc(this.times, this.values, this.getValueSize(), e); - } - InterpolantFactoryMethodLinear(e) { - return new fa(this.times, this.values, this.getValueSize(), e); - } - InterpolantFactoryMethodSmooth(e) { - return new xc(this.times, this.values, this.getValueSize(), e); - } - setInterpolation(e) { - let t; - switch(e){ - case Or: - t = this.InterpolantFactoryMethodDiscrete; - break; - case Fr: - t = this.InterpolantFactoryMethodLinear; - break; - case La: - t = this.InterpolantFactoryMethodSmooth; - break; + }, + normalmap: { + normalMap: { + value: null + }, + normalMapTransform: { + value: new Gt + }, + normalScale: { + value: new T(1, 1) } - if (t === void 0) { - let 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; + }, + displacementmap: { + displacementMap: { + value: null + }, + displacementMapTransform: { + value: new Gt + }, + displacementScale: { + value: 1 + }, + displacementBias: { + value: 0 } - return this.createInterpolant = t, this; - } - getInterpolation() { - switch(this.createInterpolant){ - case this.InterpolantFactoryMethodDiscrete: - return Or; - case this.InterpolantFactoryMethodLinear: - return Fr; - case this.InterpolantFactoryMethodSmooth: - return La; + }, + emissivemap: { + emissiveMap: { + value: null + }, + emissiveMapTransform: { + value: new Gt } - } - getValueSize() { - return this.values.length / this.times.length; - } - shift(e) { - if (e !== 0) { - let t = this.times; - for(let n = 0, i = t.length; n !== i; ++n)t[n] += e; + }, + metalnessmap: { + metalnessMap: { + value: null + }, + metalnessMapTransform: { + value: new Gt } - return this; - } - scale(e) { - if (e !== 1) { - let t = this.times; - for(let n = 0, i = t.length; n !== i; ++n)t[n] *= e; + }, + roughnessmap: { + roughnessMap: { + value: null + }, + roughnessMapTransform: { + value: new Gt } - return this; - } - trim(e, t) { - let n = this.times, i = n.length, r = 0, a = i - 1; - for(; r !== i && n[r] < e;)++r; - for(; a !== -1 && n[a] > t;)--a; - if (++a, r !== 0 || a !== i) { - r >= a && (a = Math.max(a, 1), r = a - 1); - let o = this.getValueSize(); - this.times = n.slice(r, a), this.values = this.values.slice(r * o, a * o); + }, + gradientmap: { + gradientMap: { + value: null } - return this; - } - validate() { - let e = !0, t = this.getValueSize(); - t - Math.floor(t) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1); - let n = this.times, i = this.values, r = n.length; - r === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1); - let a = null; - for(let o = 0; o !== r; o++){ - let c = n[o]; - if (typeof c == "number" && isNaN(c)) { - console.error("THREE.KeyframeTrack: Time is not a valid number.", this, o, c), e = !1; - break; + }, + fog: { + fogDensity: { + value: 25e-5 + }, + fogNear: { + value: 1 + }, + fogFar: { + value: 2e3 + }, + fogColor: { + value: new P(16777215) + } + }, + lights: { + ambientLightColor: { + value: [] + }, + lightProbe: { + value: [] + }, + directionalLights: { + value: [], + properties: { + direction: {}, + color: {} } - if (a !== null && a > c) { - console.error("THREE.KeyframeTrack: Out of order keys.", this, o, c, a), e = !1; - break; + }, + directionalLightShadows: { + value: [], + properties: { + shadowIntensity: 1, + shadowBias: {}, + shadowNormalBias: {}, + shadowRadius: {}, + shadowMapSize: {} } - a = c; - } - if (i !== void 0 && Ud(i)) for(let o = 0, c = i.length; o !== c; ++o){ - let l = i[o]; - if (isNaN(l)) { - console.error("THREE.KeyframeTrack: Value is not a valid number.", this, o, l), e = !1; - break; + }, + directionalShadowMap: { + value: [] + }, + directionalShadowMatrix: { + value: [] + }, + spotLights: { + value: [], + properties: { + color: {}, + position: {}, + direction: {}, + distance: {}, + coneCos: {}, + penumbraCos: {}, + decay: {} } - } - return e; - } - optimize() { - let e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), i = this.getInterpolation() === La, r = e.length - 1, a = 1; - for(let o = 1; o < r; ++o){ - let c = !1, l = e[o], h = e[o + 1]; - if (l !== h && (o !== 1 || l !== e[0])) if (i) c = !0; - else { - let u = o * n, d = u - n, f = u + n; - for(let m = 0; m !== n; ++m){ - let _ = t[u + m]; - if (_ !== t[d + m] || _ !== t[f + m]) { - c = !0; - break; - } - } + }, + spotLightShadows: { + value: [], + properties: { + shadowIntensity: 1, + shadowBias: {}, + shadowNormalBias: {}, + shadowRadius: {}, + shadowMapSize: {} } - if (c) { - if (o !== a) { - e[a] = e[o]; - let u = o * n, d = a * n; - for(let f = 0; f !== n; ++f)t[d + f] = t[u + f]; - } - ++a; + }, + spotLightMap: { + value: [] + }, + spotShadowMap: { + value: [] + }, + spotLightMatrix: { + value: [] + }, + pointLights: { + value: [], + properties: { + color: {}, + position: {}, + decay: {}, + distance: {} } - } - if (r > 0) { - e[a] = e[r]; - for(let o = r * n, c = a * n, l = 0; l !== n; ++l)t[c + l] = t[o + l]; - ++a; - } - return a !== e.length ? (this.times = e.slice(0, a), this.values = t.slice(0, a * n)) : (this.times = e, this.values = t), this; - } - clone() { - let e = this.times.slice(), t = this.values.slice(), n = this.constructor, i = new n(this.name, e, t); - return i.createInterpolant = this.createInterpolant, i; - } -}; -Jt.prototype.TimeBufferType = Float32Array; -Jt.prototype.ValueBufferType = Float32Array; -Jt.prototype.DefaultInterpolation = Fr; -var Vn = class extends Jt { -}; -Vn.prototype.ValueTypeName = "bool"; -Vn.prototype.ValueBufferType = Array; -Vn.prototype.DefaultInterpolation = Or; -Vn.prototype.InterpolantFactoryMethodLinear = void 0; -Vn.prototype.InterpolantFactoryMethodSmooth = void 0; -var pa = class extends Jt { -}; -pa.prototype.ValueTypeName = "color"; -var ts = class extends Jt { -}; -ts.prototype.ValueTypeName = "number"; -var yc = class extends es { - constructor(e, t, n, i){ - super(e, t, n, i); - } - interpolate_(e, t, n, i) { - let r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, c = (n - t) / (i - t), l = e * o; - for(let h = l + o; l !== h; l += 4)Ut.slerpFlat(r, 0, a, l - o, a, l, c); - return r; - } -}, pi = class extends Jt { - InterpolantFactoryMethodLinear(e) { - return new yc(this.times, this.values, this.getValueSize(), e); - } -}; -pi.prototype.ValueTypeName = "quaternion"; -pi.prototype.DefaultInterpolation = Fr; -pi.prototype.InterpolantFactoryMethodSmooth = void 0; -var kn = class extends Jt { -}; -kn.prototype.ValueTypeName = "string"; -kn.prototype.ValueBufferType = Array; -kn.prototype.DefaultInterpolation = Or; -kn.prototype.InterpolantFactoryMethodLinear = void 0; -kn.prototype.InterpolantFactoryMethodSmooth = void 0; -var ns = class extends Jt { -}; -ns.prototype.ValueTypeName = "vector"; -var is = class { - constructor(e, t = -1, n, i = Xc){ - this.name = e, this.tracks = n, this.duration = t, this.blendMode = i, this.uuid = kt(), this.duration < 0 && this.resetDuration(); - } - static parse(e) { - let t = [], n = e.tracks, i = 1 / (e.fps || 1); - for(let a = 0, o = n.length; a !== o; ++a)t.push(bx(n[a]).scale(i)); - let r = new this(e.name, e.duration, t, e.blendMode); - return r.uuid = e.uuid, r; - } - static toJSON(e) { - let t = [], n = e.tracks, i = { - name: e.name, - duration: e.duration, - tracks: t, - uuid: e.uuid, - blendMode: e.blendMode - }; - for(let r = 0, a = n.length; r !== a; ++r)t.push(Jt.toJSON(n[r])); - return i; - } - static CreateFromMorphTargetSequence(e, t, n, i) { - let r = t.length, a = []; - for(let o = 0; o < r; o++){ - let c = [], l = []; - c.push((o + r - 1) % r, o, (o + 1) % r), l.push(0, 1, 0); - let h = Dd(c); - c = _c(c, 1, h), l = _c(l, 1, h), !i && c[0] === 0 && (c.push(r), l.push(l[0])), a.push(new ts(".morphTargetInfluences[" + t[o].name + "]", c, l).scale(1 / n)); - } - return new this(e, -1, a); - } - static findByName(e, t) { - let n = e; - if (!Array.isArray(e)) { - let 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) { - let i = {}, r = /^([\w-]*?)([\d]+)$/; - for(let o = 0, c = e.length; o < c; o++){ - let l = e[o], h = l.name.match(r); - if (h && h.length > 1) { - let u = h[1], d = i[u]; - d || (i[u] = d = []), d.push(l); + }, + pointLightShadows: { + value: [], + properties: { + shadowIntensity: 1, + shadowBias: {}, + shadowNormalBias: {}, + shadowRadius: {}, + shadowMapSize: {}, + shadowCameraNear: {}, + shadowCameraFar: {} } - } - let a = []; - for(let o in i)a.push(this.CreateFromMorphTargetSequence(o, i[o], t, n)); - return a; - } - static parseAnimation(e, t) { - if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; - let n = function(u, d, f, m, _) { - if (f.length !== 0) { - let g = [], p = []; - $c(f, g, p, m), g.length !== 0 && _.push(new u(d, g, p)); + }, + pointShadowMap: { + value: [] + }, + pointShadowMatrix: { + value: [] + }, + hemisphereLights: { + value: [], + properties: { + direction: {}, + skyColor: {}, + groundColor: {} } - }, i = [], r = e.name || "default", a = e.fps || 30, o = e.blendMode, c = e.length || -1, l = e.hierarchy || []; - for(let u = 0; u < l.length; u++){ - let d = l[u].keys; - if (!(!d || d.length === 0)) if (d[0].morphTargets) { - let f = {}, m; - for(m = 0; m < d.length; m++)if (d[m].morphTargets) for(let _ = 0; _ < d[m].morphTargets.length; _++)f[d[m].morphTargets[_]] = -1; - for(let _ in f){ - let g = [], p = []; - for(let v = 0; v !== d[m].morphTargets.length; ++v){ - let x1 = d[m]; - g.push(x1.time), p.push(x1.morphTarget === _ ? 1 : 0); - } - i.push(new ts(".morphTargetInfluence[" + _ + "]", g, p)); - } - c = f.length * a; - } else { - let f = ".bones[" + t[u].name + "]"; - n(ns, f + ".position", d, "pos", i), n(pi, f + ".quaternion", d, "rot", i), n(ns, f + ".scale", d, "scl", i); + }, + rectAreaLights: { + value: [], + properties: { + color: {}, + position: {}, + width: {}, + height: {} } + }, + ltc_1: { + value: null + }, + ltc_2: { + value: null } - return i.length === 0 ? null : new this(r, c, i, o); - } - resetDuration() { - let e = this.tracks, t = 0; - for(let n = 0, i = e.length; n !== i; ++n){ - let r = this.tracks[n]; - t = Math.max(t, r.times[r.times.length - 1]); + }, + points: { + diffuse: { + value: new P(16777215) + }, + opacity: { + value: 1 + }, + size: { + value: 1 + }, + scale: { + value: 1 + }, + map: { + value: null + }, + alphaMap: { + value: null + }, + alphaMapTransform: { + value: new Gt + }, + alphaTest: { + value: 0 + }, + uvTransform: { + value: new Gt } - 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() { - let 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 Sx(s1) { - switch(s1.toLowerCase()){ - case "scalar": - case "double": - case "float": - case "number": - case "integer": - return ts; - case "vector": - case "vector2": - case "vector3": - case "vector4": - return ns; - case "color": - return pa; - case "quaternion": - return pi; - case "bool": - case "boolean": - return Vn; - case "string": - return kn; - } - throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + s1); -} -function bx(s1) { - if (s1.type === void 0) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); - let e = Sx(s1.type); - if (s1.times === void 0) { - let t = [], n = []; - $c(s1.keys, t, n, "value"), s1.times = t, s1.values = n; - } - return e.parse !== void 0 ? e.parse(s1) : new e(s1.name, s1.times, s1.values, s1.interpolation); -} -var ss = { - enabled: !1, - files: {}, - add: function(s1, e) { - this.enabled !== !1 && (this.files[s1] = e); }, - get: function(s1) { - if (this.enabled !== !1) return this.files[s1]; + sprite: { + diffuse: { + value: new P(16777215) + }, + opacity: { + value: 1 + }, + center: { + value: new T(.5, .5) + }, + rotation: { + value: 0 + }, + map: { + value: null + }, + mapTransform: { + value: new Gt + }, + alphaMap: { + value: null + }, + alphaMapTransform: { + value: new Gt + }, + alphaTest: { + value: 0 + } + } +}, gt1 = { + basic: { + uniforms: Iu([ + ee1.common, + ee1.specularmap, + ee1.envmap, + ee1.aomap, + ee1.lightmap, + ee1.fog + ]), + vertexShader: Pe1.meshbasic_vert, + fragmentShader: Pe1.meshbasic_frag }, - remove: function(s1) { - delete this.files[s1]; + lambert: { + uniforms: Iu([ + ee1.common, + ee1.specularmap, + ee1.envmap, + ee1.aomap, + ee1.lightmap, + ee1.emissivemap, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + ee1.fog, + ee1.lights, + { + emissive: { + value: new P(0) + } + } + ]), + vertexShader: Pe1.meshlambert_vert, + fragmentShader: Pe1.meshlambert_frag }, - clear: function() { - this.files = {}; - } -}, ma = class { - constructor(e, t, n){ - let i = this, r = !1, a = 0, o = 0, c, l = []; - this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this.itemStart = function(h) { - o++, r === !1 && i.onStart !== void 0 && i.onStart(h, a, o), r = !0; - }, this.itemEnd = function(h) { - a++, i.onProgress !== void 0 && i.onProgress(h, a, o), a === o && (r = !1, i.onLoad !== void 0 && i.onLoad()); - }, this.itemError = function(h) { - i.onError !== void 0 && i.onError(h); - }, this.resolveURL = function(h) { - return c ? c(h) : h; - }, this.setURLModifier = function(h) { - return c = h, this; - }, this.addHandler = function(h, u) { - return l.push(h, u), this; - }, this.removeHandler = function(h) { - let u = l.indexOf(h); - return u !== -1 && l.splice(u, 2), this; - }, this.getHandler = function(h) { - for(let u = 0, d = l.length; u < d; u += 2){ - let f = l[u], m = l[u + 1]; - if (f.global && (f.lastIndex = 0), f.test(h)) return m; + phong: { + uniforms: Iu([ + ee1.common, + ee1.specularmap, + ee1.envmap, + ee1.aomap, + ee1.lightmap, + ee1.emissivemap, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + ee1.fog, + ee1.lights, + { + emissive: { + value: new P(0) + }, + specular: { + value: new P(1118481) + }, + shininess: { + value: 30 + } } - return null; - }; - } -}, Ex = new ma, Dt = class { - constructor(e){ - this.manager = e !== void 0 ? e : Ex, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}; - } - load() {} - loadAsync(e, t) { - let n = this; - return new Promise(function(i, r) { - n.load(e, i, t, r); - }); - } - parse() {} - setCrossOrigin(e) { - return this.crossOrigin = e, this; - } - setWithCredentials(e) { - return this.withCredentials = e, this; - } - setPath(e) { - return this.path = e, this; - } - setResourcePath(e) { - return this.resourcePath = e, this; - } - setRequestHeader(e) { - return this.requestHeader = e, this; - } -}; -Dt.DEFAULT_MATERIAL_NAME = "__DEFAULT"; -var fn = {}, Mc = class extends Error { - constructor(e, t){ - super(e), this.response = t; - } -}, rn = class extends Dt { - 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); - let r = ss.get(e); - if (r !== void 0) return this.manager.itemStart(e), setTimeout(()=>{ - t && t(r), this.manager.itemEnd(e); - }, 0), r; - if (fn[e] !== void 0) { - fn[e].push({ - onLoad: t, - onProgress: n, - onError: i - }); - return; - } - fn[e] = [], fn[e].push({ - onLoad: t, - onProgress: n, - onError: i - }); - let a = new Request(e, { - headers: new Headers(this.requestHeader), - credentials: this.withCredentials ? "include" : "same-origin" - }), o = this.mimeType, c = this.responseType; - fetch(a).then((l)=>{ - if (l.status === 200 || l.status === 0) { - if (l.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || l.body === void 0 || l.body.getReader === void 0) return l; - let h = fn[e], u = l.body.getReader(), d = l.headers.get("Content-Length") || l.headers.get("X-File-Size"), f = d ? parseInt(d) : 0, m = f !== 0, _ = 0, g = new ReadableStream({ - start (p) { - v(); - function v() { - u.read().then(({ done: x1 , value: y1 })=>{ - if (x1) p.close(); - else { - _ += y1.byteLength; - let b = new ProgressEvent("progress", { - lengthComputable: m, - loaded: _, - total: f - }); - for(let w = 0, R = h.length; w < R; w++){ - let I = h[w]; - I.onProgress && I.onProgress(b); - } - p.enqueue(y1), v(); - } - }); - } - } - }); - return new Response(g); - } else throw new Mc(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`, l); - }).then((l)=>{ - switch(c){ - case "arraybuffer": - return l.arrayBuffer(); - case "blob": - return l.blob(); - case "document": - return l.text().then((h)=>new DOMParser().parseFromString(h, o)); - case "json": - return l.json(); - default: - if (o === void 0) return l.text(); - { - let u = /charset="?([^;"\s]*)"?/i.exec(o), d = u && u[1] ? u[1].toLowerCase() : void 0, f = new TextDecoder(d); - return l.arrayBuffer().then((m)=>f.decode(m)); - } + ]), + vertexShader: Pe1.meshphong_vert, + fragmentShader: Pe1.meshphong_frag + }, + standard: { + uniforms: Iu([ + ee1.common, + ee1.envmap, + ee1.aomap, + ee1.lightmap, + ee1.emissivemap, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + ee1.roughnessmap, + ee1.metalnessmap, + ee1.fog, + ee1.lights, + { + emissive: { + value: new P(0) + }, + roughness: { + value: 1 + }, + metalness: { + value: 0 + }, + envMapIntensity: { + value: 1 + } } - }).then((l)=>{ - ss.add(e, l); - let h = fn[e]; - delete fn[e]; - for(let u = 0, d = h.length; u < d; u++){ - let f = h[u]; - f.onLoad && f.onLoad(l); + ]), + vertexShader: Pe1.meshphysical_vert, + fragmentShader: Pe1.meshphysical_frag + }, + toon: { + uniforms: Iu([ + ee1.common, + ee1.aomap, + ee1.lightmap, + ee1.emissivemap, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + ee1.gradientmap, + ee1.fog, + ee1.lights, + { + emissive: { + value: new P(0) + } } - }).catch((l)=>{ - let h = fn[e]; - if (h === void 0) throw this.manager.itemError(e), l; - delete fn[e]; - for(let u = 0, d = h.length; u < d; u++){ - let f = h[u]; - f.onError && f.onError(l); - } - this.manager.itemError(e); - }).finally(()=>{ - this.manager.itemEnd(e); - }), this.manager.itemStart(e); - } - setResponseType(e) { - return this.responseType = e, this; - } - setMimeType(e) { - return this.mimeType = e, this; - } -}, au = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - let r = this, a = new rn(this.manager); - a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(o) { - try { - t(r.parse(JSON.parse(o))); - } catch (c) { - i ? i(c) : console.error(c), r.manager.itemError(e); + ]), + vertexShader: Pe1.meshtoon_vert, + fragmentShader: Pe1.meshtoon_frag + }, + matcap: { + uniforms: Iu([ + ee1.common, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + ee1.fog, + { + matcap: { + value: null + } } - }, n, i); - } - parse(e) { - let t = []; - for(let n = 0; n < e.length; n++){ - let i = is.parse(e[n]); - t.push(i); - } - return t; - } -}, ou = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - let r = this, a = [], o = new Us, c = new rn(this.manager); - c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(r.withCredentials); - let l = 0; - function h(u) { - c.load(e[u], function(d) { - let f = r.parse(d, !0); - a[u] = { - width: f.width, - height: f.height, - format: f.format, - mipmaps: f.mipmaps - }, l += 1, l === 6 && (f.mipmapCount === 1 && (o.minFilter = mt), o.image = a, o.format = f.format, o.needsUpdate = !0, t && t(o)); - }, n, i); - } - if (Array.isArray(e)) for(let u = 0, d = e.length; u < d; ++u)h(u); - else c.load(e, function(u) { - let d = r.parse(u, !0); - if (d.isCubemap) { - let f = d.mipmaps.length / d.mipmapCount; - for(let m = 0; m < f; m++){ - a[m] = { - mipmaps: [] - }; - for(let _ = 0; _ < d.mipmapCount; _++)a[m].mipmaps.push(d.mipmaps[m * d.mipmapCount + _]), a[m].format = d.format, a[m].width = d.width, a[m].height = d.height; + ]), + vertexShader: Pe1.meshmatcap_vert, + fragmentShader: Pe1.meshmatcap_frag + }, + points: { + uniforms: Iu([ + ee1.points, + ee1.fog + ]), + vertexShader: Pe1.points_vert, + fragmentShader: Pe1.points_frag + }, + dashed: { + uniforms: Iu([ + ee1.common, + ee1.fog, + { + scale: { + value: 1 + }, + dashSize: { + value: 1 + }, + totalSize: { + value: 2 } - o.image = a; - } else o.image.width = d.width, o.image.height = d.height, o.mipmaps = d.mipmaps; - d.mipmapCount === 1 && (o.minFilter = mt), o.format = d.format, o.needsUpdate = !0, t && t(o); - }, n, i); - return o; - } -}, rs = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); - let r = this, a = ss.get(e); - if (a !== void 0) return r.manager.itemStart(e), setTimeout(function() { - t && t(a), r.manager.itemEnd(e); - }, 0), a; - let o = ws("img"); - function c() { - h(), ss.add(e, this), t && t(this), r.manager.itemEnd(e); - } - function l(u) { - h(), i && i(u), r.manager.itemError(e), r.manager.itemEnd(e); - } - function h() { - o.removeEventListener("load", c, !1), o.removeEventListener("error", l, !1); - } - return o.addEventListener("load", c, !1), o.addEventListener("error", l, !1), e.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), r.manager.itemStart(e), o.src = e, o; - } -}, cu = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - let r = new Ki; - r.colorSpace = vt; - let a = new rs(this.manager); - a.setCrossOrigin(this.crossOrigin), a.setPath(this.path); - let o = 0; - function c(l) { - a.load(e[l], function(h) { - r.images[l] = h, o++, o === 6 && (r.needsUpdate = !0, t && t(r)); - }, void 0, i); - } - for(let l = 0; l < e.length; ++l)c(l); - return r; - } -}, lu = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - let r = this, a = new oi, o = new rn(this.manager); - return o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(r.withCredentials), o.load(e, function(c) { - let l; - try { - l = r.parse(c); - } catch (h) { - if (i !== void 0) i(h); - else { - console.error(h); - return; + } + ]), + vertexShader: Pe1.linedashed_vert, + fragmentShader: Pe1.linedashed_frag + }, + depth: { + uniforms: Iu([ + ee1.common, + ee1.displacementmap + ]), + vertexShader: Pe1.depth_vert, + fragmentShader: Pe1.depth_frag + }, + normal: { + uniforms: Iu([ + ee1.common, + ee1.bumpmap, + ee1.normalmap, + ee1.displacementmap, + { + opacity: { + value: 1 } } - l.image !== void 0 ? a.image = l.image : l.data !== void 0 && (a.image.width = l.width, a.image.height = l.height, a.image.data = l.data), a.wrapS = l.wrapS !== void 0 ? l.wrapS : It, a.wrapT = l.wrapT !== void 0 ? l.wrapT : It, a.magFilter = l.magFilter !== void 0 ? l.magFilter : mt, a.minFilter = l.minFilter !== void 0 ? l.minFilter : mt, a.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.colorSpace !== void 0 ? a.colorSpace = l.colorSpace : l.encoding !== void 0 && (a.encoding = l.encoding), l.flipY !== void 0 && (a.flipY = l.flipY), l.format !== void 0 && (a.format = l.format), l.type !== void 0 && (a.type = l.type), l.mipmaps !== void 0 && (a.mipmaps = l.mipmaps, a.minFilter = li), l.mipmapCount === 1 && (a.minFilter = mt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l); - }, n, i), a; - } -}, hu = class extends Dt { - constructor(e){ - super(e); - } - load(e, t, n, i) { - let r = new St, a = new rs(this.manager); - return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(e, function(o) { - r.image = o, r.needsUpdate = !0, t !== void 0 && t(r); - }, n, i), r; - } -}, En = class extends Je { - constructor(e, t = 1){ - super(), this.isLight = !0, this.type = "Light", this.color = new pe(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) { - let 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; - } -}, Sc = class extends En { - constructor(e, t, n){ - super(e, n), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(Je.DEFAULT_UP), this.updateMatrix(), this.groundColor = new pe(t); - } - copy(e, t) { - return super.copy(e, t), this.groundColor.copy(e.groundColor), this; - } -}, oo = new ze, uu = new A, du = new A, zs = class { - constructor(e){ - this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new Z(512, 512), this.map = null, this.mapPass = null, this.matrix = new ze, this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new Ps, this._frameExtents = new Z(1, 1), this._viewportCount = 1, this._viewports = [ - new je(0, 0, 1, 1) - ]; - } - getViewportCount() { - return this._viewportCount; - } - getFrustum() { - return this._frustum; - } - updateMatrices(e) { - let t = this.camera, n = this.matrix; - uu.setFromMatrixPosition(e.matrixWorld), t.position.copy(uu), du.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(du), t.updateMatrixWorld(), oo.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(oo), n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), n.multiply(oo); - } - 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() { - let 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; - } -}, bc = class extends zs { - constructor(){ - super(new yt(50, 1, .5, 500)), this.isSpotLightShadow = !0, this.focus = 1; - } - updateMatrices(e) { - let t = this.camera, n = Zi * 2 * e.angle * this.focus, i = this.mapSize.width / this.mapSize.height, r = e.distance || t.far; - (n !== t.fov || i !== t.aspect || r !== t.far) && (t.fov = n, t.aspect = i, t.far = r, t.updateProjectionMatrix()), super.updateMatrices(e); - } - copy(e) { - return super.copy(e), this.focus = e.focus, this; - } -}, Ec = class extends En { - constructor(e, t, n = 0, i = Math.PI / 3, r = 0, a = 2){ - super(e, t), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(Je.DEFAULT_UP), this.updateMatrix(), this.target = new Je, this.distance = n, this.angle = i, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new bc; - } - 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; - } -}, fu = new ze, _s = new A, co = new A, Tc = class extends zs { - constructor(){ - super(new yt(90, 1, .5, 500)), this.isPointLightShadow = !0, this._frameExtents = new Z(4, 2), this._viewportCount = 6, this._viewports = [ - new je(2, 1, 1, 1), - new je(0, 1, 1, 1), - new je(3, 1, 1, 1), - new je(1, 1, 1, 1), - new je(3, 0, 1, 1), - new je(1, 0, 1, 1) - ], this._cubeDirections = [ - new A(1, 0, 0), - new A(-1, 0, 0), - new A(0, 0, 1), - new A(0, 0, -1), - new A(0, 1, 0), - new A(0, -1, 0) - ], this._cubeUps = [ - new A(0, 1, 0), - new A(0, 1, 0), - new A(0, 1, 0), - new A(0, 1, 0), - new A(0, 0, 1), - new A(0, 0, -1) - ]; - } - updateMatrices(e, t = 0) { - let n = this.camera, i = this.matrix, r = e.distance || n.far; - r !== n.far && (n.far = r, n.updateProjectionMatrix()), _s.setFromMatrixPosition(e.matrixWorld), n.position.copy(_s), co.copy(n.position), co.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(co), n.updateMatrixWorld(), i.makeTranslation(-_s.x, -_s.y, -_s.z), fu.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(fu); - } -}, wc = class extends En { - 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 Tc; - } - 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; - } -}, Ac = class extends zs { - constructor(){ - super(new Ls(-5, 5, 5, -5, .5, 500)), this.isDirectionalLightShadow = !0; - } -}, Rc = class extends En { - constructor(e, t){ - super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(Je.DEFAULT_UP), this.updateMatrix(), this.target = new Je, this.shadow = new Ac; - } - dispose() { - this.shadow.dispose(); - } - copy(e) { - return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; - } -}, Cc = class extends En { - constructor(e, t){ - super(e, t), this.isAmbientLight = !0, this.type = "AmbientLight"; - } -}, Pc = class extends En { - constructor(e, t, n = 10, i = 10){ - super(e, t), this.isRectAreaLight = !0, this.type = "RectAreaLight", this.width = n, this.height = i; - } - get power() { - return this.intensity * this.width * this.height * Math.PI; - } - set power(e) { - this.intensity = e / (this.width * this.height * Math.PI); - } - copy(e) { - return super.copy(e), this.width = e.width, this.height = e.height, this; - } - toJSON(e) { - let t = super.toJSON(e); - return t.object.width = this.width, t.object.height = this.height, t; - } -}, Lc = class { - constructor(){ - this.isSphericalHarmonics3 = !0, this.coefficients = []; - for(let e = 0; e < 9; e++)this.coefficients.push(new A); - } - set(e) { - for(let t = 0; t < 9; t++)this.coefficients[t].copy(e[t]); - return this; - } - zero() { - for(let e = 0; e < 9; e++)this.coefficients[e].set(0, 0, 0); - return this; - } - getAt(e, t) { - let n = e.x, i = e.y, r = e.z, a = this.coefficients; - return t.copy(a[0]).multiplyScalar(.282095), t.addScaledVector(a[1], .488603 * i), t.addScaledVector(a[2], .488603 * r), t.addScaledVector(a[3], .488603 * n), t.addScaledVector(a[4], 1.092548 * (n * i)), t.addScaledVector(a[5], 1.092548 * (i * r)), t.addScaledVector(a[6], .315392 * (3 * r * r - 1)), t.addScaledVector(a[7], 1.092548 * (n * r)), t.addScaledVector(a[8], .546274 * (n * n - i * i)), t; - } - getIrradianceAt(e, t) { - let n = e.x, i = e.y, r = e.z, a = this.coefficients; - return t.copy(a[0]).multiplyScalar(.886227), t.addScaledVector(a[1], 2 * .511664 * i), t.addScaledVector(a[2], 2 * .511664 * r), t.addScaledVector(a[3], 2 * .511664 * n), t.addScaledVector(a[4], 2 * .429043 * n * i), t.addScaledVector(a[5], 2 * .429043 * i * r), t.addScaledVector(a[6], .743125 * r * r - .247708), t.addScaledVector(a[7], 2 * .429043 * n * r), t.addScaledVector(a[8], .429043 * (n * n - i * i)), t; - } - add(e) { - for(let t = 0; t < 9; t++)this.coefficients[t].add(e.coefficients[t]); - return this; - } - addScaledSH(e, t) { - for(let n = 0; n < 9; n++)this.coefficients[n].addScaledVector(e.coefficients[n], t); - return this; - } - scale(e) { - for(let t = 0; t < 9; t++)this.coefficients[t].multiplyScalar(e); - return this; - } - lerp(e, t) { - for(let n = 0; n < 9; n++)this.coefficients[n].lerp(e.coefficients[n], t); - return this; - } - equals(e) { - for(let t = 0; t < 9; t++)if (!this.coefficients[t].equals(e.coefficients[t])) return !1; - return !0; - } - copy(e) { - return this.set(e.coefficients); - } - clone() { - return new this.constructor().copy(this); - } - fromArray(e, t = 0) { - let n = this.coefficients; - for(let i = 0; i < 9; i++)n[i].fromArray(e, t + i * 3); - return this; - } - toArray(e = [], t = 0) { - let n = this.coefficients; - for(let i = 0; i < 9; i++)n[i].toArray(e, t + i * 3); - return e; - } - static getBasisAt(e, t) { - let n = e.x, i = e.y, r = e.z; - t[0] = .282095, t[1] = .488603 * i, t[2] = .488603 * r, t[3] = .488603 * n, t[4] = 1.092548 * n * i, t[5] = 1.092548 * i * r, t[6] = .315392 * (3 * r * r - 1), t[7] = 1.092548 * n * r, t[8] = .546274 * (n * n - i * i); - } -}, Ic = class extends En { - constructor(e = new Lc, t = 1){ - super(void 0, t), this.isLightProbe = !0, this.sh = e; - } - copy(e) { - return super.copy(e), this.sh.copy(e.sh), this; - } - fromJSON(e) { - return this.intensity = e.intensity, this.sh.fromArray(e.sh), this; - } - toJSON(e) { - let t = super.toJSON(e); - return t.object.sh = this.sh.toArray(), t; - } -}, Uc = class s1 extends Dt { - constructor(e){ - super(e), this.textures = {}; - } - load(e, t, n, i) { - let r = this, a = new rn(r.manager); - a.setPath(r.path), a.setRequestHeader(r.requestHeader), a.setWithCredentials(r.withCredentials), a.load(e, function(o) { - try { - t(r.parse(JSON.parse(o))); - } catch (c) { - i ? i(c) : console.error(c), r.manager.itemError(e); + ]), + vertexShader: Pe1.meshnormal_vert, + fragmentShader: Pe1.meshnormal_frag + }, + sprite: { + uniforms: Iu([ + ee1.sprite, + ee1.fog + ]), + vertexShader: Pe1.sprite_vert, + fragmentShader: Pe1.sprite_frag + }, + background: { + uniforms: { + uvTransform: { + value: new Gt + }, + t2D: { + value: null + }, + backgroundIntensity: { + value: 1 } - }, n, i); - } - parse(e) { - let t = this.textures; - function n(r) { - return t[r] === void 0 && console.warn("THREE.MaterialLoader: Undefined texture", r), t[r]; - } - let i = s1.createMaterialFromType(e.type); - if (e.uuid !== void 0 && (i.uuid = e.uuid), e.name !== void 0 && (i.name = e.name), e.color !== void 0 && i.color !== void 0 && i.color.setHex(e.color), e.roughness !== void 0 && (i.roughness = e.roughness), e.metalness !== void 0 && (i.metalness = e.metalness), e.sheen !== void 0 && (i.sheen = e.sheen), e.sheenColor !== void 0 && (i.sheenColor = new pe().setHex(e.sheenColor)), e.sheenRoughness !== void 0 && (i.sheenRoughness = e.sheenRoughness), e.emissive !== void 0 && i.emissive !== void 0 && i.emissive.setHex(e.emissive), e.specular !== void 0 && i.specular !== void 0 && i.specular.setHex(e.specular), e.specularIntensity !== void 0 && (i.specularIntensity = e.specularIntensity), e.specularColor !== void 0 && i.specularColor !== void 0 && i.specularColor.setHex(e.specularColor), e.shininess !== void 0 && (i.shininess = e.shininess), e.clearcoat !== void 0 && (i.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = e.clearcoatRoughness), e.iridescence !== void 0 && (i.iridescence = e.iridescence), e.iridescenceIOR !== void 0 && (i.iridescenceIOR = e.iridescenceIOR), e.iridescenceThicknessRange !== void 0 && (i.iridescenceThicknessRange = e.iridescenceThicknessRange), e.transmission !== void 0 && (i.transmission = e.transmission), e.thickness !== void 0 && (i.thickness = e.thickness), e.attenuationDistance !== void 0 && (i.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && i.attenuationColor !== void 0 && i.attenuationColor.setHex(e.attenuationColor), e.anisotropy !== void 0 && (i.anisotropy = e.anisotropy), e.anisotropyRotation !== void 0 && (i.anisotropyRotation = e.anisotropyRotation), e.fog !== void 0 && (i.fog = e.fog), e.flatShading !== void 0 && (i.flatShading = e.flatShading), e.blending !== void 0 && (i.blending = e.blending), e.combine !== void 0 && (i.combine = e.combine), e.side !== void 0 && (i.side = e.side), e.shadowSide !== void 0 && (i.shadowSide = e.shadowSide), e.opacity !== void 0 && (i.opacity = e.opacity), e.transparent !== void 0 && (i.transparent = e.transparent), e.alphaTest !== void 0 && (i.alphaTest = e.alphaTest), e.alphaHash !== void 0 && (i.alphaHash = e.alphaHash), e.depthTest !== void 0 && (i.depthTest = e.depthTest), e.depthWrite !== void 0 && (i.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (i.colorWrite = e.colorWrite), e.stencilWrite !== void 0 && (i.stencilWrite = e.stencilWrite), e.stencilWriteMask !== void 0 && (i.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (i.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (i.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (i.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (i.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (i.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (i.stencilZPass = e.stencilZPass), e.wireframe !== void 0 && (i.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (i.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (i.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (i.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (i.rotation = e.rotation), e.linewidth !== void 0 && (i.linewidth = e.linewidth), e.dashSize !== void 0 && (i.dashSize = e.dashSize), e.gapSize !== void 0 && (i.gapSize = e.gapSize), e.scale !== void 0 && (i.scale = e.scale), e.polygonOffset !== void 0 && (i.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (i.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (i.polygonOffsetUnits = e.polygonOffsetUnits), e.dithering !== void 0 && (i.dithering = e.dithering), e.alphaToCoverage !== void 0 && (i.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (i.premultipliedAlpha = e.premultipliedAlpha), e.forceSinglePass !== void 0 && (i.forceSinglePass = e.forceSinglePass), e.visible !== void 0 && (i.visible = e.visible), e.toneMapped !== void 0 && (i.toneMapped = e.toneMapped), e.userData !== void 0 && (i.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? i.vertexColors = e.vertexColors > 0 : i.vertexColors = e.vertexColors), e.uniforms !== void 0) for(let r in e.uniforms){ - let a = e.uniforms[r]; - switch(i.uniforms[r] = {}, a.type){ - case "t": - i.uniforms[r].value = n(a.value); - break; - case "c": - i.uniforms[r].value = new pe().setHex(a.value); - break; - case "v2": - i.uniforms[r].value = new Z().fromArray(a.value); - break; - case "v3": - i.uniforms[r].value = new A().fromArray(a.value); - break; - case "v4": - i.uniforms[r].value = new je().fromArray(a.value); - break; - case "m3": - i.uniforms[r].value = new He().fromArray(a.value); - break; - case "m4": - i.uniforms[r].value = new ze().fromArray(a.value); - break; - default: - i.uniforms[r].value = a.value; + }, + vertexShader: Pe1.background_vert, + fragmentShader: Pe1.background_frag + }, + backgroundCube: { + uniforms: { + envMap: { + value: null + }, + flipEnvMap: { + value: -1 + }, + backgroundBlurriness: { + value: 0 + }, + backgroundIntensity: { + value: 1 + }, + backgroundRotation: { + value: new Gt } - } - if (e.defines !== void 0 && (i.defines = e.defines), e.vertexShader !== void 0 && (i.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (i.fragmentShader = e.fragmentShader), e.glslVersion !== void 0 && (i.glslVersion = e.glslVersion), e.extensions !== void 0) for(let r in e.extensions)i.extensions[r] = e.extensions[r]; - if (e.lights !== void 0 && (i.lights = e.lights), e.clipping !== void 0 && (i.clipping = e.clipping), e.size !== void 0 && (i.size = e.size), e.sizeAttenuation !== void 0 && (i.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (i.map = n(e.map)), e.matcap !== void 0 && (i.matcap = n(e.matcap)), e.alphaMap !== void 0 && (i.alphaMap = n(e.alphaMap)), e.bumpMap !== void 0 && (i.bumpMap = n(e.bumpMap)), e.bumpScale !== void 0 && (i.bumpScale = e.bumpScale), e.normalMap !== void 0 && (i.normalMap = n(e.normalMap)), e.normalMapType !== void 0 && (i.normalMapType = e.normalMapType), e.normalScale !== void 0) { - let r = e.normalScale; - Array.isArray(r) === !1 && (r = [ - r, - r - ]), i.normalScale = new Z().fromArray(r); - } - return e.displacementMap !== void 0 && (i.displacementMap = n(e.displacementMap)), e.displacementScale !== void 0 && (i.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (i.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (i.roughnessMap = n(e.roughnessMap)), e.metalnessMap !== void 0 && (i.metalnessMap = n(e.metalnessMap)), e.emissiveMap !== void 0 && (i.emissiveMap = n(e.emissiveMap)), e.emissiveIntensity !== void 0 && (i.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (i.specularMap = n(e.specularMap)), e.specularIntensityMap !== void 0 && (i.specularIntensityMap = n(e.specularIntensityMap)), e.specularColorMap !== void 0 && (i.specularColorMap = n(e.specularColorMap)), e.envMap !== void 0 && (i.envMap = n(e.envMap)), e.envMapIntensity !== void 0 && (i.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (i.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (i.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (i.lightMap = n(e.lightMap)), e.lightMapIntensity !== void 0 && (i.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (i.aoMap = n(e.aoMap)), e.aoMapIntensity !== void 0 && (i.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (i.gradientMap = n(e.gradientMap)), e.clearcoatMap !== void 0 && (i.clearcoatMap = n(e.clearcoatMap)), e.clearcoatRoughnessMap !== void 0 && (i.clearcoatRoughnessMap = n(e.clearcoatRoughnessMap)), e.clearcoatNormalMap !== void 0 && (i.clearcoatNormalMap = n(e.clearcoatNormalMap)), e.clearcoatNormalScale !== void 0 && (i.clearcoatNormalScale = new Z().fromArray(e.clearcoatNormalScale)), e.iridescenceMap !== void 0 && (i.iridescenceMap = n(e.iridescenceMap)), e.iridescenceThicknessMap !== void 0 && (i.iridescenceThicknessMap = n(e.iridescenceThicknessMap)), e.transmissionMap !== void 0 && (i.transmissionMap = n(e.transmissionMap)), e.thicknessMap !== void 0 && (i.thicknessMap = n(e.thicknessMap)), e.anisotropyMap !== void 0 && (i.anisotropyMap = n(e.anisotropyMap)), e.sheenColorMap !== void 0 && (i.sheenColorMap = n(e.sheenColorMap)), e.sheenRoughnessMap !== void 0 && (i.sheenRoughnessMap = n(e.sheenRoughnessMap)), i; - } - setTextures(e) { - return this.textures = e, this; - } - static createMaterialFromType(e) { - let t = { - ShadowMaterial: cc, - SpriteMaterial: ea, - RawShaderMaterial: lc, - ShaderMaterial: jt, - PointsMaterial: na, - MeshPhysicalMaterial: hc, - MeshStandardMaterial: da, - MeshPhongMaterial: uc, - MeshToonMaterial: dc, - MeshNormalMaterial: fc, - MeshLambertMaterial: pc, - MeshDepthMaterial: Qr, - MeshDistanceMaterial: jr, - MeshBasicMaterial: Sn, - MeshMatcapMaterial: mc, - LineDashedMaterial: gc, - LineBasicMaterial: wt, - Material: bt - }; - return new t[e]; + }, + vertexShader: Pe1.backgroundCube_vert, + fragmentShader: Pe1.backgroundCube_frag + }, + cube: { + uniforms: { + tCube: { + value: null + }, + tFlip: { + value: -1 + }, + opacity: { + value: 1 + } + }, + vertexShader: Pe1.cube_vert, + fragmentShader: Pe1.cube_frag + }, + equirect: { + uniforms: { + tEquirect: { + value: null + } + }, + vertexShader: Pe1.equirect_vert, + fragmentShader: Pe1.equirect_frag + }, + distanceRGBA: { + uniforms: Iu([ + ee1.common, + ee1.displacementmap, + { + referencePosition: { + value: new w + }, + nearDistance: { + value: 1 + }, + farDistance: { + value: 1e3 + } + } + ]), + vertexShader: Pe1.distanceRGBA_vert, + fragmentShader: Pe1.distanceRGBA_frag + }, + shadow: { + uniforms: Iu([ + ee1.lights, + ee1.fog, + { + color: { + value: new P(0) + }, + opacity: { + value: 1 + } + } + ]), + vertexShader: Pe1.shadow_vert, + fragmentShader: Pe1.shadow_frag } -}, ga = class { - 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; +}; +gt1.physical = { + uniforms: Iu([ + gt1.standard.uniforms, + { + clearcoat: { + value: 0 + }, + clearcoatMap: { + value: null + }, + clearcoatMapTransform: { + value: new Gt + }, + clearcoatNormalMap: { + value: null + }, + clearcoatNormalMapTransform: { + value: new Gt + }, + clearcoatNormalScale: { + value: new T(1, 1) + }, + clearcoatRoughness: { + value: 0 + }, + clearcoatRoughnessMap: { + value: null + }, + clearcoatRoughnessMapTransform: { + value: new Gt + }, + dispersion: { + value: 0 + }, + iridescence: { + value: 0 + }, + iridescenceMap: { + value: null + }, + iridescenceMapTransform: { + value: new Gt + }, + iridescenceIOR: { + value: 1.3 + }, + iridescenceThicknessMinimum: { + value: 100 + }, + iridescenceThicknessMaximum: { + value: 400 + }, + iridescenceThicknessMap: { + value: null + }, + iridescenceThicknessMapTransform: { + value: new Gt + }, + sheen: { + value: 0 + }, + sheenColor: { + value: new P(0) + }, + sheenColorMap: { + value: null + }, + sheenColorMapTransform: { + value: new Gt + }, + sheenRoughness: { + value: 1 + }, + sheenRoughnessMap: { + value: null + }, + sheenRoughnessMapTransform: { + value: new Gt + }, + transmission: { + value: 0 + }, + transmissionMap: { + value: null + }, + transmissionMapTransform: { + value: new Gt + }, + transmissionSamplerSize: { + value: new T + }, + transmissionSamplerMap: { + value: null + }, + thickness: { + value: 0 + }, + thicknessMap: { + value: null + }, + thicknessMapTransform: { + value: new Gt + }, + attenuationDistance: { + value: 0 + }, + attenuationColor: { + value: new P(0) + }, + specularColor: { + value: new P(1, 1, 1) + }, + specularColorMap: { + value: null + }, + specularColorMapTransform: { + value: new Gt + }, + specularIntensity: { + value: 1 + }, + specularIntensityMap: { + value: null + }, + specularIntensityMapTransform: { + value: new Gt + }, + anisotropyVector: { + value: new T + }, + anisotropyMap: { + value: null + }, + anisotropyMapTransform: { + value: new Gt + } } + ]), + vertexShader: Pe1.meshphysical_vert, + fragmentShader: Pe1.meshphysical_frag +}; +var an1 = { + r: 0, + b: 0, + g: 0 +}, bt1 = new Xt, Yc1 = new D; +function qc1(e, n, t, i, c, s, h) { + let d = new P(0), I = s === !0 ? 0 : 1, T, C, R = null, S = 0, x1 = null; + function O(M) { + let _ = M.isScene === !0 ? M.background : null; + return _ && _.isTexture && (_ = (M.backgroundBlurriness > 0 ? t : n).get(_)), _; + } + function L(M) { + let _ = !1, H = O(M); + H === null ? r(d, I) : H && H.isColor && (r(H, 1), _ = !0); + let P = e.xr.getEnvironmentBlendMode(); + P === "additive" ? i.buffers.color.setClear(0, 0, 0, 1, h) : P === "alpha-blend" && i.buffers.color.setClear(0, 0, 0, 0, h), (e.autoClear || _) && (i.buffers.depth.setTest(!0), i.buffers.depth.setMask(!0), i.buffers.color.setMask(!0), e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil)); + } + function l(M, _) { + let H = O(_); + H && (H.isCubeTexture || H.mapping === Xl) ? (C === void 0 && (C = new Ct(new Ks(1, 1, 1), new qi({ + name: "BackgroundCubeMaterial", + uniforms: An(gt1.backgroundCube.uniforms), + vertexShader: gt1.backgroundCube.vertexShader, + fragmentShader: gt1.backgroundCube.fragmentShader, + side: Al, + depthTest: !1, + depthWrite: !1, + fog: !1 + })), C.geometry.deleteAttribute("normal"), C.geometry.deleteAttribute("uv"), C.onBeforeRender = function(P, y1, B) { + this.matrixWorld.copyPosition(B.matrixWorld); + }, Object.defineProperty(C.material, "envMap", { + get: function() { + return this.uniforms.envMap.value; + } + }), c.update(C)), bt1.copy(_.backgroundRotation), bt1.x *= -1, bt1.y *= -1, bt1.z *= -1, H.isCubeTexture && H.isRenderTargetTexture === !1 && (bt1.y *= -1, bt1.z *= -1), C.material.uniforms.envMap.value = H, C.material.uniforms.flipEnvMap.value = H.isCubeTexture && H.isRenderTargetTexture === !1 ? -1 : 1, C.material.uniforms.backgroundBlurriness.value = _.backgroundBlurriness, C.material.uniforms.backgroundIntensity.value = _.backgroundIntensity, C.material.uniforms.backgroundRotation.value.setFromMatrix4(Yc1.makeRotationFromEuler(bt1)), C.material.toneMapped = Tt.getTransfer(H.colorSpace) !== Fn, (R !== H || S !== H.version || x1 !== e.toneMapping) && (C.material.needsUpdate = !0, R = H, S = H.version, x1 = e.toneMapping), C.layers.enableAll(), M.unshift(C, C.geometry, C.material, 0, 0, null)) : H && H.isTexture && (T === void 0 && (T = new Ct(new Zr(2, 2), new qi({ + name: "BackgroundMaterial", + uniforms: An(gt1.background.uniforms), + vertexShader: gt1.background.vertexShader, + fragmentShader: gt1.background.fragmentShader, + side: dr, + depthTest: !1, + depthWrite: !1, + fog: !1 + })), T.geometry.deleteAttribute("normal"), Object.defineProperty(T.material, "map", { + get: function() { + return this.uniforms.t2D.value; + } + }), c.update(T)), T.material.uniforms.t2D.value = H, T.material.uniforms.backgroundIntensity.value = _.backgroundIntensity, T.material.toneMapped = Tt.getTransfer(H.colorSpace) !== Fn, H.matrixAutoUpdate === !0 && H.updateMatrix(), T.material.uniforms.uvTransform.value.copy(H.matrix), (R !== H || S !== H.version || x1 !== e.toneMapping) && (T.material.needsUpdate = !0, R = H, S = H.version, x1 = e.toneMapping), T.layers.enableAll(), M.unshift(T, T.geometry, T.material, 0, 0, null)); } - static extractUrlBase(e) { - let 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); - } -}, Dc = class extends Ge { - constructor(){ - super(), this.isInstancedBufferGeometry = !0, this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0; - } - copy(e) { - return super.copy(e), this.instanceCount = e.instanceCount, this; - } - toJSON() { - let e = super.toJSON(); - return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e; - } -}, Nc = class extends Dt { - constructor(e){ - super(e); + function r(M, _) { + M.getRGB(an1, Rf(e)), i.buffers.color.setClear(an1.r, an1.g, an1.b, _, h); } - load(e, t, n, i) { - let r = this, a = new rn(r.manager); - a.setPath(r.path), a.setRequestHeader(r.requestHeader), a.setWithCredentials(r.withCredentials), a.load(e, function(o) { - try { - t(r.parse(JSON.parse(o))); - } catch (c) { - i ? i(c) : console.error(c), r.manager.itemError(e); - } - }, n, i); + function w() { + C !== void 0 && (C.geometry.dispose(), C.material.dispose(), C = void 0), T !== void 0 && (T.geometry.dispose(), T.material.dispose(), T = void 0); } - parse(e) { - let t = {}, n = {}; - function i(f, m) { - if (t[m] !== void 0) return t[m]; - let g = f.interleavedBuffers[m], p = r(f, g.buffer), v = ki(g.type, p), x1 = new Is(v, g.stride); - return x1.uuid = g.uuid, t[m] = x1, x1; - } - function r(f, m) { - if (n[m] !== void 0) return n[m]; - let g = f.arrayBuffers[m], p = new Uint32Array(g).buffer; - return n[m] = p, p; - } - let a = e.isInstancedBufferGeometry ? new Dc : new Ge, o = e.data.index; - if (o !== void 0) { - let f = ki(o.type, o.array); - a.setIndex(new et(f, 1)); - } - let c = e.data.attributes; - for(let f in c){ - let m = c[f], _; - if (m.isInterleavedBufferAttribute) { - let g = i(e.data, m.data); - _ = new Qi(g, m.itemSize, m.offset, m.normalized); - } else { - let g = ki(m.type, m.array), p = m.isInstancedBufferAttribute ? ui : et; - _ = new p(g, m.itemSize, m.normalized); - } - m.name !== void 0 && (_.name = m.name), m.usage !== void 0 && _.setUsage(m.usage), m.updateRange !== void 0 && (_.updateRange.offset = m.updateRange.offset, _.updateRange.count = m.updateRange.count), a.setAttribute(f, _); - } - let l = e.data.morphAttributes; - if (l) for(let f in l){ - let m = l[f], _ = []; - for(let g = 0, p = m.length; g < p; g++){ - let v = m[g], x1; - if (v.isInterleavedBufferAttribute) { - let y1 = i(e.data, v.data); - x1 = new Qi(y1, v.itemSize, v.offset, v.normalized); - } else { - let y1 = ki(v.type, v.array); - x1 = new et(y1, v.itemSize, v.normalized); - } - v.name !== void 0 && (x1.name = v.name), _.push(x1); - } - a.morphAttributes[f] = _; - } - e.data.morphTargetsRelative && (a.morphTargetsRelative = !0); - let u = e.data.groups || e.data.drawcalls || e.data.offsets; - if (u !== void 0) for(let f = 0, m = u.length; f !== m; ++f){ - let _ = u[f]; - a.addGroup(_.start, _.count, _.materialIndex); - } - let d = e.data.boundingSphere; - if (d !== void 0) { - let f = new A; - d.center !== void 0 && f.fromArray(d.center), a.boundingSphere = new Yt(f, d.radius); - } - return e.name && (a.name = e.name), e.userData && (a.userData = e.userData), a; + return { + getClearColor: function() { + return d; + }, + setClearColor: function(M, _ = 1) { + d.set(M), I = _, r(d, I); + }, + getClearAlpha: function() { + return I; + }, + setClearAlpha: function(M) { + I = M, r(d, I); + }, + render: L, + addToRenderList: l, + dispose: w + }; +} +function Kc1(e, n) { + let t = e.getParameter(e.MAX_VERTEX_ATTRIBS), i = {}, c = S(null), s = c, h = !1; + function d(f, A, q, V, Y) { + let Q = !1, z = R(V, q, A); + s !== z && (s = z, T(s.object)), Q = x1(f, V, q, Y), Q && O(f, V, q, Y), Y !== null && n.update(Y, e.ELEMENT_ARRAY_BUFFER), (Q || h) && (h = !1, _(f, A, q, V), Y !== null && e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, n.get(Y).buffer)); } -}, pu = class extends Dt { - constructor(e){ - super(e); + function I() { + return e.createVertexArray(); } - load(e, t, n, i) { - let r = this, a = this.path === "" ? ga.extractUrlBase(e) : this.path; - this.resourcePath = this.resourcePath || a; - let o = new rn(this.manager); - o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(c) { - let l = null; - try { - l = JSON.parse(c); - } catch (u) { - i !== void 0 && i(u), console.error("THREE:ObjectLoader: Can't parse " + e + ".", u.message); - return; - } - let h = l.metadata; - if (h === void 0 || h.type === void 0 || h.type.toLowerCase() === "geometry") { - i !== void 0 && i(new Error("THREE.ObjectLoader: Can't load " + e)), console.error("THREE.ObjectLoader: Can't load " + e); - return; - } - r.parse(l, t); - }, n, i); - } - async loadAsync(e, t) { - let n = this, i = this.path === "" ? ga.extractUrlBase(e) : this.path; - this.resourcePath = this.resourcePath || i; - let r = new rn(this.manager); - r.setPath(this.path), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials); - let a = await r.loadAsync(e, t), o = JSON.parse(a), c = o.metadata; - if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry") throw new Error("THREE.ObjectLoader: Can't load " + e); - return await n.parseAsync(o); - } - parse(e, t) { - let n = this.parseAnimations(e.animations), i = this.parseShapes(e.shapes), r = this.parseGeometries(e.geometries, i), a = this.parseImages(e.images, function() { - t !== void 0 && t(l); - }), o = this.parseTextures(e.textures, a), c = this.parseMaterials(e.materials, o), l = this.parseObject(e.object, r, c, o, n), h = this.parseSkeletons(e.skeletons, l); - if (this.bindSkeletons(l, h), t !== void 0) { - let u = !1; - for(let d in a)if (a[d].data instanceof HTMLImageElement) { - u = !0; - break; - } - u === !1 && t(l); - } - return l; + function T(f) { + return e.bindVertexArray(f); } - async parseAsync(e) { - let t = this.parseAnimations(e.animations), n = this.parseShapes(e.shapes), i = this.parseGeometries(e.geometries, n), r = await this.parseImagesAsync(e.images), a = this.parseTextures(e.textures, r), o = this.parseMaterials(e.materials, a), c = this.parseObject(e.object, i, o, a, t), l = this.parseSkeletons(e.skeletons, c); - return this.bindSkeletons(c, l), c; + function C(f) { + return e.deleteVertexArray(f); } - parseShapes(e) { - let t = {}; - if (e !== void 0) for(let n = 0, i = e.length; n < i; n++){ - let r = new Fn().fromJSON(e[n]); - t[r.uuid] = r; - } - return t; + function R(f, A, q) { + let V = q.wireframe === !0, Y = i[f.id]; + Y === void 0 && (Y = {}, i[f.id] = Y); + let Q = Y[A.id]; + Q === void 0 && (Q = {}, Y[A.id] = Q); + let z = Q[V]; + return z === void 0 && (z = S(I()), Q[V] = z), z; } - parseSkeletons(e, t) { - let n = {}, i = {}; - if (t.traverse(function(r) { - r.isBone && (i[r.uuid] = r); - }), e !== void 0) for(let r = 0, a = e.length; r < a; r++){ - let o = new Oo().fromJSON(e[r], i); - n[o.uuid] = o; - } - return n; + function S(f) { + let A = [], q = [], V = []; + for(let Y = 0; Y < t; Y++)A[Y] = 0, q[Y] = 0, V[Y] = 0; + return { + geometry: null, + program: null, + wireframe: !1, + newAttributes: A, + enabledAttributes: q, + attributeDivisors: V, + object: f, + attributes: {}, + index: null + }; } - parseGeometries(e, t) { - let n = {}; - if (e !== void 0) { - let i = new Nc; - for(let r = 0, a = e.length; r < a; r++){ - let o, c = e[r]; - switch(c.type){ - case "BufferGeometry": - case "InstancedBufferGeometry": - o = i.parse(c); - break; - default: - c.type in ru ? o = ru[c.type].fromJSON(c, t) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`); - } - o.uuid = c.uuid, c.name !== void 0 && (o.name = c.name), c.userData !== void 0 && (o.userData = c.userData), n[c.uuid] = o; - } + function x1(f, A, q, V) { + let Y = s.attributes, Q = A.attributes, z = 0, j = q.getAttributes(); + for(let F in j)if (j[F].location >= 0) { + let Me = Y[F], Le = Q[F]; + if (Le === void 0 && (F === "instanceMatrix" && f.instanceMatrix && (Le = f.instanceMatrix), F === "instanceColor" && f.instanceColor && (Le = f.instanceColor)), Me === void 0 || Me.attribute !== Le || Le && Me.data !== Le.data) return !0; + z++; } - return n; + return s.attributesNum !== z || s.index !== V; } - parseMaterials(e, t) { - let n = {}, i = {}; - if (e !== void 0) { - let r = new Uc; - r.setTextures(t); - for(let a = 0, o = e.length; a < o; a++){ - let c = e[a]; - n[c.uuid] === void 0 && (n[c.uuid] = r.parse(c)), i[c.uuid] = n[c.uuid]; - } + function O(f, A, q, V) { + let Y = {}, Q = A.attributes, z = 0, j = q.getAttributes(); + for(let F in j)if (j[F].location >= 0) { + let Me = Q[F]; + Me === void 0 && (F === "instanceMatrix" && f.instanceMatrix && (Me = f.instanceMatrix), F === "instanceColor" && f.instanceColor && (Me = f.instanceColor)); + let Le = {}; + Le.attribute = Me, Me && Me.data && (Le.data = Me.data), Y[F] = Le, z++; } - return i; + s.attributes = Y, s.attributesNum = z, s.index = V; } - parseAnimations(e) { - let t = {}; - if (e !== void 0) for(let n = 0; n < e.length; n++){ - let i = e[n], r = is.parse(i); - t[r.uuid] = r; - } - return t; + function L() { + let f = s.newAttributes; + for(let A = 0, q = f.length; A < q; A++)f[A] = 0; } - parseImages(e, t) { - let n = this, i = {}, r; - function a(c) { - return n.manager.itemStart(c), r.load(c, function() { - n.manager.itemEnd(c); - }, void 0, function() { - n.manager.itemError(c), n.manager.itemEnd(c); - }); - } - function o(c) { - if (typeof c == "string") { - let l = c, h = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : n.resourcePath + l; - return a(h); - } else return c.data ? { - data: ki(c.type, c.data), - width: c.width, - height: c.height - } : null; - } - if (e !== void 0 && e.length > 0) { - let c = new ma(t); - r = new rs(c), r.setCrossOrigin(this.crossOrigin); - for(let l = 0, h = e.length; l < h; l++){ - let u = e[l], d = u.url; - if (Array.isArray(d)) { - let f = []; - for(let m = 0, _ = d.length; m < _; m++){ - let g = d[m], p = o(g); - p !== null && (p instanceof HTMLImageElement ? f.push(p) : f.push(new oi(p.data, p.width, p.height))); + function l(f) { + r(f, 0); + } + function r(f, A) { + let q = s.newAttributes, V = s.enabledAttributes, Y = s.attributeDivisors; + q[f] = 1, V[f] === 0 && (e.enableVertexAttribArray(f), V[f] = 1), Y[f] !== A && (e.vertexAttribDivisor(f, A), Y[f] = A); + } + function w() { + let f = s.newAttributes, A = s.enabledAttributes; + for(let q = 0, V = A.length; q < V; q++)A[q] !== f[q] && (e.disableVertexAttribArray(q), A[q] = 0); + } + function M(f, A, q, V, Y, Q, z) { + z === !0 ? e.vertexAttribIPointer(f, A, q, Y, Q) : e.vertexAttribPointer(f, A, q, V, Y, Q); + } + function _(f, A, q, V) { + L(); + let Y = V.attributes, Q = q.getAttributes(), z = A.defaultAttributeValues; + for(let j in Q){ + let F = Q[j]; + if (F.location >= 0) { + let me = Y[j]; + if (me === void 0 && (j === "instanceMatrix" && f.instanceMatrix && (me = f.instanceMatrix), j === "instanceColor" && f.instanceColor && (me = f.instanceColor)), me !== void 0) { + let Me = me.normalized, Le = me.itemSize, Ge = n.get(me); + if (Ge === void 0) continue; + let Ze = Ge.buffer, k = Ge.type, J = Ge.bytesPerElement, ue = k === e.INT || k === e.UNSIGNED_INT || me.gpuType === Kl; + if (me.isInterleavedBufferAttribute) { + let ie = me.data, Ee = ie.stride, Be = me.offset; + if (ie.isInstancedInterleavedBuffer) { + for(let Te = 0; Te < F.locationSize; Te++)r(F.location + Te, ie.meshPerAttribute); + f.isInstancedMesh !== !0 && V._maxInstanceCount === void 0 && (V._maxInstanceCount = ie.meshPerAttribute * ie.count); + } else for(let Te = 0; Te < F.locationSize; Te++)l(F.location + Te); + e.bindBuffer(e.ARRAY_BUFFER, Ze); + for(let Te = 0; Te < F.locationSize; Te++)M(F.location + Te, Le / F.locationSize, k, Me, Ee * J, (Be + Le / F.locationSize * Te) * J, ue); + } else { + if (me.isInstancedBufferAttribute) { + for(let ie = 0; ie < F.locationSize; ie++)r(F.location + ie, me.meshPerAttribute); + f.isInstancedMesh !== !0 && V._maxInstanceCount === void 0 && (V._maxInstanceCount = me.meshPerAttribute * me.count); + } else for(let ie = 0; ie < F.locationSize; ie++)l(F.location + ie); + e.bindBuffer(e.ARRAY_BUFFER, Ze); + for(let ie = 0; ie < F.locationSize; ie++)M(F.location + ie, Le / F.locationSize, k, Me, Le * J, Le / F.locationSize * ie * J, ue); + } + } else if (z !== void 0) { + let Me = z[j]; + if (Me !== void 0) switch(Me.length){ + case 2: + e.vertexAttrib2fv(F.location, Me); + break; + case 3: + e.vertexAttrib3fv(F.location, Me); + break; + case 4: + e.vertexAttrib4fv(F.location, Me); + break; + default: + e.vertexAttrib1fv(F.location, Me); } - i[u.uuid] = new In(f); - } else { - let f = o(u.url); - i[u.uuid] = new In(f); } } } - return i; + w(); } - async parseImagesAsync(e) { - let t = this, n = {}, i; - async function r(a) { - if (typeof a == "string") { - let o = a, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(o) ? o : t.resourcePath + o; - return await i.loadAsync(c); - } else return a.data ? { - data: ki(a.type, a.data), - width: a.width, - height: a.height - } : null; - } - if (e !== void 0 && e.length > 0) { - i = new rs(this.manager), i.setCrossOrigin(this.crossOrigin); - for(let a = 0, o = e.length; a < o; a++){ - let c = e[a], l = c.url; - if (Array.isArray(l)) { - let h = []; - for(let u = 0, d = l.length; u < d; u++){ - let f = l[u], m = await r(f); - m !== null && (m instanceof HTMLImageElement ? h.push(m) : h.push(new oi(m.data, m.width, m.height))); - } - n[c.uuid] = new In(h); - } else { - let h = await r(c.url); - n[c.uuid] = new In(h); - } + function H() { + B(); + for(let f in i){ + let A = i[f]; + for(let q in A){ + let V = A[q]; + for(let Y in V)C(V[Y].object), delete V[Y]; + delete A[q]; } + delete i[f]; } - return n; } - parseTextures(e, t) { - function n(r, a) { - return typeof r == "number" ? r : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", r), a[r]); - } - let i = {}; - if (e !== void 0) for(let r = 0, a = e.length; r < a; r++){ - let o = e[r]; - o.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', o.uuid), t[o.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", o.image); - let c = t[o.image], l = c.data, h; - Array.isArray(l) ? (h = new Ki, l.length === 6 && (h.needsUpdate = !0)) : (l && l.data ? h = new oi : h = new St, l && (h.needsUpdate = !0)), h.source = c, h.uuid = o.uuid, o.name !== void 0 && (h.name = o.name), o.mapping !== void 0 && (h.mapping = n(o.mapping, Tx)), o.channel !== void 0 && (h.channel = o.channel), o.offset !== void 0 && h.offset.fromArray(o.offset), o.repeat !== void 0 && h.repeat.fromArray(o.repeat), o.center !== void 0 && h.center.fromArray(o.center), o.rotation !== void 0 && (h.rotation = o.rotation), o.wrap !== void 0 && (h.wrapS = n(o.wrap[0], mu), h.wrapT = n(o.wrap[1], mu)), o.format !== void 0 && (h.format = o.format), o.internalFormat !== void 0 && (h.internalFormat = o.internalFormat), o.type !== void 0 && (h.type = o.type), o.colorSpace !== void 0 && (h.colorSpace = o.colorSpace), o.encoding !== void 0 && (h.encoding = o.encoding), o.minFilter !== void 0 && (h.minFilter = n(o.minFilter, gu)), o.magFilter !== void 0 && (h.magFilter = n(o.magFilter, gu)), o.anisotropy !== void 0 && (h.anisotropy = o.anisotropy), o.flipY !== void 0 && (h.flipY = o.flipY), o.generateMipmaps !== void 0 && (h.generateMipmaps = o.generateMipmaps), o.premultiplyAlpha !== void 0 && (h.premultiplyAlpha = o.premultiplyAlpha), o.unpackAlignment !== void 0 && (h.unpackAlignment = o.unpackAlignment), o.compareFunction !== void 0 && (h.compareFunction = o.compareFunction), o.userData !== void 0 && (h.userData = o.userData), i[o.uuid] = h; + function P(f) { + if (i[f.id] === void 0) return; + let A = i[f.id]; + for(let q in A){ + let V = A[q]; + for(let Y in V)C(V[Y].object), delete V[Y]; + delete A[q]; } - return i; + delete i[f.id]; } - parseObject(e, t, n, i, r) { - let a; - function o(d) { - return t[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined geometry", d), t[d]; - } - function c(d) { - if (d !== void 0) { - if (Array.isArray(d)) { - let f = []; - for(let m = 0, _ = d.length; m < _; m++){ - let g = d[m]; - n[g] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", g), f.push(n[g]); - } - return f; - } - return n[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", d), n[d]; - } - } - function l(d) { - return i[d] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", d), i[d]; - } - let h, u; - switch(e.type){ - case "Scene": - a = new Io, e.background !== void 0 && (Number.isInteger(e.background) ? a.background = new pe(e.background) : a.background = l(e.background)), e.environment !== void 0 && (a.environment = l(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? a.fog = new Lo(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (a.fog = new Po(e.fog.color, e.fog.density)), e.fog.name !== "" && (a.fog.name = e.fog.name)), e.backgroundBlurriness !== void 0 && (a.backgroundBlurriness = e.backgroundBlurriness), e.backgroundIntensity !== void 0 && (a.backgroundIntensity = e.backgroundIntensity); - break; - case "PerspectiveCamera": - a = new yt(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (a.focus = e.focus), e.zoom !== void 0 && (a.zoom = e.zoom), e.filmGauge !== void 0 && (a.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (a.filmOffset = e.filmOffset), e.view !== void 0 && (a.view = Object.assign({}, e.view)); - break; - case "OrthographicCamera": - a = new Ls(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (a.zoom = e.zoom), e.view !== void 0 && (a.view = Object.assign({}, e.view)); - break; - case "AmbientLight": - a = new Cc(e.color, e.intensity); - break; - case "DirectionalLight": - a = new Rc(e.color, e.intensity); - break; - case "PointLight": - a = new wc(e.color, e.intensity, e.distance, e.decay); - break; - case "RectAreaLight": - a = new Pc(e.color, e.intensity, e.width, e.height); - break; - case "SpotLight": - a = new Ec(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay); - break; - case "HemisphereLight": - a = new Sc(e.color, e.groundColor, e.intensity); - break; - case "LightProbe": - a = new Ic().fromJSON(e); - break; - case "SkinnedMesh": - h = o(e.geometry), u = c(e.material), a = new No(h, u), e.bindMode !== void 0 && (a.bindMode = e.bindMode), e.bindMatrix !== void 0 && a.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (a.skeleton = e.skeleton); - break; - case "Mesh": - h = o(e.geometry), u = c(e.material), a = new Mt(h, u); - break; - case "InstancedMesh": - h = o(e.geometry), u = c(e.material); - let d = e.count, f = e.instanceMatrix, m = e.instanceColor; - a = new Fo(h, u, d), a.instanceMatrix = new ui(new Float32Array(f.array), 16), m !== void 0 && (a.instanceColor = new ui(new Float32Array(m.array), m.itemSize)); - break; - case "LOD": - a = new Do; - break; - case "Line": - a = new bn(o(e.geometry), c(e.material)); - break; - case "LineLoop": - a = new Bo(o(e.geometry), c(e.material)); - break; - case "LineSegments": - a = new en(o(e.geometry), c(e.material)); - break; - case "PointCloud": - case "Points": - a = new Vo(o(e.geometry), c(e.material)); - break; - case "Sprite": - a = new Uo(c(e.material)); - break; - case "Group": - a = new ti; - break; - case "Bone": - a = new ta; - break; - default: - a = new Je; - } - if (a.uuid = e.uuid, e.name !== void 0 && (a.name = e.name), e.matrix !== void 0 ? (a.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (a.matrixAutoUpdate = e.matrixAutoUpdate), a.matrixAutoUpdate && a.matrix.decompose(a.position, a.quaternion, a.scale)) : (e.position !== void 0 && a.position.fromArray(e.position), e.rotation !== void 0 && a.rotation.fromArray(e.rotation), e.quaternion !== void 0 && a.quaternion.fromArray(e.quaternion), e.scale !== void 0 && a.scale.fromArray(e.scale)), e.up !== void 0 && a.up.fromArray(e.up), e.castShadow !== void 0 && (a.castShadow = e.castShadow), e.receiveShadow !== void 0 && (a.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.bias !== void 0 && (a.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (a.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (a.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && a.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (a.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (a.visible = e.visible), e.frustumCulled !== void 0 && (a.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (a.renderOrder = e.renderOrder), e.userData !== void 0 && (a.userData = e.userData), e.layers !== void 0 && (a.layers.mask = e.layers), e.children !== void 0) { - let d = e.children; - for(let f = 0; f < d.length; f++)a.add(this.parseObject(d[f], t, n, i, r)); - } - if (e.animations !== void 0) { - let d = e.animations; - for(let f = 0; f < d.length; f++){ - let m = d[f]; - a.animations.push(r[m]); - } + function y1(f) { + for(let A in i){ + let q = i[A]; + if (q[f.id] === void 0) continue; + let V = q[f.id]; + for(let Y in V)C(V[Y].object), delete V[Y]; + delete q[f.id]; } - if (e.type === "LOD") { - e.autoUpdate !== void 0 && (a.autoUpdate = e.autoUpdate); - let d = e.levels; - for(let f = 0; f < d.length; f++){ - let m = d[f], _ = a.getObjectByProperty("uuid", m.object); - _ !== void 0 && a.addLevel(_, m.distance, m.hysteresis); - } - } - return a; - } - bindSkeletons(e, t) { - Object.keys(t).length !== 0 && e.traverse(function(n) { - if (n.isSkinnedMesh === !0 && n.skeleton !== void 0) { - let i = t[n.skeleton]; - i === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", n.skeleton) : n.bind(i, n.bindMatrix); - } - }); } -}, Tx = { - UVMapping: Gc, - CubeReflectionMapping: zn, - CubeRefractionMapping: ci, - EquirectangularReflectionMapping: Ir, - EquirectangularRefractionMapping: Ur, - CubeUVReflectionMapping: Vs -}, mu = { - RepeatWrapping: Dr, - ClampToEdgeWrapping: It, - MirroredRepeatWrapping: Nr -}, gu = { - NearestFilter: pt, - NearestMipmapNearestFilter: fo, - NearestMipmapLinearFilter: Lr, - LinearFilter: mt, - LinearMipmapNearestFilter: ud, - LinearMipmapLinearFilter: li -}, _u = class extends Dt { - 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" - }; + function B() { + p(), h = !0, s !== c && (s = c, T(s.object)); } - setOptions(e) { - return this.options = e, this; + function p() { + c.geometry = null, c.program = null, c.wireframe = !1; } - load(e, t, n, i) { - e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); - let r = this, a = ss.get(e); - if (a !== void 0) return r.manager.itemStart(e), setTimeout(function() { - t && t(a), r.manager.itemEnd(e); - }, 0), a; - let o = {}; - o.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", o.headers = this.requestHeader, fetch(e, o).then(function(c) { - return c.blob(); - }).then(function(c) { - return createImageBitmap(c, Object.assign(r.options, { - colorSpaceConversion: "none" - })); - }).then(function(c) { - ss.add(e, c), t && t(c), r.manager.itemEnd(e); - }).catch(function(c) { - i && i(c), r.manager.itemError(e), r.manager.itemEnd(e); - }), r.manager.itemStart(e); + return { + setup: d, + reset: B, + resetDefaultState: p, + dispose: H, + releaseStatesOfGeometry: P, + releaseStatesOfProgram: y1, + initAttributes: L, + enableAttribute: l, + disableUnusedAttributes: w + }; +} +function $c1(e, n, t) { + let i; + function c(T) { + i = T; } -}, Er, _a = class { - static getContext() { - return Er === void 0 && (Er = new (window.AudioContext || window.webkitAudioContext)), Er; + function s(T, C) { + e.drawArrays(i, T, C), t.update(C, i, 1); } - static setContext(e) { - Er = e; + function h(T, C, R) { + R !== 0 && (e.drawArraysInstanced(i, T, C, R), t.update(C, i, R)); } -}, xu = class extends Dt { - constructor(e){ - super(e); + function d(T, C, R) { + if (R === 0) return; + n.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i, T, 0, C, 0, R); + let x1 = 0; + for(let O = 0; O < R; O++)x1 += C[O]; + t.update(x1, i, 1); } - load(e, t, n, i) { - let r = this, a = new rn(this.manager); - a.setResponseType("arraybuffer"), a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) { - try { - let l = c.slice(0); - _a.getContext().decodeAudioData(l, function(u) { - t(u); - }, o); - } catch (l) { - o(l); - } - }, n, i); - function o(c) { - i ? i(c) : console.error(c), r.manager.itemError(e); + function I(T, C, R, S) { + if (R === 0) return; + let x1 = n.get("WEBGL_multi_draw"); + if (x1 === null) for(let O = 0; O < T.length; O++)h(T[O], C[O], S[O]); + else { + x1.multiDrawArraysInstancedWEBGL(i, T, 0, C, 0, S, 0, R); + let O = 0; + for(let L = 0; L < R; L++)O += C[L] * S[L]; + t.update(O, i, 1); } } -}, vu = new ze, yu = new ze, Zn = new ze, Mu = class { - constructor(){ - this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new yt, this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new yt, this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = { - focus: null, - fov: null, - aspect: null, - near: null, - far: null, - zoom: null, - eyeSep: null - }; - } - update(e) { - let t = this._cache; - if (t.focus !== e.focus || t.fov !== e.fov || t.aspect !== e.aspect * this.aspect || t.near !== e.near || t.far !== e.far || t.zoom !== e.zoom || t.eyeSep !== this.eyeSep) { - t.focus = e.focus, t.fov = e.fov, t.aspect = e.aspect * this.aspect, t.near = e.near, t.far = e.far, t.zoom = e.zoom, t.eyeSep = this.eyeSep, Zn.copy(e.projectionMatrix); - let i = t.eyeSep / 2, r = i * t.near / t.focus, a = t.near * Math.tan(ai * t.fov * .5) / t.zoom, o, c; - yu.elements[12] = -i, vu.elements[12] = i, o = -a * t.aspect + r, c = a * t.aspect + r, Zn.elements[0] = 2 * t.near / (c - o), Zn.elements[8] = (c + o) / (c - o), this.cameraL.projectionMatrix.copy(Zn), o = -a * t.aspect - r, c = a * t.aspect - r, Zn.elements[0] = 2 * t.near / (c - o), Zn.elements[8] = (c + o) / (c - o), this.cameraR.projectionMatrix.copy(Zn); + this.setMode = c, this.render = s, this.renderInstances = h, this.renderMultiDraw = d, this.renderMultiDrawInstances = I; +} +function Zc1(e, n, t, i) { + let c; + function s() { + if (c !== void 0) return c; + if (n.has("EXT_texture_filter_anisotropic") === !0) { + let y1 = n.get("EXT_texture_filter_anisotropic"); + c = e.getParameter(y1.MAX_TEXTURE_MAX_ANISOTROPY_EXT); + } else c = 0; + return c; + } + function h(y1) { + return !(y1 !== Li && i.convert(y1) !== e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)); + } + function d(y1) { + let B = y1 === tc && (n.has("EXT_color_buffer_half_float") || n.has("EXT_color_buffer_float")); + return !(y1 !== Sl && i.convert(y1) !== e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE) && y1 !== pi && !B); + } + function I(y1) { + if (y1 === "highp") { + if (e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.HIGH_FLOAT).precision > 0 && e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.HIGH_FLOAT).precision > 0) return "highp"; + y1 = "mediump"; + } + return y1 === "mediump" && e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.MEDIUM_FLOAT).precision > 0 && e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.MEDIUM_FLOAT).precision > 0 ? "mediump" : "lowp"; + } + let T = t.precision !== void 0 ? t.precision : "highp", C = I(T); + C !== T && (console.warn("THREE.WebGLRenderer:", T, "not supported, using", C, "instead."), T = C); + let R = t.logarithmicDepthBuffer === !0, S = t.reverseDepthBuffer === !0 && n.has("EXT_clip_control"), x1 = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS), O = e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS), L = e.getParameter(e.MAX_TEXTURE_SIZE), l = e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE), r = e.getParameter(e.MAX_VERTEX_ATTRIBS), w = e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS), M = e.getParameter(e.MAX_VARYING_VECTORS), _ = e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS), H = O > 0, P = e.getParameter(e.MAX_SAMPLES); + return { + isWebGL2: !0, + getMaxAnisotropy: s, + getMaxPrecision: I, + textureFormatReadable: h, + textureTypeReadable: d, + precision: T, + logarithmicDepthBuffer: R, + reverseDepthBuffer: S, + maxTextures: x1, + maxVertexTextures: O, + maxTextureSize: L, + maxCubemapSize: l, + maxAttributes: r, + maxVertexUniforms: w, + maxVaryings: M, + maxFragmentUniforms: _, + vertexTextures: H, + maxSamples: P + }; +} +function Qc1(e) { + let n = this, t = null, i = 0, c = !1, s = !1, h = new xe, d = new Gt, I = { + value: null, + needsUpdate: !1 + }; + this.uniform = I, this.numPlanes = 0, this.numIntersection = 0, this.init = function(R, S) { + let x1 = R.length !== 0 || S || i !== 0 || c; + return c = S, i = R.length, x1; + }, this.beginShadows = function() { + s = !0, C(null); + }, this.endShadows = function() { + s = !1; + }, this.setGlobalState = function(R, S) { + t = C(R, S, 0); + }, this.setState = function(R, S, x1) { + let O = R.clippingPlanes, L = R.clipIntersection, l = R.clipShadows, r = e.get(R); + if (!c || O === null || O.length === 0 || s && !l) s ? C(null) : T(); + else { + let w = s ? 0 : i, M = w * 4, _ = r.clippingState || null; + I.value = _, _ = C(O, S, M, x1); + for(let H = 0; H !== M; ++H)_[H] = t[H]; + r.clippingState = _, this.numIntersection = L ? this.numPlanes : 0, this.numPlanes += w; } - this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yu), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(vu); - } -}, Oc = class { - constructor(e = !0){ - this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1; - } - start() { - this.startTime = Su(), 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; + }; + function T() { + I.value !== t && (I.value = t, I.needsUpdate = i > 0), n.numPlanes = i, n.numIntersection = 0; } - getDelta() { - let e = 0; - if (this.autoStart && !this.running) return this.start(), 0; - if (this.running) { - let t = Su(); - e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e; + function C(R, S, x1, O) { + let L = R !== null ? R.length : 0, l = null; + if (L !== 0) { + if (l = I.value, O !== !0 || l === null) { + let r = x1 + L * 4, w = S.matrixWorldInverse; + d.getNormalMatrix(w), (l === null || l.length < r) && (l = new Float32Array(r)); + for(let M = 0, _ = x1; M !== L; ++M, _ += 4)h.copy(R[M]).applyMatrix4(w, d), h.normal.toArray(l, _), l[_ + 3] = h.constant; + } + I.value = l, I.needsUpdate = !0; } - return e; + return n.numPlanes = L, n.numIntersection = 0, l; } -}; -function Su() { - return (typeof performance > "u" ? Date : performance).now(); } -var Jn = new A, bu = new Ut, wx = new A, $n = new A, Eu = class extends Je { - constructor(){ - super(), this.type = "AudioListener", this.context = _a.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new Oc; - } - getInput() { - return this.gain; - } - removeFilter() { - return this.filter !== null && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this; - } - getFilter() { - return this.filter; - } - setFilter(e) { - return this.filter !== null ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = e, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this; +function Jc1(e) { + let n = new WeakMap; + function t(h, d) { + return d === ql ? h.mapping = Uo : d === Gl && (h.mapping = Hl), h; } - getMasterVolume() { - return this.gain.gain.value; - } - setMasterVolume(e) { - return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01), this; - } - updateMatrixWorld(e) { - super.updateMatrixWorld(e); - let t = this.context.listener, n = this.up; - if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(Jn, bu, wx), $n.set(0, 0, -1).applyQuaternion(bu), t.positionX) { - let i = this.context.currentTime + this.timeDelta; - t.positionX.linearRampToValueAtTime(Jn.x, i), t.positionY.linearRampToValueAtTime(Jn.y, i), t.positionZ.linearRampToValueAtTime(Jn.z, i), t.forwardX.linearRampToValueAtTime($n.x, i), t.forwardY.linearRampToValueAtTime($n.y, i), t.forwardZ.linearRampToValueAtTime($n.z, i), t.upX.linearRampToValueAtTime(n.x, i), t.upY.linearRampToValueAtTime(n.y, i), t.upZ.linearRampToValueAtTime(n.z, i); - } else t.setPosition(Jn.x, Jn.y, Jn.z), t.setOrientation($n.x, $n.y, $n.z, n.x, n.y, n.z); - } -}, Fc = class extends Je { - constructor(e){ - super(), this.type = "Audio", this.listener = e, this.context = e.context, this.gain = this.context.createGain(), this.gain.connect(e.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = !1, this.filters = []; - } - getOutput() { - return this.gain; - } - setNodeSource(e) { - return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = e, this.connect(), this; - } - setMediaElementSource(e) { - return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this; - } - setMediaStreamSource(e) { - return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(e), this.connect(), this; - } - setBuffer(e) { - return this.buffer = e, this.sourceType = "buffer", this.autoplay && this.play(), this; - } - play(e = 0) { - if (this.isPlaying === !0) { - console.warn("THREE.Audio: Audio is already playing."); - return; - } - if (this.hasPlaybackControl === !1) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; + function i(h) { + if (h && h.isTexture) { + let d = h.mapping; + if (d === ql || d === Gl) if (n.has(h)) { + let I = n.get(h).texture; + return t(I, h.mapping); + } else { + let I = h.image; + if (I && I.height > 0) { + let T = new Na(I.height); + return T.fromEquirectangularTexture(e, h), n.set(h, T), h.addEventListener("dispose", c), t(T.texture, h.mapping); + } else return null; + } } - this._startedAt = this.context.currentTime + e; - let t = this.context.createBufferSource(); - return t.buffer = this.buffer, t.loop = this.loop, t.loopStart = this.loopStart, t.loopEnd = this.loopEnd, t.onended = this.onEnded.bind(this), t.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = t, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect(); + return h; } - pause() { - if (this.hasPlaybackControl === !1) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - return this.isPlaying === !0 && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === !0 && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this; + function c(h) { + let d = h.target; + d.removeEventListener("dispose", c); + let I = n.get(d); + I !== void 0 && (n.delete(d), I.dispose()); } - stop() { - if (this.hasPlaybackControl === !1) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - return this._progress = 0, this.source !== null && (this.source.stop(), this.source.onended = null), this.isPlaying = !1, this; + function s() { + n = new WeakMap; } - connect() { - if (this.filters.length > 0) { - this.source.connect(this.filters[0]); - for(let e = 1, t = this.filters.length; e < t; e++)this.filters[e - 1].connect(this.filters[e]); - this.filters[this.filters.length - 1].connect(this.getOutput()); - } else this.source.connect(this.getOutput()); - return this._connected = !0, this; + return { + get: i, + dispose: s + }; +} +var Ht1 = 4, Gi1 = [ + .125, + .215, + .35, + .446, + .526, + .582 +], Ut1 = 20, Pn1 = new wn, Hi1 = new P, Ln1 = null, Un1 = 0, Dn1 = 0, wn1 = !1, Lt1 = (1 + Math.sqrt(5)) / 2, Ot = 1 / Lt1, Vi1 = [ + new w(-Lt1, Ot, 0), + new w(Lt1, Ot, 0), + new w(-Ot, 0, Lt1), + new w(Ot, 0, Lt1), + new w(0, Lt1, -Ot), + new w(0, Lt1, Ot), + new w(-1, 1, -1), + new w(1, 1, -1), + new w(-1, 1, 1), + new w(1, 1, 1) +], hn1 = class { + constructor(n){ + this._renderer = n, 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(n, t = 0, i = .1, c = 100) { + Ln1 = this._renderer.getRenderTarget(), Un1 = this._renderer.getActiveCubeFace(), Dn1 = this._renderer.getActiveMipmapLevel(), wn1 = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(256); + let s = this._allocateTargets(); + return s.depthBuffer = !0, this._sceneToCubeUV(n, i, c, s), t > 0 && this._blur(s, 0, 0, t), this._applyPMREM(s), this._cleanup(s), s; + } + fromEquirectangular(n, t = null) { + return this._fromTexture(n, t); + } + fromCubemap(n, t = null) { + return this._fromTexture(n, t); } - disconnect() { - if (this._connected !== !1) { - if (this.filters.length > 0) { - this.source.disconnect(this.filters[0]); - for(let e = 1, t = this.filters.length; e < t; e++)this.filters[e - 1].disconnect(this.filters[e]); - this.filters[this.filters.length - 1].disconnect(this.getOutput()); - } else this.source.disconnect(this.getOutput()); - return this._connected = !1, this; - } + compileCubemapShader() { + this._cubemapMaterial === null && (this._cubemapMaterial = Wi1(), this._compileMaterial(this._cubemapMaterial)); } - getFilters() { - return this.filters; + compileEquirectangularShader() { + this._equirectMaterial === null && (this._equirectMaterial = zi1(), this._compileMaterial(this._equirectMaterial)); } - setFilters(e) { - return e || (e = []), this._connected === !0 ? (this.disconnect(), this.filters = e.slice(), this.connect()) : this.filters = e.slice(), this; + dispose() { + this._dispose(), this._cubemapMaterial !== null && this._cubemapMaterial.dispose(), this._equirectMaterial !== null && this._equirectMaterial.dispose(); } - setDetune(e) { - if (this.detune = e, this.source.detune !== void 0) return this.isPlaying === !0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01), this; + _setSize(n) { + this._lodMax = Math.floor(Math.log2(n)), this._cubeSize = Math.pow(2, this._lodMax); } - getDetune() { - return this.detune; + _dispose() { + this._blurMaterial !== null && this._blurMaterial.dispose(), this._pingPongRenderTarget !== null && this._pingPongRenderTarget.dispose(); + for(let n = 0; n < this._lodPlanes.length; n++)this._lodPlanes[n].dispose(); } - getFilter() { - return this.getFilters()[0]; + _cleanup(n) { + this._renderer.setRenderTarget(Ln1, Un1, Dn1), this._renderer.xr.enabled = wn1, n.scissorTest = !1, on1(n, 0, 0, n.width, n.height); } - setFilter(e) { - return this.setFilters(e ? [ - e - ] : []); + _fromTexture(n, t) { + n.mapping === Uo || n.mapping === Hl ? this._setSize(n.image.length === 0 ? 16 : n.image[0].width || n.image[0].image.width) : this._setSize(n.image.width / 4), Ln1 = this._renderer.getRenderTarget(), Un1 = this._renderer.getActiveCubeFace(), Dn1 = this._renderer.getActiveMipmapLevel(), wn1 = this._renderer.xr.enabled, this._renderer.xr.enabled = !1; + let i = t || this._allocateTargets(); + return this._textureToCubeUV(n, i), this._applyPMREM(i), this._cleanup(i), i; } - setPlaybackRate(e) { - if (this.hasPlaybackControl === !1) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; + _allocateTargets() { + let n = 3 * Math.max(this._cubeSize, 112), t = 4 * this._cubeSize, i = { + magFilter: Et, + minFilter: Et, + generateMipmaps: !1, + type: tc, + format: Li, + colorSpace: ha, + depthBuffer: !1 + }, c = ki1(n, t, i); + if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== n || this._pingPongRenderTarget.height !== t) { + this._pingPongRenderTarget !== null && this._dispose(), this._pingPongRenderTarget = ki1(n, t, i); + let { _lodMax: s } = this; + ({ sizeLods: this._sizeLods , lodPlanes: this._lodPlanes , sigmas: this._sigmas } = jc1(s)), this._blurMaterial = el1(s, n, t); } - return this.playbackRate = e, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01), this; + return c; } - getPlaybackRate() { - return this.playbackRate; + _compileMaterial(n) { + let t = new Ct(this._lodPlanes[0], n); + this._renderer.compile(t, Pn1); } - onEnded() { - this.isPlaying = !1; + _sceneToCubeUV(n, t, i, c) { + let d = new vt(90, 1, t, i), I = [ + 1, + -1, + 1, + 1, + 1, + 1 + ], T = [ + 1, + 1, + 1, + -1, + -1, + -1 + ], C = this._renderer, R = C.autoClear, S = C.toneMapping; + C.getClearColor(Hi1), C.toneMapping = Tp, C.autoClear = !1; + let x1 = new _e({ + name: "PMREM.Background", + side: Al, + depthWrite: !1, + depthTest: !1 + }), O = new Ct(new Ks, x1), L = !1, l = n.background; + l ? l.isColor && (x1.color.copy(l), n.background = null, L = !0) : (x1.color.copy(Hi1), L = !0); + for(let r = 0; r < 6; r++){ + let w = r % 3; + w === 0 ? (d.up.set(0, I[r], 0), d.lookAt(T[r], 0, 0)) : w === 1 ? (d.up.set(0, 0, I[r]), d.lookAt(0, T[r], 0)) : (d.up.set(0, I[r], 0), d.lookAt(0, 0, T[r])); + let M = this._cubeSize; + on1(c, w * M, r > 2 ? M : 0, M, M), C.setRenderTarget(c), L && C.render(O, d), C.render(n, d); + } + O.geometry.dispose(), O.material.dispose(), C.toneMapping = S, C.autoClear = R, n.background = l; + } + _textureToCubeUV(n, t) { + let i = this._renderer, c = n.mapping === Uo || n.mapping === Hl; + c ? (this._cubemapMaterial === null && (this._cubemapMaterial = Wi1()), this._cubemapMaterial.uniforms.flipEnvMap.value = n.isRenderTargetTexture === !1 ? -1 : 1) : this._equirectMaterial === null && (this._equirectMaterial = zi1()); + let s = c ? this._cubemapMaterial : this._equirectMaterial, h = new Ct(this._lodPlanes[0], s), d = s.uniforms; + d.envMap.value = n; + let I = this._cubeSize; + on1(t, 0, 0, 3 * I, 2 * I), i.setRenderTarget(t), i.render(h, Pn1); + } + _applyPMREM(n) { + let t = this._renderer, i = t.autoClear; + t.autoClear = !1; + let c = this._lodPlanes.length; + for(let s = 1; s < c; s++){ + let h = Math.sqrt(this._sigmas[s] * this._sigmas[s] - this._sigmas[s - 1] * this._sigmas[s - 1]), d = Vi1[(c - s - 1) % Vi1.length]; + this._blur(n, s - 1, s, h, d); + } + t.autoClear = i; + } + _blur(n, t, i, c, s) { + let h = this._pingPongRenderTarget; + this._halfBlur(n, h, t, i, c, "latitudinal", s), this._halfBlur(h, n, i, i, c, "longitudinal", s); + } + _halfBlur(n, t, i, c, s, h, d) { + let I = this._renderer, T = this._blurMaterial; + h !== "latitudinal" && h !== "longitudinal" && console.error("blur direction must be either latitudinal or longitudinal!"); + let C = 3, R = new Ct(this._lodPlanes[c], T), S = T.uniforms, x1 = this._sizeLods[i] - 1, O = isFinite(s) ? Math.PI / (2 * x1) : 2 * Math.PI / (2 * Ut1 - 1), L = s / O, l = isFinite(s) ? 1 + Math.floor(C * L) : Ut1; + l > Ut1 && console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${l} samples when the maximum is set to ${Ut1}`); + let r = [], w = 0; + for(let y1 = 0; y1 < Ut1; ++y1){ + let B = y1 / L, p = Math.exp(-B * B / 2); + r.push(p), y1 === 0 ? w += p : y1 < l && (w += 2 * p); + } + for(let y1 = 0; y1 < r.length; y1++)r[y1] = r[y1] / w; + S.envMap.value = n.texture, S.samples.value = l, S.weights.value = r, S.latitudinal.value = h === "latitudinal", d && (S.poleAxis.value = d); + let { _lodMax: M } = this; + S.dTheta.value = O, S.mipInt.value = M - i; + let _ = this._sizeLods[c], H = 3 * _ * (c > M - Ht1 ? c - M + Ht1 : 0), P = 4 * (this._cubeSize - _); + on1(t, H, P, 3 * _, 2 * _), I.setRenderTarget(t), I.render(R, Pn1); } - getLoop() { - return this.hasPlaybackControl === !1 ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop; +}; +function jc1(e) { + let n = [], t = [], i = [], c = e, s = e - Ht1 + 1 + Gi1.length; + for(let h = 0; h < s; h++){ + let d = Math.pow(2, c); + t.push(d); + let I = 1 / d; + h > e - Ht1 ? I = Gi1[h - e + Ht1 - 1] : h === 0 && (I = 0), i.push(I); + let T = 1 / (d - 2), C = -T, R = 1 + T, S = [ + C, + C, + R, + C, + R, + R, + C, + C, + R, + R, + C, + R + ], x1 = 6, O = 6, L1 = 3, l = 2, r = 1, w = new Float32Array(L1 * O * x1), M = new Float32Array(l * O * x1), _ = new Float32Array(r * O * x1); + for(let P = 0; P < x1; P++){ + let y1 = P % 3 * 2 / 3 - 1, B = P > 2 ? 0 : -1, p = [ + y1, + B, + 0, + y1 + 2 / 3, + B, + 0, + y1 + 2 / 3, + B + 1, + 0, + y1, + B, + 0, + y1 + 2 / 3, + B + 1, + 0, + y1, + B + 1, + 0 + ]; + w.set(p, L1 * O * P), M.set(S, l * O * P); + let f = [ + P, + P, + P, + P, + P, + P + ]; + _.set(f, r * O * P); + } + let H = new L; + H.setAttribute("position", new Z(w, L1)), H.setAttribute("uv", new Z(M, l)), H.setAttribute("faceIndex", new Z(_, r)), n.push(H), c > Ht1 && c--; } - setLoop(e) { - if (this.hasPlaybackControl === !1) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; + return { + lodPlanes: n, + sizeLods: t, + sigmas: i + }; +} +function ki1(e, n, t) { + let i = new Hi(e, n, t); + return i.texture.mapping = Xl, i.texture.name = "PMREM.cubeUv", i.scissorTest = !0, i; +} +function on1(e, n, t, i, c) { + e.viewport.set(n, t, i, c), e.scissor.set(n, t, i, c); +} +function el1(e, n, t) { + let i = new Float32Array(Ut1), c = new w(0, 1, 0); + return new qi({ + name: "SphericalGaussianBlur", + defines: { + n: Ut1, + CUBEUV_TEXEL_WIDTH: 1 / n, + CUBEUV_TEXEL_HEIGHT: 1 / t, + CUBEUV_MAX_MIP: `${e}.0` + }, + uniforms: { + envMap: { + value: null + }, + samples: { + value: 1 + }, + weights: { + value: i + }, + latitudinal: { + value: !1 + }, + dTheta: { + value: 0 + }, + mipInt: { + value: 0 + }, + poleAxis: { + value: c + } + }, + vertexShader: Jn1(), + fragmentShader: ` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `, + blending: Ul, + depthTest: !1, + depthWrite: !1 + }); +} +function zi1() { + return new qi({ + name: "EquirectangularToCubeUV", + uniforms: { + envMap: { + value: null + } + }, + vertexShader: Jn1(), + fragmentShader: ` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `, + blending: Ul, + depthTest: !1, + depthWrite: !1 + }); +} +function Wi1() { + return new qi({ + name: "CubemapToCubeUV", + uniforms: { + envMap: { + value: null + }, + flipEnvMap: { + value: -1 + } + }, + vertexShader: Jn1(), + fragmentShader: ` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `, + blending: Ul, + depthTest: !1, + depthWrite: !1 + }); +} +function Jn1() { + return ` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `; +} +function tl1(e) { + let n = new WeakMap, t = null; + function i(d) { + if (d && d.isTexture) { + let I = d.mapping, T = I === ql || I === Gl, C = I === Uo || I === Hl; + if (T || C) { + let R = n.get(d), S = R !== void 0 ? R.texture.pmremVersion : 0; + if (d.isRenderTargetTexture && d.pmremVersion !== S) return t === null && (t = new hn1(e)), R = T ? t.fromEquirectangular(d, R) : t.fromCubemap(d, R), R.texture.pmremVersion = d.pmremVersion, n.set(d, R), R.texture; + if (R !== void 0) return R.texture; + { + let x1 = d.image; + return T && x1 && x1.height > 0 || C && x1 && c(x1) ? (t === null && (t = new hn1(e)), R = T ? t.fromEquirectangular(d) : t.fromCubemap(d), R.texture.pmremVersion = d.pmremVersion, n.set(d, R), d.addEventListener("dispose", s), R.texture) : null; + } + } } - return this.loop = e, this.isPlaying === !0 && (this.source.loop = this.loop), this; - } - setLoopStart(e) { - return this.loopStart = e, this; - } - setLoopEnd(e) { - return this.loopEnd = e, this; - } - getVolume() { - return this.gain.gain.value; - } - setVolume(e) { - return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01), this; - } -}, Kn = new A, Tu = new Ut, Ax = new A, Qn = new A, wu = class extends Fc { - constructor(e){ - super(e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain); - } - connect() { - super.connect(), this.panner.connect(this.gain); - } - disconnect() { - super.disconnect(), this.panner.disconnect(this.gain); - } - getOutput() { - return this.panner; - } - getRefDistance() { - return this.panner.refDistance; - } - setRefDistance(e) { - return this.panner.refDistance = e, this; - } - getRolloffFactor() { - return this.panner.rolloffFactor; - } - setRolloffFactor(e) { - return this.panner.rolloffFactor = e, this; - } - getDistanceModel() { - return this.panner.distanceModel; - } - setDistanceModel(e) { - return this.panner.distanceModel = e, this; - } - getMaxDistance() { - return this.panner.maxDistance; - } - setMaxDistance(e) { - return this.panner.maxDistance = e, this; - } - setDirectionalCone(e, t, n) { - return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = n, this; + return d; } - updateMatrixWorld(e) { - if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return; - this.matrixWorld.decompose(Kn, Tu, Ax), Qn.set(0, 0, 1).applyQuaternion(Tu); - let t = this.panner; - if (t.positionX) { - let n = this.context.currentTime + this.listener.timeDelta; - t.positionX.linearRampToValueAtTime(Kn.x, n), t.positionY.linearRampToValueAtTime(Kn.y, n), t.positionZ.linearRampToValueAtTime(Kn.z, n), t.orientationX.linearRampToValueAtTime(Qn.x, n), t.orientationY.linearRampToValueAtTime(Qn.y, n), t.orientationZ.linearRampToValueAtTime(Qn.z, n); - } else t.setPosition(Kn.x, Kn.y, Kn.z), t.setOrientation(Qn.x, Qn.y, Qn.z); + function c(d) { + let I = 0, T = 6; + for(let C = 0; C < T; C++)d[C] !== void 0 && I++; + return I === T; } -}, Au = class { - constructor(e, t = 2048){ - this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser); + function s(d) { + let I = d.target; + I.removeEventListener("dispose", s); + let T = n.get(I); + T !== void 0 && (n.delete(I), T.dispose()); } - getFrequencyData() { - return this.analyser.getByteFrequencyData(this.data), this.data; + function h() { + n = new WeakMap, t !== null && (t.dispose(), t = null); } - getAverageFrequency() { - let e = 0, t = this.getFrequencyData(); - for(let n = 0; n < t.length; n++)e += t[n]; - return e / t.length; - } -}, Bc = class { - constructor(e, t, n){ - this.binding = e, this.valueSize = n; - let i, r, a; - switch(t){ - case "quaternion": - i = this._slerp, r = this._slerpAdditive, a = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(n * 6), this._workIndex = 5; + return { + get: i, + dispose: h + }; +} +function nl1(e) { + let n = {}; + function t(i) { + if (n[i] !== void 0) return n[i]; + let c; + switch(i){ + case "WEBGL_depth_texture": + c = e.getExtension("WEBGL_depth_texture") || e.getExtension("MOZ_WEBGL_depth_texture") || e.getExtension("WEBKIT_WEBGL_depth_texture"); break; - case "string": - case "bool": - i = this._select, r = this._select, a = this._setAdditiveIdentityOther, this.buffer = new Array(n * 5); + case "EXT_texture_filter_anisotropic": + c = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); + break; + case "WEBGL_compressed_texture_s3tc": + c = e.getExtension("WEBGL_compressed_texture_s3tc") || e.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); + break; + case "WEBGL_compressed_texture_pvrtc": + c = e.getExtension("WEBGL_compressed_texture_pvrtc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); break; default: - i = this._lerp, r = this._lerpAdditive, a = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(n * 5); - } - this._mixBufferRegion = i, this._mixBufferRegionAdditive = r, this._setIdentity = a, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0; - } - accumulate(e, t) { - let n = this.buffer, i = this.valueSize, r = e * i + i, a = this.cumulativeWeight; - if (a === 0) { - for(let o = 0; o !== i; ++o)n[r + o] = n[o]; - a = t; - } else { - a += t; - let o = t / a; - this._mixBufferRegion(n, r, 0, o, i); - } - this.cumulativeWeight = a; - } - accumulateAdditive(e) { - let 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) { - let t = this.valueSize, n = this.buffer, i = e * t + t, r = this.cumulativeWeight, a = this.cumulativeWeightAdditive, o = this.binding; - if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, r < 1) { - let c = t * this._origIndex; - this._mixBufferRegion(n, i, c, 1 - r, t); - } - a > 0 && this._mixBufferRegionAdditive(n, i, this._addIndex * t, 1, t); - for(let c = t, l = t + t; c !== l; ++c)if (n[c] !== n[c + t]) { - o.setValue(n, i); - break; - } - } - saveOriginalState() { - let e = this.binding, t = this.buffer, n = this.valueSize, i = n * this._origIndex; - e.getValue(t, i); - for(let r = n, a = i; r !== a; ++r)t[r] = t[i + r % n]; - this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0; - } - restoreOriginalState() { - let e = this.valueSize * 3; - this.binding.setValue(this.buffer, e); - } - _setAdditiveIdentityNumeric() { - let 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() { - let e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize; - for(let n = 0; n < this.valueSize; n++)this.buffer[t + n] = this.buffer[e + n]; - } - _select(e, t, n, i, r) { - if (i >= .5) for(let a = 0; a !== r; ++a)e[t + a] = e[n + a]; - } - _slerp(e, t, n, i) { - Ut.slerpFlat(e, t, e, t, e, n, i); - } - _slerpAdditive(e, t, n, i, r) { - let a = this._workIndex * r; - Ut.multiplyQuaternionsFlat(e, a, e, t, e, n), Ut.slerpFlat(e, t, e, t, e, a, i); - } - _lerp(e, t, n, i, r) { - let a = 1 - i; - for(let o = 0; o !== r; ++o){ - let c = t + o; - e[c] = e[c] * a + e[n + o] * i; - } - } - _lerpAdditive(e, t, n, i, r) { - for(let a = 0; a !== r; ++a){ - let o = t + a; - e[o] = e[o] + e[n + a] * i; + c = e.getExtension(i); } + return n[i] = c, c; } -}, Kc = "\\[\\]\\.:\\/", Rx = new RegExp("[" + Kc + "]", "g"), Qc = "[^" + Kc + "]", Cx = "[^" + Kc.replace("\\.", "") + "]", Px = /((?:WC+[\/:])*)/.source.replace("WC", Qc), Lx = /(WCOD+)?/.source.replace("WCOD", Cx), Ix = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Qc), Ux = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Qc), Dx = new RegExp("^" + Px + Lx + Ix + Ux + "$"), Nx = [ - "material", - "materials", - "bones", - "map" -], zc = class { - constructor(e, t, n){ - let i = n || Ke.parseTrackName(t); - this._targetGroup = e, this._bindings = e.subscribe_(t, i); - } - getValue(e, t) { - this.bind(); - let n = this._targetGroup.nCachedObjects_, i = this._bindings[n]; - i !== void 0 && i.getValue(e, t); - } - setValue(e, t) { - let n = this._bindings; - for(let i = this._targetGroup.nCachedObjects_, r = n.length; i !== r; ++i)n[i].setValue(e, t); - } - bind() { - let e = this._bindings; - for(let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)e[t].bind(); - } - unbind() { - let e = this._bindings; - for(let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t)e[t].unbind(); - } -}, Ke = class s1 { - constructor(e, t, n){ - this.path = t, this.parsedPath = n || s1.parseTrackName(t), this.node = s1.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 s1.Composite(e, t, n) : new s1(e, t, n); - } - static sanitizeNodeName(e) { - return e.replace(/\s/g, "_").replace(Rx, ""); - } - static parseTrackName(e) { - let t = Dx.exec(e); - if (t === null) throw new Error("PropertyBinding: Cannot parse trackName: " + e); - let 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) { - let r = n.nodeName.substring(i + 1); - Nx.indexOf(r) !== -1 && (n.nodeName = n.nodeName.substring(0, i), n.objectName = r); - } - if (n.propertyName === null || n.propertyName.length === 0) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e); - return n; - } - static findNode(e, t) { - if (t === void 0 || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e; - if (e.skeleton) { - let n = e.skeleton.getBoneByName(t); - if (n !== void 0) return n; - } - if (e.children) { - let n = function(r) { - for(let a = 0; a < r.length; a++){ - let o = r[a]; - if (o.name === t || o.uuid === t) return o; - let c = n(o.children); - if (c) return c; - } - return null; - }, i = n(e.children); - if (i) return i; + return { + has: function(i) { + return t(i) !== null; + }, + init: function() { + t("EXT_color_buffer_float"), t("WEBGL_clip_cull_distance"), t("OES_texture_float_linear"), t("EXT_color_buffer_half_float"), t("WEBGL_multisampled_render_to_texture"), t("WEBGL_render_shared_exponent"); + }, + get: function(i) { + let c = t(i); + return c === null && Cf("THREE.WebGLRenderer: " + i + " extension not supported."), c; } - return null; - } - _getValue_unavailable() {} - _setValue_unavailable() {} - _getValue_direct(e, t) { - e[t] = this.targetObject[this.propertyName]; - } - _getValue_array(e, t) { - let n = this.resolvedProperty; - for(let i = 0, r = n.length; i !== r; ++i)e[t++] = n[i]; - } - _getValue_arrayElement(e, t) { - e[t] = this.resolvedProperty[this.propertyIndex]; - } - _getValue_toArray(e, t) { - this.resolvedProperty.toArray(e, t); - } - _setValue_direct(e, t) { - this.targetObject[this.propertyName] = e[t]; - } - _setValue_direct_setNeedsUpdate(e, t) { - this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0; - } - _setValue_direct_setMatrixWorldNeedsUpdate(e, t) { - this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; - } - _setValue_array(e, t) { - let n = this.resolvedProperty; - for(let i = 0, r = n.length; i !== r; ++i)n[i] = e[t++]; - } - _setValue_array_setNeedsUpdate(e, t) { - let n = this.resolvedProperty; - for(let i = 0, r = n.length; i !== r; ++i)n[i] = e[t++]; - this.targetObject.needsUpdate = !0; - } - _setValue_array_setMatrixWorldNeedsUpdate(e, t) { - let n = this.resolvedProperty; - for(let i = 0, r = n.length; i !== r; ++i)n[i] = e[t++]; - this.targetObject.matrixWorldNeedsUpdate = !0; - } - _setValue_arrayElement(e, t) { - this.resolvedProperty[this.propertyIndex] = e[t]; - } - _setValue_arrayElement_setNeedsUpdate(e, t) { - this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0; - } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) { - this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; + }; +} +function il1(e, n, t, i) { + let c = {}, s = new WeakMap; + function h(R) { + let S = R.target; + S.index !== null && n.remove(S.index); + for(let O in S.attributes)n.remove(S.attributes[O]); + S.removeEventListener("dispose", h), delete c[S.id]; + let x1 = s.get(S); + x1 && (n.remove(x1), s.delete(S)), i.releaseStatesOfGeometry(S), S.isInstancedBufferGeometry === !0 && delete S._maxInstanceCount, t.memory.geometries--; + } + function d(R, S) { + return c[S.id] === !0 || (S.addEventListener("dispose", h), c[S.id] = !0, t.memory.geometries++), S; + } + function I(R) { + let S = R.attributes; + for(let x1 in S)n.update(S[x1], e.ARRAY_BUFFER); + } + function T(R) { + let S = [], x1 = R.index, O = R.attributes.position, L = 0; + if (x1 !== null) { + let w = x1.array; + L = x1.version; + for(let M = 0, _ = w.length; M < _; M += 3){ + let H = w[M + 0], P = w[M + 1], y1 = w[M + 2]; + S.push(H, P, P, y1, y1, H); + } + } else if (O !== void 0) { + let w = O.array; + L = O.version; + for(let M = 0, _ = w.length / 3 - 1; M < _; M += 3){ + let H = M + 0, P = M + 1, y1 = M + 2; + S.push(H, P, P, y1, y1, H); + } + } else return; + let l = new (cu(S) ? xr : gr)(S, 1); + l.version = L; + let r = s.get(R); + r && n.remove(r), s.set(R, l); + } + function C(R) { + let S = s.get(R); + if (S) { + let x1 = R.index; + x1 !== null && S.version < x1.version && T(R); + } else T(R); + return s.get(R); } - _setValue_fromArray(e, t) { - this.resolvedProperty.fromArray(e, t); + return { + get: d, + update: I, + getWireframeAttribute: C + }; +} +function rl1(e, n, t) { + let i; + function c(S) { + i = S; } - _setValue_fromArray_setNeedsUpdate(e, t) { - this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0; + let s, h; + function d(S) { + s = S.type, h = S.bytesPerElement; } - _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) { - this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0; + function I(S, x1) { + e.drawElements(i, x1, s, S * h), t.update(x1, i, 1); } - _getValue_unbound(e, t) { - this.bind(), this.getValue(e, t); + function T(S, x1, O) { + O !== 0 && (e.drawElementsInstanced(i, x1, s, S * h, O), t.update(x1, i, O)); } - _setValue_unbound(e, t) { - this.bind(), this.setValue(e, t); + function C(S, x1, O) { + if (O === 0) return; + n.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i, x1, 0, s, S, 0, O); + let l = 0; + for(let r = 0; r < O; r++)l += x1[r]; + t.update(l, i, 1); } - bind() { - let e = this.node, t = this.parsedPath, n = t.objectName, i = t.propertyName, r = t.propertyIndex; - if (e || (e = s1.findNode(this.rootNode, t.nodeName), this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) { - console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + "."); - return; - } - if (n) { - let l = t.objectIndex; - switch(n){ - case "materials": - if (!e.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!e.material.materials) { - console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); - return; - } - e = e.material.materials; - break; - case "bones": - if (!e.skeleton) { - console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); - return; - } - e = e.skeleton.bones; - for(let h = 0; h < e.length; h++)if (e[h].name === l) { - l = h; - break; - } - break; - case "map": - if ("map" in e) { - e = e.map; - break; - } - if (!e.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!e.material.map) { - console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this); - return; - } - e = e.material.map; - break; - default: - if (e[n] === void 0) { - console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); - return; - } - e = e[n]; - } - if (l !== void 0) { - if (e[l] === void 0) { - console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e); - return; - } - e = e[l]; - } - } - let a = e[i]; - if (a === void 0) { - let l = t.nodeName; - console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + i + " but it wasn't found.", e); - return; + function R(S, x1, O, L) { + if (O === 0) return; + let l = n.get("WEBGL_multi_draw"); + if (l === null) for(let r = 0; r < S.length; r++)T(S[r] / h, x1[r], L[r]); + else { + l.multiDrawElementsInstancedWEBGL(i, x1, 0, s, S, 0, L, 0, O); + let r = 0; + for(let w = 0; w < O; w++)r += x1[w] * L[w]; + t.update(r, i, 1); } - let o = this.Versioning.None; - this.targetObject = e, e.needsUpdate !== void 0 ? o = this.Versioning.NeedsUpdate : e.matrixWorldNeedsUpdate !== void 0 && (o = this.Versioning.MatrixWorldNeedsUpdate); - let c = this.BindingType.Direct; - if (r !== void 0) { - if (i === "morphTargetInfluences") { - if (!e.geometry) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); - return; - } - if (!e.geometry.morphAttributes) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); - return; - } - e.morphTargetDictionary[r] !== void 0 && (r = e.morphTargetDictionary[r]); - } - c = this.BindingType.ArrayElement, this.resolvedProperty = a, this.propertyIndex = r; - } else a.fromArray !== void 0 && a.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = a) : Array.isArray(a) ? (c = this.BindingType.EntireArray, this.resolvedProperty = a) : this.propertyName = i; - this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][o]; - } - unbind() { - this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; - } -}; -Ke.Composite = zc; -Ke.prototype.BindingType = { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 -}; -Ke.prototype.Versioning = { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 -}; -Ke.prototype.GetterByBindingType = [ - Ke.prototype._getValue_direct, - Ke.prototype._getValue_array, - Ke.prototype._getValue_arrayElement, - Ke.prototype._getValue_toArray -]; -Ke.prototype.SetterByBindingTypeAndVersioning = [ - [ - Ke.prototype._setValue_direct, - Ke.prototype._setValue_direct_setNeedsUpdate, - Ke.prototype._setValue_direct_setMatrixWorldNeedsUpdate - ], - [ - Ke.prototype._setValue_array, - Ke.prototype._setValue_array_setNeedsUpdate, - Ke.prototype._setValue_array_setMatrixWorldNeedsUpdate - ], - [ - Ke.prototype._setValue_arrayElement, - Ke.prototype._setValue_arrayElement_setNeedsUpdate, - Ke.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate - ], - [ - Ke.prototype._setValue_fromArray, - Ke.prototype._setValue_fromArray_setNeedsUpdate, - Ke.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate - ] -]; -var Ru = class { - constructor(){ - this.isAnimationObjectGroup = !0, this.uuid = kt(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; - let e = {}; - this._indicesByUUID = e; - for(let n = 0, i = arguments.length; n !== i; ++n)e[arguments[n].uuid] = n; - this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; - let t = this; - this.stats = { - objects: { - get total () { - return t._objects.length; - }, - get inUse () { - return this.total - t.nCachedObjects_; - } - }, - get bindingsPerObject () { - return t._bindings.length; - } - }; } - add() { - let e = this._objects, t = this._indicesByUUID, n = this._paths, i = this._parsedPaths, r = this._bindings, a = r.length, o, c = e.length, l = this.nCachedObjects_; - for(let h = 0, u = arguments.length; h !== u; ++h){ - let d = arguments[h], f = d.uuid, m = t[f]; - if (m === void 0) { - m = c++, t[f] = m, e.push(d); - for(let _ = 0, g = a; _ !== g; ++_)r[_].push(new Ke(d, n[_], i[_])); - } else if (m < l) { - o = e[m]; - let _ = --l, g = e[_]; - t[g.uuid] = m, e[m] = g, t[f] = _, e[_] = d; - for(let p = 0, v = a; p !== v; ++p){ - let x1 = r[p], y1 = x1[_], b = x1[m]; - x1[m] = y1, b === void 0 && (b = new Ke(d, n[p], i[p])), x1[_] = b; - } - } else e[m] !== o && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); + this.setMode = c, this.setIndex = d, this.render = I, this.renderInstances = T, this.renderMultiDraw = C, this.renderMultiDrawInstances = R; +} +function al1(e) { + let n = { + geometries: 0, + textures: 0 + }, t = { + frame: 0, + calls: 0, + triangles: 0, + points: 0, + lines: 0 + }; + function i(s, h, d) { + switch(t.calls++, h){ + case e.TRIANGLES: + t.triangles += d * (s / 3); + break; + case e.LINES: + t.lines += d * (s / 2); + break; + case e.LINE_STRIP: + t.lines += d * (s - 1); + break; + case e.LINE_LOOP: + t.lines += d * s; + break; + case e.POINTS: + t.points += d * s; + break; + default: + console.error("THREE.WebGLInfo: Unknown draw mode:", h); + break; } - this.nCachedObjects_ = l; } - remove() { - let e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_; - for(let a = 0, o = arguments.length; a !== o; ++a){ - let c = arguments[a], l = c.uuid, h = t[l]; - if (h !== void 0 && h >= r) { - let u = r++, d = e[u]; - t[d.uuid] = h, e[h] = d, t[l] = u, e[u] = c; - for(let f = 0, m = i; f !== m; ++f){ - let _ = n[f], g = _[u], p = _[h]; - _[h] = g, _[u] = p; - } - } - } - this.nCachedObjects_ = r; + function c() { + t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0; } - uncache() { - let e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_, a = e.length; - for(let o = 0, c = arguments.length; o !== c; ++o){ - let l = arguments[o], h = l.uuid, u = t[h]; - if (u !== void 0) if (delete t[h], u < r) { - let d = --r, f = e[d], m = --a, _ = e[m]; - t[f.uuid] = u, e[u] = f, t[_.uuid] = d, e[d] = _, e.pop(); - for(let g = 0, p = i; g !== p; ++g){ - let v = n[g], x1 = v[d], y1 = v[m]; - v[u] = x1, v[d] = y1, v.pop(); - } - } else { - let d = --a, f = e[d]; - d > 0 && (t[f.uuid] = u), e[u] = f, e.pop(); - for(let m = 0, _ = i; m !== _; ++m){ - let g = n[m]; - g[u] = g[d], g.pop(); + return { + memory: n, + render: t, + programs: null, + autoReset: !0, + reset: c, + update: i + }; +} +function ol1(e, n, t) { + let i = new WeakMap, c = new ot; + function s(h, d, I) { + let T1 = h.morphTargetInfluences, C = d.morphAttributes.position || d.morphAttributes.normal || d.morphAttributes.color, R = C !== void 0 ? C.length : 0, S = i.get(d); + if (S === void 0 || S.count !== R) { + let p = function() { + y1.dispose(), i.delete(d), d.removeEventListener("dispose", p); + }; + S !== void 0 && S.texture.dispose(); + let x1 = d.morphAttributes.position !== void 0, O = d.morphAttributes.normal !== void 0, L = d.morphAttributes.color !== void 0, l = d.morphAttributes.position || [], r = d.morphAttributes.normal || [], w = d.morphAttributes.color || [], M = 0; + x1 === !0 && (M = 1), O === !0 && (M = 2), L === !0 && (M = 3); + let _ = d.attributes.position.count * M, H = 1; + _ > n.maxTextureSize && (H = Math.ceil(_ / n.maxTextureSize), _ = n.maxTextureSize); + let P = new Float32Array(_ * H * 4 * R), y1 = new $s(P, _, H, R); + y1.type = pi, y1.needsUpdate = !0; + let B = M * 4; + for(let f = 0; f < R; f++){ + let A = l[f], q = r[f], V = w[f], Y = _ * H * 4 * f; + for(let Q = 0; Q < A.count; Q++){ + let z = Q * B; + x1 === !0 && (c.fromBufferAttribute(A, Q), P[Y + z + 0] = c.x, P[Y + z + 1] = c.y, P[Y + z + 2] = c.z, P[Y + z + 3] = 0), O === !0 && (c.fromBufferAttribute(q, Q), P[Y + z + 4] = c.x, P[Y + z + 5] = c.y, P[Y + z + 6] = c.z, P[Y + z + 7] = 0), L === !0 && (c.fromBufferAttribute(V, Q), P[Y + z + 8] = c.x, P[Y + z + 9] = c.y, P[Y + z + 10] = c.z, P[Y + z + 11] = V.itemSize === 4 ? c.w : 1); } } + S = { + count: R, + texture: y1, + size: new T(_, H) + }, i.set(d, S), d.addEventListener("dispose", p); } - this.nCachedObjects_ = r; - } - subscribe_(e, t) { - let n = this._bindingsIndicesByPath, i = n[e], r = this._bindings; - if (i !== void 0) return r[i]; - let a = this._paths, o = this._parsedPaths, c = this._objects, l = c.length, h = this.nCachedObjects_, u = new Array(l); - i = r.length, n[e] = i, a.push(e), o.push(t), r.push(u); - for(let d = h, f = c.length; d !== f; ++d){ - let m = c[d]; - u[d] = new Ke(m, e, t); + if (h.isInstancedMesh === !0 && h.morphTexture !== null) I.getUniforms().setValue(e, "morphTexture", h.morphTexture, t); + else { + let x1 = 0; + for(let L = 0; L < T1.length; L++)x1 += T1[L]; + let O = d.morphTargetsRelative ? 1 : 1 - x1; + I.getUniforms().setValue(e, "morphTargetBaseInfluence", O), I.getUniforms().setValue(e, "morphTargetInfluences", T1); } - return u; + I.getUniforms().setValue(e, "morphTargetsTexture", S.texture, t), I.getUniforms().setValue(e, "morphTargetsTextureSize", S.size); } - unsubscribe_(e) { - let t = this._bindingsIndicesByPath, n = t[e]; - if (n !== void 0) { - let i = this._paths, r = this._parsedPaths, a = this._bindings, o = a.length - 1, c = a[o], l = e[o]; - t[l] = n, a[n] = c, a.pop(), r[n] = r[o], r.pop(), i[n] = i[o], i.pop(); + return { + update: s + }; +} +function sl1(e, n, t, i) { + let c = new WeakMap; + function s(I) { + let T = i.render.frame, C = I.geometry, R = n.get(I, C); + if (c.get(R) !== T && (n.update(R), c.set(R, T)), I.isInstancedMesh && (I.hasEventListener("dispose", d) === !1 && I.addEventListener("dispose", d), c.get(I) !== T && (t.update(I.instanceMatrix, e.ARRAY_BUFFER), I.instanceColor !== null && t.update(I.instanceColor, e.ARRAY_BUFFER), c.set(I, T))), I.isSkinnedMesh) { + let S = I.skeleton; + c.get(S) !== T && (S.update(), c.set(S, T)); } + return R; } -}, Vc = class { - constructor(e, t, n = null, i = t.blendMode){ - this._mixer = e, this._clip = t, this._localRoot = n, this.blendMode = i; - let r = t.tracks, a = r.length, o = new Array(a), c = { - endingStart: zi, - endingEnd: zi - }; - for(let l = 0; l !== a; ++l){ - let h = r[l].createInterpolant(null); - o[l] = h, h.settings = c; - } - this._interpolantSettings = c, this._interpolants = o, this._propertyBindings = new Array(a), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = Af, 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; + function h() { + c = new WeakMap; } - play() { - return this._mixer._activateAction(this), this; + function d(I) { + let T = I.target; + T.removeEventListener("dispose", d), t.remove(T.instanceMatrix), T.instanceColor !== null && t.remove(T.instanceColor); } - stop() { - return this._mixer._deactivateAction(this), this.reset(); + return { + update: s, + dispose: h + }; +} +var Pr1 = new lt, Xi1 = new hh(1, 1), Lr1 = new $s, Ur1 = new Qs, Dr1 = new Xi, Yi1 = [], qi1 = [], Ki1 = new Float32Array(16), $i1 = new Float32Array(9), Zi1 = new Float32Array(4); +function Xt1(e, n, t) { + let i = e[0]; + if (i <= 0 || i > 0) return e; + let c = n * t, s = Yi1[c]; + if (s === void 0 && (s = new Float32Array(c), Yi1[c] = s), n !== 0) { + i.toArray(s, 0); + for(let h = 1, d = 0; h !== n; ++h)d += t, e[h].toArray(s, d); } - reset() { - return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping(); + return s; +} +function nt1(e, n) { + if (e.length !== n.length) return !1; + for(let t = 0, i = e.length; t < i; t++)if (e[t] !== n[t]) return !1; + return !0; +} +function it1(e, n) { + for(let t = 0, i = n.length; t < i; t++)e[t] = n[t]; +} +function gn1(e, n) { + let t = qi1[n]; + t === void 0 && (t = new Int32Array(n), qi1[n] = t); + for(let i = 0; i !== n; ++i)t[i] = e.allocateTextureUnit(); + return t; +} +function cl1(e, n) { + let t = this.cache; + t[0] !== n && (e.uniform1f(this.addr, n), t[0] = n); +} +function ll1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y) && (e.uniform2f(this.addr, n.x, n.y), t[0] = n.x, t[1] = n.y); + else { + if (nt1(t, n)) return; + e.uniform2fv(this.addr, n), it1(t, n); } - isRunning() { - return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); +} +function fl1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z) && (e.uniform3f(this.addr, n.x, n.y, n.z), t[0] = n.x, t[1] = n.y, t[2] = n.z); + else if (n.r !== void 0) (t[0] !== n.r || t[1] !== n.g || t[2] !== n.b) && (e.uniform3f(this.addr, n.r, n.g, n.b), t[0] = n.r, t[1] = n.g, t[2] = n.b); + else { + if (nt1(t, n)) return; + e.uniform3fv(this.addr, n), it1(t, n); } - isScheduled() { - return this._mixer._isActiveAction(this); +} +function dl1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z || t[3] !== n.w) && (e.uniform4f(this.addr, n.x, n.y, n.z, n.w), t[0] = n.x, t[1] = n.y, t[2] = n.z, t[3] = n.w); + else { + if (nt1(t, n)) return; + e.uniform4fv(this.addr, n), it1(t, n); } - startAt(e) { - return this._startTime = e, this; +} +function ul1(e, n) { + let t = this.cache, i = n.elements; + if (i === void 0) { + if (nt1(t, n)) return; + e.uniformMatrix2fv(this.addr, !1, n), it1(t, n); + } else { + if (nt1(t, i)) return; + Zi1.set(i), e.uniformMatrix2fv(this.addr, !1, Zi1), it1(t, i); } - setLoop(e, t) { - return this.loop = e, this.repetitions = t, this; +} +function pl1(e, n) { + let t = this.cache, i = n.elements; + if (i === void 0) { + if (nt1(t, n)) return; + e.uniformMatrix3fv(this.addr, !1, n), it1(t, n); + } else { + if (nt1(t, i)) return; + $i1.set(i), e.uniformMatrix3fv(this.addr, !1, $i1), it1(t, i); } - setEffectiveWeight(e) { - return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading(); +} +function hl1(e, n) { + let t = this.cache, i = n.elements; + if (i === void 0) { + if (nt1(t, n)) return; + e.uniformMatrix4fv(this.addr, !1, n), it1(t, n); + } else { + if (nt1(t, i)) return; + Ki1.set(i), e.uniformMatrix4fv(this.addr, !1, Ki1), it1(t, i); } - getEffectiveWeight() { - return this._effectiveWeight; +} +function ml1(e, n) { + let t = this.cache; + t[0] !== n && (e.uniform1i(this.addr, n), t[0] = n); +} +function _l1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y) && (e.uniform2i(this.addr, n.x, n.y), t[0] = n.x, t[1] = n.y); + else { + if (nt1(t, n)) return; + e.uniform2iv(this.addr, n), it1(t, n); } - fadeIn(e) { - return this._scheduleFading(e, 0, 1); +} +function vl1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z) && (e.uniform3i(this.addr, n.x, n.y, n.z), t[0] = n.x, t[1] = n.y, t[2] = n.z); + else { + if (nt1(t, n)) return; + e.uniform3iv(this.addr, n), it1(t, n); } - fadeOut(e) { - return this._scheduleFading(e, 1, 0); +} +function gl1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z || t[3] !== n.w) && (e.uniform4i(this.addr, n.x, n.y, n.z, n.w), t[0] = n.x, t[1] = n.y, t[2] = n.z, t[3] = n.w); + else { + if (nt1(t, n)) return; + e.uniform4iv(this.addr, n), it1(t, n); } - crossFadeFrom(e, t, n) { - if (e.fadeOut(t), this.fadeIn(t), n) { - let i = this._clip.duration, r = e._clip.duration, a = r / i, o = i / r; - e.warp(1, a, t), this.warp(o, 1, t); - } - return this; +} +function Sl1(e, n) { + let t = this.cache; + t[0] !== n && (e.uniform1ui(this.addr, n), t[0] = n); +} +function El1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y) && (e.uniform2ui(this.addr, n.x, n.y), t[0] = n.x, t[1] = n.y); + else { + if (nt1(t, n)) return; + e.uniform2uiv(this.addr, n), it1(t, n); } - crossFadeTo(e, t, n) { - return e.crossFadeFrom(this, t, n); +} +function Ml1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z) && (e.uniform3ui(this.addr, n.x, n.y, n.z), t[0] = n.x, t[1] = n.y, t[2] = n.z); + else { + if (nt1(t, n)) return; + e.uniform3uiv(this.addr, n), it1(t, n); } - stopFading() { - let e = this._weightInterpolant; - return e !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; +} +function Tl1(e, n) { + let t = this.cache; + if (n.x !== void 0) (t[0] !== n.x || t[1] !== n.y || t[2] !== n.z || t[3] !== n.w) && (e.uniform4ui(this.addr, n.x, n.y, n.z, n.w), t[0] = n.x, t[1] = n.y, t[2] = n.z, t[3] = n.w); + else { + if (nt1(t, n)) return; + e.uniform4uiv(this.addr, n), it1(t, n); } - setEffectiveTimeScale(e) { - return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping(); +} +function xl1(e, n, t) { + let i = this.cache, c = t.allocateTextureUnit(); + i[0] !== c && (e.uniform1i(this.addr, c), i[0] = c); + let s; + this.type === e.SAMPLER_2D_SHADOW ? (Xi1.compareFunction = cf, s = Xi1) : s = Pr1, t.setTexture2D(n || s, c); +} +function Al1(e, n, t) { + let i = this.cache, c = t.allocateTextureUnit(); + i[0] !== c && (e.uniform1i(this.addr, c), i[0] = c), t.setTexture3D(n || Ur1, c); +} +function Rl1(e, n, t) { + let i = this.cache, c = t.allocateTextureUnit(); + i[0] !== c && (e.uniform1i(this.addr, c), i[0] = c), t.setTextureCube(n || Dr1, c); +} +function Cl1(e, n, t) { + let i = this.cache, c = t.allocateTextureUnit(); + i[0] !== c && (e.uniform1i(this.addr, c), i[0] = c), t.setTexture2DArray(n || Lr1, c); +} +function bl1(e) { + switch(e){ + case 5126: + return cl1; + case 35664: + return ll1; + case 35665: + return fl1; + case 35666: + return dl1; + case 35674: + return ul1; + case 35675: + return pl1; + case 35676: + return hl1; + case 5124: + case 35670: + return ml1; + case 35667: + case 35671: + return _l1; + case 35668: + case 35672: + return vl1; + case 35669: + case 35673: + return gl1; + case 5125: + return Sl1; + case 36294: + return El1; + case 36295: + return Ml1; + case 36296: + return Tl1; + case 35678: + case 36198: + case 36298: + case 36306: + case 35682: + return xl1; + case 35679: + case 36299: + case 36307: + return Al1; + case 35680: + case 36300: + case 36308: + case 36293: + return Rl1; + case 36289: + case 36303: + case 36311: + case 36292: + return Cl1; } - getEffectiveTimeScale() { - return this._effectiveTimeScale; +} +function Pl1(e, n) { + e.uniform1fv(this.addr, n); +} +function Ll(e, n) { + let t = Xt1(n, this.size, 2); + e.uniform2fv(this.addr, t); +} +function Ul1(e, n) { + let t = Xt1(n, this.size, 3); + e.uniform3fv(this.addr, t); +} +function Dl(e, n) { + let t = Xt1(n, this.size, 4); + e.uniform4fv(this.addr, t); +} +function wl1(e, n) { + let t = Xt1(n, this.size, 4); + e.uniformMatrix2fv(this.addr, !1, t); +} +function Il1(e, n) { + let t = Xt1(n, this.size, 9); + e.uniformMatrix3fv(this.addr, !1, t); +} +function yl1(e, n) { + let t = Xt1(n, this.size, 16); + e.uniformMatrix4fv(this.addr, !1, t); +} +function Nl1(e, n) { + e.uniform1iv(this.addr, n); +} +function Ol1(e, n) { + e.uniform2iv(this.addr, n); +} +function Fl1(e, n) { + e.uniform3iv(this.addr, n); +} +function Bl1(e, n) { + e.uniform4iv(this.addr, n); +} +function Gl1(e, n) { + e.uniform1uiv(this.addr, n); +} +function Hl1(e, n) { + e.uniform2uiv(this.addr, n); +} +function Vl(e, n) { + e.uniform3uiv(this.addr, n); +} +function kl1(e, n) { + e.uniform4uiv(this.addr, n); +} +function zl1(e, n, t) { + let i = this.cache, c = n.length, s = gn1(t, c); + nt1(i, s) || (e.uniform1iv(this.addr, s), it1(i, s)); + for(let h = 0; h !== c; ++h)t.setTexture2D(n[h] || Pr1, s[h]); +} +function Wl1(e, n, t) { + let i = this.cache, c = n.length, s = gn1(t, c); + nt1(i, s) || (e.uniform1iv(this.addr, s), it1(i, s)); + for(let h = 0; h !== c; ++h)t.setTexture3D(n[h] || Ur1, s[h]); +} +function Xl1(e, n, t) { + let i = this.cache, c = n.length, s = gn1(t, c); + nt1(i, s) || (e.uniform1iv(this.addr, s), it1(i, s)); + for(let h = 0; h !== c; ++h)t.setTextureCube(n[h] || Dr1, s[h]); +} +function Yl1(e, n, t) { + let i = this.cache, c = n.length, s = gn1(t, c); + nt1(i, s) || (e.uniform1iv(this.addr, s), it1(i, s)); + for(let h = 0; h !== c; ++h)t.setTexture2DArray(n[h] || Lr1, s[h]); +} +function ql1(e) { + switch(e){ + case 5126: + return Pl1; + case 35664: + return Ll; + case 35665: + return Ul1; + case 35666: + return Dl; + case 35674: + return wl1; + case 35675: + return Il1; + case 35676: + return yl1; + case 5124: + case 35670: + return Nl1; + case 35667: + case 35671: + return Ol1; + case 35668: + case 35672: + return Fl1; + case 35669: + case 35673: + return Bl1; + case 5125: + return Gl1; + case 36294: + return Hl1; + case 36295: + return Vl; + case 36296: + return kl1; + case 35678: + case 36198: + case 36298: + case 36306: + case 35682: + return zl1; + case 35679: + case 36299: + case 36307: + return Wl1; + case 35680: + case 36300: + case 36308: + case 36293: + return Xl1; + case 36289: + case 36303: + case 36311: + case 36292: + return Yl1; } - setDuration(e) { - return this.timeScale = this._clip.duration / e, this.stopWarping(); +} +var zn1 = class { + constructor(n, t, i){ + this.id = n, this.addr = i, this.cache = [], this.type = t.type, this.setValue = bl1(t.type); } - syncWith(e) { - return this.time = e.time, this.timeScale = e.timeScale, this.stopWarping(); +}, Wn1 = class { + constructor(n, t, i){ + this.id = n, this.addr = i, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = ql1(t.type); } - halt(e) { - return this.warp(this._effectiveTimeScale, 0, e); +}, Xn1 = class { + constructor(n){ + this.id = n, this.seq = [], this.map = {}; } - warp(e, t, n) { - let i = this._mixer, r = i.time, a = this.timeScale, o = this._timeScaleInterpolant; - o === null && (o = i._lendControlInterpolant(), this._timeScaleInterpolant = o); - let c = o.parameterPositions, l = o.sampleValues; - return c[0] = r, c[1] = r + n, l[0] = e / a, l[1] = t / a, this; + setValue(n, t, i) { + let c = this.seq; + for(let s = 0, h = c.length; s !== h; ++s){ + let d = c[s]; + d.setValue(n, t[d.id], i); + } } - stopWarping() { - let e = this._timeScaleInterpolant; - return e !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; +}, In = /(\w+)(\])?(\[|\.)?/g; +function Qi1(e, n) { + e.seq.push(n), e.map[n.id] = n; +} +function Kl1(e, n, t) { + let i = e.name, c = i.length; + for(In.lastIndex = 0;;){ + let s = In.exec(i), h = In.lastIndex, d = s[1], I = s[2] === "]", T = s[3]; + if (I && (d = d | 0), T === void 0 || T === "[" && h + 2 === c) { + Qi1(t, T === void 0 ? new zn1(d, e, n) : new Wn1(d, e, n)); + break; + } else { + let R = t.map[d]; + R === void 0 && (R = new Xn1(d), Qi1(t, R)), t = R; + } } - getMixer() { - return this._mixer; +} +var Vt1 = class { + constructor(n, t){ + this.seq = [], this.map = {}; + let i = n.getProgramParameter(t, n.ACTIVE_UNIFORMS); + for(let c = 0; c < i; ++c){ + let s = n.getActiveUniform(t, c), h = n.getUniformLocation(t, s.name); + Kl1(s, h, this); + } } - getClip() { - return this._clip; + setValue(n, t, i, c) { + let s = this.map[t]; + s !== void 0 && s.setValue(n, i, c); } - getRoot() { - return this._localRoot || this._mixer._root; + setOptional(n, t, i) { + let c = t[i]; + c !== void 0 && this.setValue(n, i, c); } - _update(e, t, n, i) { - if (!this.enabled) { - this._updateWeight(e); - return; - } - let r = this._startTime; - if (r !== null) { - let c = (e - r) * n; - c < 0 || n === 0 ? t = 0 : (this._startTime = null, t = n * c); - } - t *= this._updateTimeScale(e); - let a = this._updateTime(t), o = this._updateWeight(e); - if (o > 0) { - let c = this._interpolants, l = this._propertyBindings; - switch(this.blendMode){ - case xd: - for(let h = 0, u = c.length; h !== u; ++h)c[h].evaluate(a), l[h].accumulateAdditive(o); - break; - case Xc: - default: - for(let h = 0, u = c.length; h !== u; ++h)c[h].evaluate(a), l[h].accumulate(i, o); - } + static upload(n, t, i, c) { + for(let s = 0, h = t.length; s !== h; ++s){ + let d = t[s], I = i[d.id]; + I.needsUpdate !== !1 && d.setValue(n, I.value, c); } } - _updateWeight(e) { - let t = 0; - if (this.enabled) { - t = this.weight; - let n = this._weightInterpolant; - if (n !== null) { - let i = n.evaluate(e)[0]; - t *= i, e > n.parameterPositions[1] && (this.stopFading(), i === 0 && (this.enabled = !1)); - } + static seqWithValue(n, t) { + let i = []; + for(let c = 0, s = n.length; c !== s; ++c){ + let h = n[c]; + h.id in t && i.push(h); } - return this._effectiveWeight = t, t; + return i; } - _updateTimeScale(e) { - let t = 0; - if (!this.paused) { - t = this.timeScale; - let n = this._timeScaleInterpolant; - if (n !== null) { - let 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; +}; +function Ji1(e, n, t) { + let i = e.createShader(n); + return e.shaderSource(i, t), e.compileShader(i), i; +} +var $l1 = 37297, Zl1 = 0; +function Ql1(e, n) { + let t = e.split(` +`), i = [], c = Math.max(n - 6, 0), s = Math.min(n + 6, t.length); + for(let h = c; h < s; h++){ + let d = h + 1; + i.push(`${d === n ? ">" : " "} ${d}: ${t[h]}`); + } + return i.join(` +`); +} +var ji1 = new Gt; +function Jl1(e) { + Tt._getMatrix(ji1, Tt.workingColorSpace, e); + let n = `mat3( ${ji1.elements.map((t)=>t.toFixed(4))} )`; + switch(Tt.getTransfer(e)){ + case la: + return [ + n, + "LinearTransferOETF" + ]; + case Fn: + return [ + n, + "sRGBTransferOETF" + ]; + default: + return console.warn("THREE.WebGLProgram: Unsupported color space: ", e), [ + n, + "LinearTransferOETF" + ]; + } +} +function er1(e, n, t) { + let i = e.getShaderParameter(n, e.COMPILE_STATUS), c = e.getShaderInfoLog(n).trim(); + if (i && c === "") return ""; + let s = /ERROR: 0:(\d+)/.exec(c); + if (s) { + let h = parseInt(s[1]); + return t.toUpperCase() + ` + +` + c + ` + +` + Ql1(e.getShaderSource(n), h); + } else return c; +} +function jl1(e, n) { + let t = Jl1(n); + return [ + `vec4 ${e}( vec4 value ) {`, + ` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`, + "}" + ].join(` +`); +} +function ef1(e, n) { + let t; + switch(n){ + case Ip: + t = "Linear"; + break; + case Cp: + t = "Reinhard"; + break; + case zp: + t = "Cineon"; + break; + case Fp: + t = "ACESFilmic"; + break; + case Ep: + t = "AgX"; + break; + case Rp: + t = "Neutral"; + break; + case Bp: + t = "Custom"; + break; + default: + console.warn("THREE.WebGLProgram: Unsupported toneMapping:", n), t = "Linear"; + } + return "vec3 " + e + "( vec3 color ) { return " + t + "ToneMapping( color ); }"; +} +var sn1 = new w; +function tf1() { + Tt.getLuminanceCoefficients(sn1); + let e = sn1.x.toFixed(4), n = sn1.y.toFixed(4), t = sn1.z.toFixed(4); + return [ + "float luminance( const in vec3 rgb ) {", + ` const vec3 weights = vec3( ${e}, ${n}, ${t} );`, + " return dot( weights, rgb );", + "}" + ].join(` +`); +} +function nf1(e) { + return [ + e.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "", + e.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : "" + ].filter($t).join(` +`); +} +function rf1(e) { + let n = []; + for(let t in e){ + let i = e[t]; + i !== !1 && n.push("#define " + t + " " + i); } - _updateTime(e) { - let t = this._clip.duration, n = this.loop, i = this.time + e, r = this._loopCount, a = n === Rf; - if (e === 0) return r === -1 ? i : a && (r & 1) === 1 ? t - i : i; - if (n === wf) { - r === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1)); - e: { - if (i >= t) i = t; - else if (i < 0) i = 0; - else { - this.time = i; - break e; - } - this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = i, this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: e < 0 ? -1 : 1 - }); - } - } else { - if (r === -1 && (e >= 0 ? (r = 0, this._setEndings(!0, this.repetitions === 0, a)) : this._setEndings(this.repetitions === 0, !0, a)), i >= t || i < 0) { - let o = Math.floor(i / t); - i -= t * o, r += Math.abs(o); - let c = this.repetitions - r; - if (c <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, i = e > 0 ? t : 0, this.time = i, this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: e > 0 ? 1 : -1 - }); - else { - if (c === 1) { - let l = e < 0; - this._setEndings(l, !l, a); - } else this._setEndings(!1, !1, a); - this._loopCount = r, this.time = i, this._mixer.dispatchEvent({ - type: "loop", - action: this, - loopDelta: o - }); - } - } else this.time = i; - if (a && (r & 1) === 1) return t - i; - } - return i; + return n.join(` +`); +} +function af1(e, n) { + let t = {}, i = e.getProgramParameter(n, e.ACTIVE_ATTRIBUTES); + for(let c = 0; c < i; c++){ + let s = e.getActiveAttrib(n, c), h = s.name, d = 1; + s.type === e.FLOAT_MAT2 && (d = 2), s.type === e.FLOAT_MAT3 && (d = 3), s.type === e.FLOAT_MAT4 && (d = 4), t[h] = { + type: s.type, + location: e.getAttribLocation(n, h), + locationSize: d + }; } - _setEndings(e, t, n) { - let i = this._interpolantSettings; - n ? (i.endingStart = Vi, i.endingEnd = Vi) : (e ? i.endingStart = this.zeroSlopeAtStart ? Vi : zi : i.endingStart = Br, t ? i.endingEnd = this.zeroSlopeAtEnd ? Vi : zi : i.endingEnd = Br); - } - _scheduleFading(e, t, n) { - let i = this._mixer, r = i.time, a = this._weightInterpolant; - a === null && (a = i._lendControlInterpolant(), this._weightInterpolant = a); - let o = a.parameterPositions, c = a.sampleValues; - return o[0] = r, c[0] = t, o[1] = r + e, c[1] = n, this; - } -}, Ox = new Float32Array(1), Cu = class extends sn { - constructor(e){ - super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1; - } - _bindAction(e, t) { - let n = e._localRoot || this._root, i = e._clip.tracks, r = i.length, a = e._propertyBindings, o = e._interpolants, c = n.uuid, l = this._bindingsByRootAndName, h = l[c]; - h === void 0 && (h = {}, l[c] = h); - for(let u = 0; u !== r; ++u){ - let d = i[u], f = d.name, m = h[f]; - if (m !== void 0) ++m.referenceCount, a[u] = m; - else { - if (m = a[u], m !== void 0) { - m._cacheIndex === null && (++m.referenceCount, this._addInactiveBinding(m, c, f)); - continue; - } - let _ = t && t._propertyBindings[u].binding.parsedPath; - m = new Bc(Ke.create(n, f, _), d.ValueTypeName, d.getValueSize()), ++m.referenceCount, this._addInactiveBinding(m, c, f), a[u] = m; - } - o[u].resultBuffer = m.buffer; - } + return t; +} +function $t(e) { + return e !== ""; +} +function tr1(e, n) { + let t = n.numSpotLightShadows + n.numSpotLightMaps - n.numSpotLightShadowsWithMaps; + return e.replace(/NUM_DIR_LIGHTS/g, n.numDirLights).replace(/NUM_SPOT_LIGHTS/g, n.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, n.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, t).replace(/NUM_RECT_AREA_LIGHTS/g, n.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, n.numPointLights).replace(/NUM_HEMI_LIGHTS/g, n.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, n.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, n.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, n.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, n.numPointLightShadows); +} +function nr1(e, n) { + return e.replace(/NUM_CLIPPING_PLANES/g, n.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, n.numClippingPlanes - n.numClipIntersection); +} +var of1 = /^[ \t]*#include +<([\w\d./]+)>/gm; +function Yn1(e) { + return e.replace(of1, cf1); +} +var sf1 = new Map; +function cf1(e, n) { + let t = Pe1[n]; + if (t === void 0) { + let i = sf1.get(n); + if (i !== void 0) t = Pe1[i], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', n, i); + else throw new Error("Can not resolve #include <" + n + ">"); + } + return Yn1(t); +} +var lf1 = /#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 ir1(e) { + return e.replace(lf1, ff1); +} +function ff1(e, n, t, i) { + let c = ""; + for(let s = parseInt(n); s < parseInt(t); s++)c += i.replace(/\[\s*i\s*\]/g, "[ " + s + " ]").replace(/UNROLLED_LOOP_INDEX/g, s); + return c; +} +function rr1(e) { + let n = `precision ${e.precision} float; + precision ${e.precision} int; + precision ${e.precision} sampler2D; + precision ${e.precision} samplerCube; + precision ${e.precision} sampler3D; + precision ${e.precision} sampler2DArray; + precision ${e.precision} sampler2DShadow; + precision ${e.precision} samplerCubeShadow; + precision ${e.precision} sampler2DArrayShadow; + precision ${e.precision} isampler2D; + precision ${e.precision} isampler3D; + precision ${e.precision} isamplerCube; + precision ${e.precision} isampler2DArray; + precision ${e.precision} usampler2D; + precision ${e.precision} usampler3D; + precision ${e.precision} usamplerCube; + precision ${e.precision} usampler2DArray; + `; + return e.precision === "highp" ? n += ` +#define HIGH_PRECISION` : e.precision === "mediump" ? n += ` +#define MEDIUM_PRECISION` : e.precision === "lowp" && (n += ` +#define LOW_PRECISION`), n; +} +function df1(e) { + let n = "SHADOWMAP_TYPE_BASIC"; + return e.shadowMapType === Xd ? n = "SHADOWMAP_TYPE_PCF" : e.shadowMapType === Jd ? n = "SHADOWMAP_TYPE_PCF_SOFT" : e.shadowMapType === Zd && (n = "SHADOWMAP_TYPE_VSM"), n; +} +function uf1(e) { + let n = "ENVMAP_TYPE_CUBE"; + if (e.envMap) switch(e.envMapMode){ + case Uo: + case Hl: + n = "ENVMAP_TYPE_CUBE"; + break; + case Xl: + n = "ENVMAP_TYPE_CUBE_UV"; + break; } - _activateAction(e) { - if (!this._isActiveAction(e)) { - if (e._cacheIndex === null) { - let n = (e._localRoot || this._root).uuid, i = e._clip.uuid, r = this._actionsByClip[i]; - this._bindAction(e, r && r.knownActions[0]), this._addInactiveAction(e, i, n); - } - let t = e._propertyBindings; - for(let n = 0, i = t.length; n !== i; ++n){ - let r = t[n]; - r.useCount++ === 0 && (this._lendBinding(r), r.saveOriginalState()); - } - this._lendAction(e); - } + return n; +} +function pf1(e) { + let n = "ENVMAP_MODE_REFLECTION"; + if (e.envMap) switch(e.envMapMode){ + case Hl: + n = "ENVMAP_MODE_REFRACTION"; + break; } - _deactivateAction(e) { - if (this._isActiveAction(e)) { - let t = e._propertyBindings; - for(let n = 0, i = t.length; n !== i; ++n){ - let r = t[n]; - --r.useCount === 0 && (r.restoreOriginalState(), this._takeBackBinding(r)); - } - this._takeBackAction(e); - } + return n; +} +function hf1(e) { + let n = "ENVMAP_BLENDING_NONE"; + if (e.envMap) switch(e.combine){ + case Do: + n = "ENVMAP_BLENDING_MULTIPLY"; + break; + case Ap: + n = "ENVMAP_BLENDING_MIX"; + break; + case Sp: + n = "ENVMAP_BLENDING_ADD"; + break; } - _initMemoryManager() { - this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; - let 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; + return n; +} +function mf1(e) { + let n = e.envMapCubeUVHeight; + if (n === null) return null; + let t = Math.log2(n) - 2, i = 1 / n; + return { + texelWidth: 1 / (3 * Math.max(Math.pow(2, t), 7 * 16)), + texelHeight: i, + maxMip: t + }; +} +function _f1(e, n, t, i) { + let c = e.getContext(), s = t.defines, h = t.vertexShader, d = t.fragmentShader, I = df1(t), T = uf1(t), C = pf1(t), R = hf1(t), S = mf1(t), x1 = nf1(t), O = rf1(s), L = c.createProgram(), l, r, w = t.glslVersion ? "#version " + t.glslVersion + ` +` : ""; + t.isRawShaderMaterial ? (l = [ + "#define SHADER_TYPE " + t.shaderType, + "#define SHADER_NAME " + t.shaderName, + O + ].filter($t).join(` +`), l.length > 0 && (l += ` +`), r = [ + "#define SHADER_TYPE " + t.shaderType, + "#define SHADER_NAME " + t.shaderName, + O + ].filter($t).join(` +`), r.length > 0 && (r += ` +`)) : (l = [ + rr1(t), + "#define SHADER_TYPE " + t.shaderType, + "#define SHADER_NAME " + t.shaderName, + O, + t.extensionClipCullDistance ? "#define USE_CLIP_DISTANCE" : "", + t.batching ? "#define USE_BATCHING" : "", + t.batchingColor ? "#define USE_BATCHING_COLOR" : "", + t.instancing ? "#define USE_INSTANCING" : "", + t.instancingColor ? "#define USE_INSTANCING_COLOR" : "", + t.instancingMorph ? "#define USE_INSTANCING_MORPH" : "", + t.useFog && t.fog ? "#define USE_FOG" : "", + t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", + t.map ? "#define USE_MAP" : "", + t.envMap ? "#define USE_ENVMAP" : "", + t.envMap ? "#define " + C : "", + t.lightMap ? "#define USE_LIGHTMAP" : "", + t.aoMap ? "#define USE_AOMAP" : "", + t.bumpMap ? "#define USE_BUMPMAP" : "", + t.normalMap ? "#define USE_NORMALMAP" : "", + t.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", + t.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", + t.displacementMap ? "#define USE_DISPLACEMENTMAP" : "", + t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", + t.anisotropy ? "#define USE_ANISOTROPY" : "", + t.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", + t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", + t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", + t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", + t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", + t.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", + t.specularMap ? "#define USE_SPECULARMAP" : "", + t.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", + t.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", + t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", + t.metalnessMap ? "#define USE_METALNESSMAP" : "", + t.alphaMap ? "#define USE_ALPHAMAP" : "", + t.alphaHash ? "#define USE_ALPHAHASH" : "", + t.transmission ? "#define USE_TRANSMISSION" : "", + t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", + t.thicknessMap ? "#define USE_THICKNESSMAP" : "", + t.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", + t.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", + t.mapUv ? "#define MAP_UV " + t.mapUv : "", + t.alphaMapUv ? "#define ALPHAMAP_UV " + t.alphaMapUv : "", + t.lightMapUv ? "#define LIGHTMAP_UV " + t.lightMapUv : "", + t.aoMapUv ? "#define AOMAP_UV " + t.aoMapUv : "", + t.emissiveMapUv ? "#define EMISSIVEMAP_UV " + t.emissiveMapUv : "", + t.bumpMapUv ? "#define BUMPMAP_UV " + t.bumpMapUv : "", + t.normalMapUv ? "#define NORMALMAP_UV " + t.normalMapUv : "", + t.displacementMapUv ? "#define DISPLACEMENTMAP_UV " + t.displacementMapUv : "", + t.metalnessMapUv ? "#define METALNESSMAP_UV " + t.metalnessMapUv : "", + t.roughnessMapUv ? "#define ROUGHNESSMAP_UV " + t.roughnessMapUv : "", + t.anisotropyMapUv ? "#define ANISOTROPYMAP_UV " + t.anisotropyMapUv : "", + t.clearcoatMapUv ? "#define CLEARCOATMAP_UV " + t.clearcoatMapUv : "", + t.clearcoatNormalMapUv ? "#define CLEARCOAT_NORMALMAP_UV " + t.clearcoatNormalMapUv : "", + t.clearcoatRoughnessMapUv ? "#define CLEARCOAT_ROUGHNESSMAP_UV " + t.clearcoatRoughnessMapUv : "", + t.iridescenceMapUv ? "#define IRIDESCENCEMAP_UV " + t.iridescenceMapUv : "", + t.iridescenceThicknessMapUv ? "#define IRIDESCENCE_THICKNESSMAP_UV " + t.iridescenceThicknessMapUv : "", + t.sheenColorMapUv ? "#define SHEEN_COLORMAP_UV " + t.sheenColorMapUv : "", + t.sheenRoughnessMapUv ? "#define SHEEN_ROUGHNESSMAP_UV " + t.sheenRoughnessMapUv : "", + t.specularMapUv ? "#define SPECULARMAP_UV " + t.specularMapUv : "", + t.specularColorMapUv ? "#define SPECULAR_COLORMAP_UV " + t.specularColorMapUv : "", + t.specularIntensityMapUv ? "#define SPECULAR_INTENSITYMAP_UV " + t.specularIntensityMapUv : "", + t.transmissionMapUv ? "#define TRANSMISSIONMAP_UV " + t.transmissionMapUv : "", + t.thicknessMapUv ? "#define THICKNESSMAP_UV " + t.thicknessMapUv : "", + t.vertexTangents && t.flatShading === !1 ? "#define USE_TANGENT" : "", + t.vertexColors ? "#define USE_COLOR" : "", + t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", + t.vertexUv1s ? "#define USE_UV1" : "", + t.vertexUv2s ? "#define USE_UV2" : "", + t.vertexUv3s ? "#define USE_UV3" : "", + t.pointsUvs ? "#define USE_POINTS_UV" : "", + t.flatShading ? "#define FLAT_SHADED" : "", + t.skinning ? "#define USE_SKINNING" : "", + t.morphTargets ? "#define USE_MORPHTARGETS" : "", + t.morphNormals && t.flatShading === !1 ? "#define USE_MORPHNORMALS" : "", + t.morphColors ? "#define USE_MORPHCOLORS" : "", + t.morphTargetsCount > 0 ? "#define MORPHTARGETS_TEXTURE_STRIDE " + t.morphTextureStride : "", + t.morphTargetsCount > 0 ? "#define MORPHTARGETS_COUNT " + t.morphTargetsCount : "", + t.doubleSided ? "#define DOUBLE_SIDED" : "", + t.flipSided ? "#define FLIP_SIDED" : "", + t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", + t.shadowMapEnabled ? "#define " + I : "", + t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", + t.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", + t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", + t.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", + "uniform mat4 modelMatrix;", + "uniform mat4 modelViewMatrix;", + "uniform mat4 projectionMatrix;", + "uniform mat4 viewMatrix;", + "uniform mat3 normalMatrix;", + "uniform vec3 cameraPosition;", + "uniform bool isOrthographic;", + "#ifdef USE_INSTANCING", + " attribute mat4 instanceMatrix;", + "#endif", + "#ifdef USE_INSTANCING_COLOR", + " attribute vec3 instanceColor;", + "#endif", + "#ifdef USE_INSTANCING_MORPH", + " uniform sampler2D morphTexture;", + "#endif", + "attribute vec3 position;", + "attribute vec3 normal;", + "attribute vec2 uv;", + "#ifdef USE_UV1", + " attribute vec2 uv1;", + "#endif", + "#ifdef USE_UV2", + " attribute vec2 uv2;", + "#endif", + "#ifdef USE_UV3", + " attribute vec2 uv3;", + "#endif", + "#ifdef USE_TANGENT", + " attribute vec4 tangent;", + "#endif", + "#if defined( USE_COLOR_ALPHA )", + " attribute vec4 color;", + "#elif defined( USE_COLOR )", + " attribute vec3 color;", + "#endif", + "#ifdef USE_SKINNING", + " attribute vec4 skinIndex;", + " attribute vec4 skinWeight;", + "#endif", + ` +` + ].filter($t).join(` +`), r = [ + rr1(t), + "#define SHADER_TYPE " + t.shaderType, + "#define SHADER_NAME " + t.shaderName, + O, + t.useFog && t.fog ? "#define USE_FOG" : "", + t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", + t.alphaToCoverage ? "#define ALPHA_TO_COVERAGE" : "", + t.map ? "#define USE_MAP" : "", + t.matcap ? "#define USE_MATCAP" : "", + t.envMap ? "#define USE_ENVMAP" : "", + t.envMap ? "#define " + T : "", + t.envMap ? "#define " + C : "", + t.envMap ? "#define " + R : "", + S ? "#define CUBEUV_TEXEL_WIDTH " + S.texelWidth : "", + S ? "#define CUBEUV_TEXEL_HEIGHT " + S.texelHeight : "", + S ? "#define CUBEUV_MAX_MIP " + S.maxMip + ".0" : "", + t.lightMap ? "#define USE_LIGHTMAP" : "", + t.aoMap ? "#define USE_AOMAP" : "", + t.bumpMap ? "#define USE_BUMPMAP" : "", + t.normalMap ? "#define USE_NORMALMAP" : "", + t.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", + t.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", + t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", + t.anisotropy ? "#define USE_ANISOTROPY" : "", + t.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", + t.clearcoat ? "#define USE_CLEARCOAT" : "", + t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", + t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", + t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", + t.dispersion ? "#define USE_DISPERSION" : "", + t.iridescence ? "#define USE_IRIDESCENCE" : "", + t.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", + t.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", + t.specularMap ? "#define USE_SPECULARMAP" : "", + t.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", + t.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", + t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", + t.metalnessMap ? "#define USE_METALNESSMAP" : "", + t.alphaMap ? "#define USE_ALPHAMAP" : "", + t.alphaTest ? "#define USE_ALPHATEST" : "", + t.alphaHash ? "#define USE_ALPHAHASH" : "", + t.sheen ? "#define USE_SHEEN" : "", + t.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", + t.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", + t.transmission ? "#define USE_TRANSMISSION" : "", + t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", + t.thicknessMap ? "#define USE_THICKNESSMAP" : "", + t.vertexTangents && t.flatShading === !1 ? "#define USE_TANGENT" : "", + t.vertexColors || t.instancingColor || t.batchingColor ? "#define USE_COLOR" : "", + t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", + t.vertexUv1s ? "#define USE_UV1" : "", + t.vertexUv2s ? "#define USE_UV2" : "", + t.vertexUv3s ? "#define USE_UV3" : "", + t.pointsUvs ? "#define USE_POINTS_UV" : "", + t.gradientMap ? "#define USE_GRADIENTMAP" : "", + t.flatShading ? "#define FLAT_SHADED" : "", + t.doubleSided ? "#define DOUBLE_SIDED" : "", + t.flipSided ? "#define FLIP_SIDED" : "", + t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", + t.shadowMapEnabled ? "#define " + I : "", + t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", + t.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", + t.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", + t.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "", + t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", + t.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", + "uniform mat4 viewMatrix;", + "uniform vec3 cameraPosition;", + "uniform bool isOrthographic;", + t.toneMapping !== Tp ? "#define TONE_MAPPING" : "", + t.toneMapping !== Tp ? Pe1.tonemapping_pars_fragment : "", + t.toneMapping !== Tp ? ef1("toneMapping", t.toneMapping) : "", + t.dithering ? "#define DITHERING" : "", + t.opaque ? "#define OPAQUE" : "", + Pe1.colorspace_pars_fragment, + jl1("linearToOutputTexel", t.outputColorSpace), + tf1(), + t.useDepthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", + ` +` + ].filter($t).join(` +`)), h = Yn1(h), h = tr1(h, t), h = nr1(h, t), d = Yn1(d), d = tr1(d, t), d = nr1(d, t), h = ir1(h), d = ir1(d), t.isRawShaderMaterial !== !0 && (w = `#version 300 es +`, l = [ + x1, + "#define attribute in", + "#define varying out", + "#define texture2D texture" + ].join(` +`) + ` +` + l, r = [ + "#define varying in", + t.glslVersion === Af ? "" : "layout(location = 0) out highp vec4 pc_fragColor;", + t.glslVersion === Af ? "" : "#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(` +`) + ` +` + r); + let M = w + l + h, _ = w + r + d, H = Ji1(c, c.VERTEX_SHADER, M), P = Ji1(c, c.FRAGMENT_SHADER, _); + c.attachShader(L, H), c.attachShader(L, P), t.index0AttributeName !== void 0 ? c.bindAttribLocation(L, 0, t.index0AttributeName) : t.morphTargets === !0 && c.bindAttribLocation(L, 0, "position"), c.linkProgram(L); + function y1(A) { + if (e.debug.checkShaderErrors) { + let q = c.getProgramInfoLog(L).trim(), V = c.getShaderInfoLog(H).trim(), Y = c.getShaderInfoLog(P).trim(), Q = !0, z = !0; + if (c.getProgramParameter(L, c.LINK_STATUS) === !1) if (Q = !1, typeof e.debug.onShaderError == "function") e.debug.onShaderError(c, L, H, P); + else { + let j = er1(c, H, "vertex"), F = er1(c, P, "fragment"); + console.error("THREE.WebGLProgram: Shader Error " + c.getError() + " - VALIDATE_STATUS " + c.getProgramParameter(L, c.VALIDATE_STATUS) + ` + +Material Name: ` + A.name + ` +Material Type: ` + A.type + ` + +Program Info Log: ` + q + ` +` + j + ` +` + F); + } + else q !== "" ? console.warn("THREE.WebGLProgram: Program Info Log:", q) : (V === "" || Y === "") && (z = !1); + z && (A.diagnostics = { + runnable: Q, + programLog: q, + vertexShader: { + log: V, + prefix: l }, - get inUse () { - return e._nActiveControlInterpolants; + fragmentShader: { + log: Y, + prefix: r } - } - }; - } - _isActiveAction(e) { - let t = e._cacheIndex; - return t !== null && t < this._nActiveActions; - } - _addInactiveAction(e, t, n) { - let i = this._actions, r = this._actionsByClip, a = r[t]; - if (a === void 0) a = { - knownActions: [ - e - ], - actionByRoot: {} - }, e._byClipCacheIndex = 0, r[t] = a; - else { - let o = a.knownActions; - e._byClipCacheIndex = o.length, o.push(e); - } - e._cacheIndex = i.length, i.push(e), a.actionByRoot[n] = e; - } - _removeInactiveAction(e) { - let t = this._actions, n = t[t.length - 1], i = e._cacheIndex; - n._cacheIndex = i, t[i] = n, t.pop(), e._cacheIndex = null; - let r = e._clip.uuid, a = this._actionsByClip, o = a[r], c = o.knownActions, l = c[c.length - 1], h = e._byClipCacheIndex; - l._byClipCacheIndex = h, c[h] = l, c.pop(), e._byClipCacheIndex = null; - let u = o.actionByRoot, d = (e._localRoot || this._root).uuid; - delete u[d], c.length === 0 && delete a[r], this._removeInactiveBindingsForAction(e); - } - _removeInactiveBindingsForAction(e) { - let t = e._propertyBindings; - for(let n = 0, i = t.length; n !== i; ++n){ - let r = t[n]; - --r.referenceCount === 0 && this._removeInactiveBinding(r); + }); } + c.deleteShader(H), c.deleteShader(P), B = new Vt1(c, L), p = af1(c, L); } - _lendAction(e) { - let t = this._actions, n = e._cacheIndex, i = this._nActiveActions++, r = t[i]; - e._cacheIndex = i, t[i] = e, r._cacheIndex = n, t[n] = r; - } - _takeBackAction(e) { - let t = this._actions, n = e._cacheIndex, i = --this._nActiveActions, r = t[i]; - e._cacheIndex = i, t[i] = e, r._cacheIndex = n, t[n] = r; - } - _addInactiveBinding(e, t, n) { - let i = this._bindingsByRootAndName, r = this._bindings, a = i[t]; - a === void 0 && (a = {}, i[t] = a), a[n] = e, e._cacheIndex = r.length, r.push(e); - } - _removeInactiveBinding(e) { - let t = this._bindings, n = e.binding, i = n.rootNode.uuid, r = n.path, a = this._bindingsByRootAndName, o = a[i], c = t[t.length - 1], l = e._cacheIndex; - c._cacheIndex = l, t[l] = c, t.pop(), delete o[r], Object.keys(o).length === 0 && delete a[i]; - } - _lendBinding(e) { - let t = this._bindings, n = e._cacheIndex, i = this._nActiveBindings++, r = t[i]; - e._cacheIndex = i, t[i] = e, r._cacheIndex = n, t[n] = r; - } - _takeBackBinding(e) { - let t = this._bindings, n = e._cacheIndex, i = --this._nActiveBindings, r = t[i]; - e._cacheIndex = i, t[i] = e, r._cacheIndex = n, t[n] = r; + let B; + this.getUniforms = function() { + return B === void 0 && y1(this), B; + }; + let p; + this.getAttributes = function() { + return p === void 0 && y1(this), p; + }; + let f = t.rendererExtensionParallelShaderCompile === !1; + return this.isReady = function() { + return f === !1 && (f = c.getProgramParameter(L, $l1)), f; + }, this.destroy = function() { + i.releaseStatesOfProgram(this), c.deleteProgram(L), this.program = void 0; + }, this.type = t.shaderType, this.name = t.shaderName, this.id = Zl1++, this.cacheKey = n, this.usedTimes = 1, this.program = L, this.vertexShader = H, this.fragmentShader = P, this; +} +var vf1 = 0, qn1 = class { + constructor(){ + this.shaderCache = new Map, this.materialCache = new Map; } - _lendControlInterpolant() { - let e = this._controlInterpolants, t = this._nActiveControlInterpolants++, n = e[t]; - return n === void 0 && (n = new fa(new Float32Array(2), new Float32Array(2), 1, Ox), n.__cacheIndex = t, e[t] = n), n; + update(n) { + let t = n.vertexShader, i = n.fragmentShader, c = this._getShaderStage(t), s = this._getShaderStage(i), h = this._getShaderCacheForMaterial(n); + return h.has(c) === !1 && (h.add(c), c.usedTimes++), h.has(s) === !1 && (h.add(s), s.usedTimes++), this; } - _takeBackControlInterpolant(e) { - let t = this._controlInterpolants, n = e.__cacheIndex, i = --this._nActiveControlInterpolants, r = t[i]; - e.__cacheIndex = i, t[i] = e, r.__cacheIndex = n, t[n] = r; + remove(n) { + let t = this.materialCache.get(n); + for (let i of t)i.usedTimes--, i.usedTimes === 0 && this.shaderCache.delete(i.code); + return this.materialCache.delete(n), this; } - clipAction(e, t, n) { - let i = t || this._root, r = i.uuid, a = typeof e == "string" ? is.findByName(i, e) : e, o = a !== null ? a.uuid : e, c = this._actionsByClip[o], l = null; - if (n === void 0 && (a !== null ? n = a.blendMode : n = Xc), c !== void 0) { - let u = c.actionByRoot[r]; - if (u !== void 0 && u.blendMode === n) return u; - l = c.knownActions[0], a === null && (a = l._clip); - } - if (a === null) return null; - let h = new Vc(this, a, t, n); - return this._bindAction(h, l), this._addInactiveAction(h, o, r), h; + getVertexShaderID(n) { + return this._getShaderStage(n.vertexShader).id; } - existingAction(e, t) { - let n = t || this._root, i = n.uuid, r = typeof e == "string" ? is.findByName(n, e) : e, a = r ? r.uuid : e, o = this._actionsByClip[a]; - return o !== void 0 && o.actionByRoot[i] || null; + getFragmentShaderID(n) { + return this._getShaderStage(n.fragmentShader).id; } - stopAllAction() { - let e = this._actions, t = this._nActiveActions; - for(let n = t - 1; n >= 0; --n)e[n].stop(); - return this; + dispose() { + this.shaderCache.clear(), this.materialCache.clear(); } - update(e) { - e *= this.timeScale; - let t = this._actions, n = this._nActiveActions, i = this.time += e, r = Math.sign(e), a = this._accuIndex ^= 1; - for(let l = 0; l !== n; ++l)t[l]._update(i, e, r, a); - let o = this._bindings, c = this._nActiveBindings; - for(let l = 0; l !== c; ++l)o[l].apply(a); - return this; + _getShaderCacheForMaterial(n) { + let t = this.materialCache, i = t.get(n); + return i === void 0 && (i = new Set, t.set(n, i)), i; } - setTime(e) { - this.time = 0; - for(let t = 0; t < this._actions.length; t++)this._actions[t].time = 0; - return this.update(e); + _getShaderStage(n) { + let t = this.shaderCache, i = t.get(n); + return i === void 0 && (i = new Kn1(n), t.set(n, i)), i; } - getRoot() { - return this._root; +}, Kn1 = class { + constructor(n){ + this.id = vf1++, this.code = n, this.usedTimes = 0; } - uncacheClip(e) { - let t = this._actions, n = e.uuid, i = this._actionsByClip, r = i[n]; - if (r !== void 0) { - let a = r.knownActions; - for(let o = 0, c = a.length; o !== c; ++o){ - let l = a[o]; - this._deactivateAction(l); - let h = l._cacheIndex, u = t[t.length - 1]; - l._cacheIndex = null, l._byClipCacheIndex = null, u._cacheIndex = h, t[h] = u, t.pop(), this._removeInactiveBindingsForAction(l); +}; +function gf1(e, n, t, i, c, s, h) { + let d = new js, I = new qn1, T = new Set, C = [], R = c.logarithmicDepthBuffer, S = c.vertexTextures, x1 = c.precision, O = { + 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 L(p) { + return T.add(p), p === 0 ? "uv" : `uv${p}`; + } + function l(p, f, A, q, V) { + let Y = q.fog, Q = V.geometry, z = p.isMeshStandardMaterial ? q.environment : null, j = (p.isMeshStandardMaterial ? t : n).get(p.envMap || z), F = j && j.mapping === Xl ? j.image.height : null, me = O[p.type]; + p.precision !== null && (x1 = c.getMaxPrecision(p.precision), x1 !== p.precision && console.warn("THREE.WebGLProgram.getParameters:", p.precision, "not supported, using", x1, "instead.")); + let Me = Q.morphAttributes.position || Q.morphAttributes.normal || Q.morphAttributes.color, Le = Me !== void 0 ? Me.length : 0, Ge = 0; + Q.morphAttributes.position !== void 0 && (Ge = 1), Q.morphAttributes.normal !== void 0 && (Ge = 2), Q.morphAttributes.color !== void 0 && (Ge = 3); + let Ze, k, J, ue; + if (me) { + let ke = gt1[me]; + Ze = ke.vertexShader, k = ke.fragmentShader; + } else Ze = p.vertexShader, k = p.fragmentShader, I.update(p), J = I.getVertexShaderID(p), ue = I.getFragmentShaderID(p); + let ie = e.getRenderTarget(), Ee = e.state.buffers.depth.getReversed(), Be = V.isInstancedMesh === !0, Te = V.isBatchedMesh === !0, je = !!p.map, $e = !!p.matcap, Ue = !!j, m = !!p.aoMap, ut = !!p.lightMap, De = !!p.bumpMap, we = !!p.normalMap, _e = !!p.displacementMap, Xe = !!p.emissiveMap, he = !!p.metalnessMap, u = !!p.roughnessMap, a = p.anisotropy > 0, b = p.clearcoat > 0, W = p.dispersion > 0, K = p.iridescence > 0, G = p.sheen > 0, pe = p.transmission > 0, re = a && !!p.anisotropyMap, ce = b && !!p.clearcoatMap, ye = b && !!p.clearcoatNormalMap, Z = b && !!p.clearcoatRoughnessMap, le = K && !!p.iridescenceMap, Se = K && !!p.iridescenceThicknessMap, xe = G && !!p.sheenColorMap, fe = G && !!p.sheenRoughnessMap, Ie = !!p.specularMap, be = !!p.specularColorMap, ze = !!p.specularIntensityMap, v = pe && !!p.transmissionMap, te = pe && !!p.thicknessMap, N = !!p.gradientMap, X = !!p.alphaMap, oe = p.alphaTest > 0, ae = !!p.alphaHash, Ce = !!p.extensions, Qe = Tp; + p.toneMapped && (ie === null || ie.isXRRenderTarget === !0) && (Qe = e.toneMapping); + let at = { + shaderID: me, + shaderType: p.type, + shaderName: p.name, + vertexShader: Ze, + fragmentShader: k, + defines: p.defines, + customVertexShaderID: J, + customFragmentShaderID: ue, + isRawShaderMaterial: p.isRawShaderMaterial === !0, + glslVersion: p.glslVersion, + precision: x1, + batching: Te, + batchingColor: Te && V._colorsTexture !== null, + instancing: Be, + instancingColor: Be && V.instanceColor !== null, + instancingMorph: Be && V.morphTexture !== null, + supportsVertexTextures: S, + outputColorSpace: ie === null ? e.outputColorSpace : ie.isXRRenderTarget === !0 ? ie.texture.colorSpace : ha, + alphaToCoverage: !!p.alphaToCoverage, + map: je, + matcap: $e, + envMap: Ue, + envMapMode: Ue && j.mapping, + envMapCubeUVHeight: F, + aoMap: m, + lightMap: ut, + bumpMap: De, + normalMap: we, + displacementMap: S && _e, + emissiveMap: Xe, + normalMapObjectSpace: we && p.normalMapType === Gp, + normalMapTangentSpace: we && p.normalMapType === _i, + metalnessMap: he, + roughnessMap: u, + anisotropy: a, + anisotropyMap: re, + clearcoat: b, + clearcoatMap: ce, + clearcoatNormalMap: ye, + clearcoatRoughnessMap: Z, + dispersion: W, + iridescence: K, + iridescenceMap: le, + iridescenceThicknessMap: Se, + sheen: G, + sheenColorMap: xe, + sheenRoughnessMap: fe, + specularMap: Ie, + specularColorMap: be, + specularIntensityMap: ze, + transmission: pe, + transmissionMap: v, + thicknessMap: te, + gradientMap: N, + opaque: p.transparent === !1 && p.blending === ea && p.alphaToCoverage === !1, + alphaMap: X, + alphaTest: oe, + alphaHash: ae, + combine: p.combine, + mapUv: je && L(p.map.channel), + aoMapUv: m && L(p.aoMap.channel), + lightMapUv: ut && L(p.lightMap.channel), + bumpMapUv: De && L(p.bumpMap.channel), + normalMapUv: we && L(p.normalMap.channel), + displacementMapUv: _e && L(p.displacementMap.channel), + emissiveMapUv: Xe && L(p.emissiveMap.channel), + metalnessMapUv: he && L(p.metalnessMap.channel), + roughnessMapUv: u && L(p.roughnessMap.channel), + anisotropyMapUv: re && L(p.anisotropyMap.channel), + clearcoatMapUv: ce && L(p.clearcoatMap.channel), + clearcoatNormalMapUv: ye && L(p.clearcoatNormalMap.channel), + clearcoatRoughnessMapUv: Z && L(p.clearcoatRoughnessMap.channel), + iridescenceMapUv: le && L(p.iridescenceMap.channel), + iridescenceThicknessMapUv: Se && L(p.iridescenceThicknessMap.channel), + sheenColorMapUv: xe && L(p.sheenColorMap.channel), + sheenRoughnessMapUv: fe && L(p.sheenRoughnessMap.channel), + specularMapUv: Ie && L(p.specularMap.channel), + specularColorMapUv: be && L(p.specularColorMap.channel), + specularIntensityMapUv: ze && L(p.specularIntensityMap.channel), + transmissionMapUv: v && L(p.transmissionMap.channel), + thicknessMapUv: te && L(p.thicknessMap.channel), + alphaMapUv: X && L(p.alphaMap.channel), + vertexTangents: !!Q.attributes.tangent && (we || a), + vertexColors: p.vertexColors, + vertexAlphas: p.vertexColors === !0 && !!Q.attributes.color && Q.attributes.color.itemSize === 4, + pointsUvs: V.isPoints === !0 && !!Q.attributes.uv && (je || X), + fog: !!Y, + useFog: p.fog === !0, + fogExp2: !!Y && Y.isFogExp2, + flatShading: p.flatShading === !0, + sizeAttenuation: p.sizeAttenuation === !0, + logarithmicDepthBuffer: R, + reverseDepthBuffer: Ee, + skinning: V.isSkinnedMesh === !0, + morphTargets: Q.morphAttributes.position !== void 0, + morphNormals: Q.morphAttributes.normal !== void 0, + morphColors: Q.morphAttributes.color !== void 0, + morphTargetsCount: Le, + morphTextureStride: Ge, + numDirLights: f.directional.length, + numPointLights: f.point.length, + numSpotLights: f.spot.length, + numSpotLightMaps: f.spotLightMap.length, + numRectAreaLights: f.rectArea.length, + numHemiLights: f.hemi.length, + numDirLightShadows: f.directionalShadowMap.length, + numPointLightShadows: f.pointShadowMap.length, + numSpotLightShadows: f.spotShadowMap.length, + numSpotLightShadowsWithMaps: f.numSpotLightShadowsWithMaps, + numLightProbes: f.numLightProbes, + numClippingPlanes: h.numPlanes, + numClipIntersection: h.numIntersection, + dithering: p.dithering, + shadowMapEnabled: e.shadowMap.enabled && A.length > 0, + shadowMapType: e.shadowMap.type, + toneMapping: Qe, + decodeVideoTexture: je && p.map.isVideoTexture === !0 && Tt.getTransfer(p.map.colorSpace) === Fn, + decodeVideoTextureEmissive: Xe && p.emissiveMap.isVideoTexture === !0 && Tt.getTransfer(p.emissiveMap.colorSpace) === Fn, + premultipliedAlpha: p.premultipliedAlpha, + doubleSided: p.side === Yd, + flipSided: p.side === Al, + useDepthPacking: p.depthPacking >= 0, + depthPacking: p.depthPacking || 0, + index0AttributeName: p.index0AttributeName, + extensionClipCullDistance: Ce && p.extensions.clipCullDistance === !0 && i.has("WEBGL_clip_cull_distance"), + extensionMultiDraw: (Ce && p.extensions.multiDraw === !0 || Te) && i.has("WEBGL_multi_draw"), + rendererExtensionParallelShaderCompile: i.has("KHR_parallel_shader_compile"), + customProgramCacheKey: p.customProgramCacheKey() + }; + return at.vertexUv1s = T.has(1), at.vertexUv2s = T.has(2), at.vertexUv3s = T.has(3), T.clear(), at; + } + function r(p) { + let f = []; + if (p.shaderID ? f.push(p.shaderID) : (f.push(p.customVertexShaderID), f.push(p.customFragmentShaderID)), p.defines !== void 0) for(let A in p.defines)f.push(A), f.push(p.defines[A]); + return p.isRawShaderMaterial === !1 && (w(f, p), M(f, p), f.push(e.outputColorSpace)), f.push(p.customProgramCacheKey), f.join(); + } + function w(p, f) { + p.push(f.precision), p.push(f.outputColorSpace), p.push(f.envMapMode), p.push(f.envMapCubeUVHeight), p.push(f.mapUv), p.push(f.alphaMapUv), p.push(f.lightMapUv), p.push(f.aoMapUv), p.push(f.bumpMapUv), p.push(f.normalMapUv), p.push(f.displacementMapUv), p.push(f.emissiveMapUv), p.push(f.metalnessMapUv), p.push(f.roughnessMapUv), p.push(f.anisotropyMapUv), p.push(f.clearcoatMapUv), p.push(f.clearcoatNormalMapUv), p.push(f.clearcoatRoughnessMapUv), p.push(f.iridescenceMapUv), p.push(f.iridescenceThicknessMapUv), p.push(f.sheenColorMapUv), p.push(f.sheenRoughnessMapUv), p.push(f.specularMapUv), p.push(f.specularColorMapUv), p.push(f.specularIntensityMapUv), p.push(f.transmissionMapUv), p.push(f.thicknessMapUv), p.push(f.combine), p.push(f.fogExp2), p.push(f.sizeAttenuation), p.push(f.morphTargetsCount), p.push(f.morphAttributeCount), p.push(f.numDirLights), p.push(f.numPointLights), p.push(f.numSpotLights), p.push(f.numSpotLightMaps), p.push(f.numHemiLights), p.push(f.numRectAreaLights), p.push(f.numDirLightShadows), p.push(f.numPointLightShadows), p.push(f.numSpotLightShadows), p.push(f.numSpotLightShadowsWithMaps), p.push(f.numLightProbes), p.push(f.shadowMapType), p.push(f.toneMapping), p.push(f.numClippingPlanes), p.push(f.numClipIntersection), p.push(f.depthPacking); + } + function M(p, f) { + d.disableAll(), f.supportsVertexTextures && d.enable(0), f.instancing && d.enable(1), f.instancingColor && d.enable(2), f.instancingMorph && d.enable(3), f.matcap && d.enable(4), f.envMap && d.enable(5), f.normalMapObjectSpace && d.enable(6), f.normalMapTangentSpace && d.enable(7), f.clearcoat && d.enable(8), f.iridescence && d.enable(9), f.alphaTest && d.enable(10), f.vertexColors && d.enable(11), f.vertexAlphas && d.enable(12), f.vertexUv1s && d.enable(13), f.vertexUv2s && d.enable(14), f.vertexUv3s && d.enable(15), f.vertexTangents && d.enable(16), f.anisotropy && d.enable(17), f.alphaHash && d.enable(18), f.batching && d.enable(19), f.dispersion && d.enable(20), f.batchingColor && d.enable(21), p.push(d.mask), d.disableAll(), f.fog && d.enable(0), f.useFog && d.enable(1), f.flatShading && d.enable(2), f.logarithmicDepthBuffer && d.enable(3), f.reverseDepthBuffer && d.enable(4), f.skinning && d.enable(5), f.morphTargets && d.enable(6), f.morphNormals && d.enable(7), f.morphColors && d.enable(8), f.premultipliedAlpha && d.enable(9), f.shadowMapEnabled && d.enable(10), f.doubleSided && d.enable(11), f.flipSided && d.enable(12), f.useDepthPacking && d.enable(13), f.dithering && d.enable(14), f.transmission && d.enable(15), f.sheen && d.enable(16), f.opaque && d.enable(17), f.pointsUvs && d.enable(18), f.decodeVideoTexture && d.enable(19), f.decodeVideoTextureEmissive && d.enable(20), f.alphaToCoverage && d.enable(21), p.push(d.mask); + } + function _(p) { + let f = O[p.type], A; + if (f) { + let q = gt1[f]; + A = kf.clone(q.uniforms); + } else A = p.uniforms; + return A; + } + function H(p, f) { + let A; + for(let q = 0, V = C.length; q < V; q++){ + let Y = C[q]; + if (Y.cacheKey === f) { + A = Y, ++A.usedTimes; + break; } - delete i[n]; } + return A === void 0 && (A = new _f1(e, f, p, s), C.push(A)), A; } - uncacheRoot(e) { - let t = e.uuid, n = this._actionsByClip; - for(let a in n){ - let o = n[a].actionByRoot, c = o[t]; - c !== void 0 && (this._deactivateAction(c), this._removeInactiveAction(c)); - } - let i = this._bindingsByRootAndName, r = i[t]; - if (r !== void 0) for(let a in r){ - let o = r[a]; - o.restoreOriginalState(), this._removeInactiveBinding(o); + function P(p) { + if (--p.usedTimes === 0) { + let f = C.indexOf(p); + C[f] = C[C.length - 1], C.pop(), p.destroy(); } } - uncacheAction(e, t) { - let n = this.existingAction(e, t); - n !== null && (this._deactivateAction(n), this._removeInactiveAction(n)); - } -}, Pu = class s1 { - constructor(e){ - this.value = e; - } - clone() { - return new s1(this.value.clone === void 0 ? this.value : this.value.clone()); - } -}, Fx = 0, Lu = class extends sn { - constructor(){ - super(), this.isUniformsGroup = !0, Object.defineProperty(this, "id", { - value: Fx++ - }), this.name = "", this.usage = Hr, this.uniforms = []; - } - add(e) { - return this.uniforms.push(e), this; - } - remove(e) { - let t = this.uniforms.indexOf(e); - return t !== -1 && this.uniforms.splice(t, 1), this; - } - setName(e) { - return this.name = e, this; + function y1(p) { + I.remove(p); } - setUsage(e) { - return this.usage = e, this; - } - dispose() { - return this.dispatchEvent({ - type: "dispose" - }), this; - } - copy(e) { - this.name = e.name, this.usage = e.usage; - let t = e.uniforms; - this.uniforms.length = 0; - for(let n = 0, i = t.length; n < i; n++)this.uniforms.push(t[n].clone()); - return this; - } - clone() { - return new this.constructor().copy(this); - } -}, Iu = class extends Is { - constructor(e, t, n = 1){ - super(e, t), this.isInstancedInterleavedBuffer = !0, this.meshPerAttribute = n; - } - copy(e) { - return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; - } - clone(e) { - let t = super.clone(e); - return t.meshPerAttribute = this.meshPerAttribute, t; - } - toJSON(e) { - let t = super.toJSON(e); - return t.isInstancedInterleavedBuffer = !0, t.meshPerAttribute = this.meshPerAttribute, t; - } -}, Uu = class { - constructor(e, t, n, i, r){ - this.isGLBufferAttribute = !0, this.name = "", this.buffer = e, this.type = t, this.itemSize = n, this.elementSize = i, this.count = r, this.version = 0; - } - set needsUpdate(e) { - e === !0 && this.version++; + function B() { + I.dispose(); } - setBuffer(e) { - return this.buffer = e, this; + return { + getParameters: l, + getProgramCacheKey: r, + getUniforms: _, + acquireProgram: H, + releaseProgram: P, + releaseShaderCache: y1, + programs: C, + dispose: B + }; +} +function Sf1() { + let e = new WeakMap; + function n(h) { + return e.has(h); } - setType(e, t) { - return this.type = e, this.elementSize = t, this; + function t(h) { + let d = e.get(h); + return d === void 0 && (d = {}, e.set(h, d)), d; } - setItemSize(e) { - return this.itemSize = e, this; + function i(h) { + e.delete(h); } - setCount(e) { - return this.count = e, this; + function c(h, d, I) { + e.get(h)[d] = I; } -}, Du = class { - constructor(e, t, n = 0, i = 1 / 0){ - this.ray = new hi(e, t), this.near = n, this.far = i, this.camera = null, this.layers = new Rs, this.params = { - Mesh: {}, - Line: { - threshold: 1 - }, - LOD: {}, - Points: { - threshold: 1 - }, - Sprite: {} - }; + function s() { + e = new WeakMap; } - set(e, t) { - this.ray.set(e, t); + return { + has: n, + get: t, + remove: i, + update: c, + dispose: s + }; +} +function Ef1(e, n) { + return e.groupOrder !== n.groupOrder ? e.groupOrder - n.groupOrder : e.renderOrder !== n.renderOrder ? e.renderOrder - n.renderOrder : e.material.id !== n.material.id ? e.material.id - n.material.id : e.z !== n.z ? e.z - n.z : e.id - n.id; +} +function ar1(e, n) { + return e.groupOrder !== n.groupOrder ? e.groupOrder - n.groupOrder : e.renderOrder !== n.renderOrder ? e.renderOrder - n.renderOrder : e.z !== n.z ? n.z - e.z : e.id - n.id; +} +function or1() { + let e = [], n = 0, t = [], i = [], c = []; + function s() { + n = 0, t.length = 0, i.length = 0, c.length = 0; + } + function h(R, S, x1, O, L, l) { + let r = e[n]; + return r === void 0 ? (r = { + id: R.id, + object: R, + geometry: S, + material: x1, + groupOrder: O, + renderOrder: R.renderOrder, + z: L, + group: l + }, e[n] = r) : (r.id = R.id, r.object = R, r.geometry = S, r.material = x1, r.groupOrder = O, r.renderOrder = R.renderOrder, r.z = L, r.group = l), n++, r; + } + function d(R, S, x1, O, L, l) { + let r = h(R, S, x1, O, L, l); + x1.transmission > 0 ? i.push(r) : x1.transparent === !0 ? c.push(r) : t.push(r); + } + function I(R, S, x1, O, L, l) { + let r = h(R, S, x1, O, L, l); + x1.transmission > 0 ? i.unshift(r) : x1.transparent === !0 ? c.unshift(r) : t.unshift(r); + } + function T(R, S) { + t.length > 1 && t.sort(R || Ef1), i.length > 1 && i.sort(S || ar1), c.length > 1 && c.sort(S || ar1); } - setFromCamera(e, t) { - t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, .5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type); + function C() { + for(let R = n, S = e.length; R < S; R++){ + let x1 = e[R]; + if (x1.id === null) break; + x1.id = null, x1.object = null, x1.geometry = null, x1.material = null, x1.group = null; + } } - intersectObject(e, t = !0, n = []) { - return kc(e, this, n, t), n.sort(Nu), n; + return { + opaque: t, + transmissive: i, + transparent: c, + init: s, + push: d, + unshift: I, + finish: C, + sort: T + }; +} +function Mf1() { + let e = new WeakMap; + function n(i, c) { + let s = e.get(i), h; + return s === void 0 ? (h = new or1, e.set(i, [ + h + ])) : c >= s.length ? (h = new or1, s.push(h)) : h = s[c], h; } - intersectObjects(e, t = !0, n = []) { - for(let i = 0, r = e.length; i < r; i++)kc(e[i], this, n, t); - return n.sort(Nu), n; + function t() { + e = new WeakMap; } -}; -function Nu(s1, e) { - return s1.distance - e.distance; + return { + get: n, + dispose: t + }; +} +function Tf1() { + let e = {}; + return { + get: function(n) { + if (e[n.id] !== void 0) return e[n.id]; + let t; + switch(n.type){ + case "DirectionalLight": + t = { + direction: new w, + color: new P + }; + break; + case "SpotLight": + t = { + position: new w, + direction: new w, + color: new P, + distance: 0, + coneCos: 0, + penumbraCos: 0, + decay: 0 + }; + break; + case "PointLight": + t = { + position: new w, + color: new P, + distance: 0, + decay: 0 + }; + break; + case "HemisphereLight": + t = { + direction: new w, + skyColor: new P, + groundColor: new P + }; + break; + case "RectAreaLight": + t = { + color: new P, + position: new w, + halfWidth: new w, + halfHeight: new w + }; + break; + } + return e[n.id] = t, t; + } + }; +} +function xf1() { + let e = {}; + return { + get: function(n) { + if (e[n.id] !== void 0) return e[n.id]; + let t; + switch(n.type){ + case "DirectionalLight": + t = { + shadowIntensity: 1, + shadowBias: 0, + shadowNormalBias: 0, + shadowRadius: 1, + shadowMapSize: new T + }; + break; + case "SpotLight": + t = { + shadowIntensity: 1, + shadowBias: 0, + shadowNormalBias: 0, + shadowRadius: 1, + shadowMapSize: new T + }; + break; + case "PointLight": + t = { + shadowIntensity: 1, + shadowBias: 0, + shadowNormalBias: 0, + shadowRadius: 1, + shadowMapSize: new T, + shadowCameraNear: 1, + shadowCameraFar: 1e3 + }; + break; + } + return e[n.id] = t, t; + } + }; +} +var Af1 = 0; +function Rf1(e, n) { + return (n.castShadow ? 2 : 0) - (e.castShadow ? 2 : 0) + (n.map ? 1 : 0) - (e.map ? 1 : 0); } -function kc(s1, e, t, n) { - if (s1.layers.test(e.layers) && s1.raycast(e, t), n === !0) { - let i = s1.children; - for(let r = 0, a = i.length; r < a; r++)kc(i[r], e, t, !0); +function Cf1(e) { + let n = new Tf1, t = xf1(), i = { + version: 0, + hash: { + directionalLength: -1, + pointLength: -1, + spotLength: -1, + rectAreaLength: -1, + hemiLength: -1, + numDirectionalShadows: -1, + numPointShadows: -1, + numSpotShadows: -1, + numSpotMaps: -1, + numLightProbes: -1 + }, + ambient: [ + 0, + 0, + 0 + ], + probe: [], + directional: [], + directionalShadow: [], + directionalShadowMap: [], + directionalShadowMatrix: [], + spot: [], + spotLightMap: [], + spotShadow: [], + spotShadowMap: [], + spotLightMatrix: [], + rectArea: [], + rectAreaLTC1: null, + rectAreaLTC2: null, + point: [], + pointShadow: [], + pointShadowMap: [], + pointShadowMatrix: [], + hemi: [], + numSpotLightShadowsWithMaps: 0, + numLightProbes: 0 + }; + for(let T = 0; T < 9; T++)i.probe.push(new w); + let c = new w, s = new D, h = new D; + function d(T) { + let C = 0, R = 0, S = 0; + for(let p = 0; p < 9; p++)i.probe[p].set(0, 0, 0); + let x1 = 0, O = 0, L = 0, l = 0, r = 0, w = 0, M = 0, _ = 0, H = 0, P = 0, y1 = 0; + T.sort(Rf1); + for(let p = 0, f = T.length; p < f; p++){ + let A = T[p], q = A.color, V = A.intensity, Y = A.distance, Q = A.shadow && A.shadow.map ? A.shadow.map.texture : null; + if (A.isAmbientLight) C += q.r * V, R += q.g * V, S += q.b * V; + else if (A.isLightProbe) { + for(let z = 0; z < 9; z++)i.probe[z].addScaledVector(A.sh.coefficients[z], V); + y1++; + } else if (A.isDirectionalLight) { + let z = n.get(A); + if (z.color.copy(A.color).multiplyScalar(A.intensity), A.castShadow) { + let j = A.shadow, F = t.get(A); + F.shadowIntensity = j.intensity, F.shadowBias = j.bias, F.shadowNormalBias = j.normalBias, F.shadowRadius = j.radius, F.shadowMapSize = j.mapSize, i.directionalShadow[x1] = F, i.directionalShadowMap[x1] = Q, i.directionalShadowMatrix[x1] = A.shadow.matrix, w++; + } + i.directional[x1] = z, x1++; + } else if (A.isSpotLight) { + let z = n.get(A); + z.position.setFromMatrixPosition(A.matrixWorld), z.color.copy(q).multiplyScalar(V), z.distance = Y, z.coneCos = Math.cos(A.angle), z.penumbraCos = Math.cos(A.angle * (1 - A.penumbra)), z.decay = A.decay, i.spot[L] = z; + let j = A.shadow; + if (A.map && (i.spotLightMap[H] = A.map, H++, j.updateMatrices(A), A.castShadow && P++), i.spotLightMatrix[L] = j.matrix, A.castShadow) { + let F = t.get(A); + F.shadowIntensity = j.intensity, F.shadowBias = j.bias, F.shadowNormalBias = j.normalBias, F.shadowRadius = j.radius, F.shadowMapSize = j.mapSize, i.spotShadow[L] = F, i.spotShadowMap[L] = Q, _++; + } + L++; + } else if (A.isRectAreaLight) { + let z = n.get(A); + z.color.copy(q).multiplyScalar(V), z.halfWidth.set(A.width * .5, 0, 0), z.halfHeight.set(0, A.height * .5, 0), i.rectArea[l] = z, l++; + } else if (A.isPointLight) { + let z = n.get(A); + if (z.color.copy(A.color).multiplyScalar(A.intensity), z.distance = A.distance, z.decay = A.decay, A.castShadow) { + let j = A.shadow, F = t.get(A); + F.shadowIntensity = j.intensity, F.shadowBias = j.bias, F.shadowNormalBias = j.normalBias, F.shadowRadius = j.radius, F.shadowMapSize = j.mapSize, F.shadowCameraNear = j.camera.near, F.shadowCameraFar = j.camera.far, i.pointShadow[O] = F, i.pointShadowMap[O] = Q, i.pointShadowMatrix[O] = A.shadow.matrix, M++; + } + i.point[O] = z, O++; + } else if (A.isHemisphereLight) { + let z = n.get(A); + z.skyColor.copy(A.color).multiplyScalar(V), z.groundColor.copy(A.groundColor).multiplyScalar(V), i.hemi[r] = z, r++; + } + } + l > 0 && (e.has("OES_texture_float_linear") === !0 ? (i.rectAreaLTC1 = ee1.LTC_FLOAT_1, i.rectAreaLTC2 = ee1.LTC_FLOAT_2) : (i.rectAreaLTC1 = ee1.LTC_HALF_1, i.rectAreaLTC2 = ee1.LTC_HALF_2)), i.ambient[0] = C, i.ambient[1] = R, i.ambient[2] = S; + let B = i.hash; + (B.directionalLength !== x1 || B.pointLength !== O || B.spotLength !== L || B.rectAreaLength !== l || B.hemiLength !== r || B.numDirectionalShadows !== w || B.numPointShadows !== M || B.numSpotShadows !== _ || B.numSpotMaps !== H || B.numLightProbes !== y1) && (i.directional.length = x1, i.spot.length = L, i.rectArea.length = l, i.point.length = O, i.hemi.length = r, i.directionalShadow.length = w, i.directionalShadowMap.length = w, i.pointShadow.length = M, i.pointShadowMap.length = M, i.spotShadow.length = _, i.spotShadowMap.length = _, i.directionalShadowMatrix.length = w, i.pointShadowMatrix.length = M, i.spotLightMatrix.length = _ + H - P, i.spotLightMap.length = H, i.numSpotLightShadowsWithMaps = P, i.numLightProbes = y1, B.directionalLength = x1, B.pointLength = O, B.spotLength = L, B.rectAreaLength = l, B.hemiLength = r, B.numDirectionalShadows = w, B.numPointShadows = M, B.numSpotShadows = _, B.numSpotMaps = H, B.numLightProbes = y1, i.version = Af1++); + } + function I(T, C) { + let R = 0, S = 0, x1 = 0, O = 0, L = 0, l = C.matrixWorldInverse; + for(let r = 0, w = T.length; r < w; r++){ + let M = T[r]; + if (M.isDirectionalLight) { + let _ = i.directional[R]; + _.direction.setFromMatrixPosition(M.matrixWorld), c.setFromMatrixPosition(M.target.matrixWorld), _.direction.sub(c), _.direction.transformDirection(l), R++; + } else if (M.isSpotLight) { + let _ = i.spot[x1]; + _.position.setFromMatrixPosition(M.matrixWorld), _.position.applyMatrix4(l), _.direction.setFromMatrixPosition(M.matrixWorld), c.setFromMatrixPosition(M.target.matrixWorld), _.direction.sub(c), _.direction.transformDirection(l), x1++; + } else if (M.isRectAreaLight) { + let _ = i.rectArea[O]; + _.position.setFromMatrixPosition(M.matrixWorld), _.position.applyMatrix4(l), h.identity(), s.copy(M.matrixWorld), s.premultiply(l), h.extractRotation(s), _.halfWidth.set(M.width * .5, 0, 0), _.halfHeight.set(0, M.height * .5, 0), _.halfWidth.applyMatrix4(h), _.halfHeight.applyMatrix4(h), O++; + } else if (M.isPointLight) { + let _ = i.point[S]; + _.position.setFromMatrixPosition(M.matrixWorld), _.position.applyMatrix4(l), S++; + } else if (M.isHemisphereLight) { + let _ = i.hemi[L]; + _.direction.setFromMatrixPosition(M.matrixWorld), _.direction.transformDirection(l), L++; + } + } } + return { + setup: d, + setupView: I, + state: i + }; } -var Ou = class { - 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(ct(t / this.radius, -1, 1))), this; - } - clone() { - return new this.constructor().copy(this); - } -}, Fu = class { - constructor(e = 1, t = 0, n = 0){ - return this.radius = e, this.theta = t, this.y = n, this; - } - set(e, t, n) { - return this.radius = e, this.theta = t, this.y = n, this; +function sr1(e) { + let n = new Cf1(e), t = [], i = []; + function c(C) { + T.camera = C, t.length = 0, i.length = 0; } - copy(e) { - return this.radius = e.radius, this.theta = e.theta, this.y = e.y, this; + function s(C) { + t.push(C); } - setFromVector3(e) { - return this.setFromCartesianCoords(e.x, e.y, e.z); + function h(C) { + i.push(C); } - setFromCartesianCoords(e, t, n) { - return this.radius = Math.sqrt(e * e + n * n), this.theta = Math.atan2(e, n), this.y = t, this; + function d() { + n.setup(t); } - clone() { - return new this.constructor().copy(this); + function I(C) { + n.setupView(t, C); } -}, Bu = new Z, zu = class { - constructor(e = new Z(1 / 0, 1 / 0), t = new Z(-1 / 0, -1 / 0)){ - this.isBox2 = !0, this.min = e, this.max = t; + let T = { + lightsArray: t, + shadowsArray: i, + camera: null, + lights: n, + transmissionRenderTarget: {} + }; + return { + init: c, + state: T, + setupLights: d, + setupLightsView: I, + pushLight: s, + pushShadow: h + }; +} +function bf1(e) { + let n = new WeakMap; + function t(c, s = 0) { + let h = n.get(c), d; + return h === void 0 ? (d = new sr1(e), n.set(c, [ + d + ])) : s >= h.length ? (d = new sr1(e), h.push(d)) : d = h[s], d; } - set(e, t) { - return this.min.copy(e), this.max.copy(t), this; + function i() { + n = new WeakMap; } - setFromPoints(e) { - this.makeEmpty(); - for(let t = 0, n = e.length; t < n; t++)this.expandByPoint(e[t]); - return this; + return { + get: t, + dispose: i + }; +} +var Pf1 = `void main() { + gl_Position = vec4( position, 1.0 ); +}`, Lf = `uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`; +function Uf(e, n, t) { + let i = new sn, c = new T, s = new T, h = new ot, d = new lo({ + depthPacking: Wp + }), I = new co, T1 = {}, C = t.maxTextureSize, R = { + [dr]: Al, + [Al]: dr, + [Yd]: Yd + }, S = new qi({ + defines: { + VSM_SAMPLES: 8 + }, + uniforms: { + shadow_pass: { + value: null + }, + resolution: { + value: new T + }, + radius: { + value: 4 + } + }, + vertexShader: Pf1, + fragmentShader: Lf + }), x1 = S.clone(); + x1.defines.HORIZONTAL_PASS = 1; + let O = new L; + O.setAttribute("position", new Z(new Float32Array([ + -1, + -1, + .5, + 3, + -1, + .5, + -1, + 3, + .5 + ]), 3)); + let L1 = new Ct(O, S), l = this; + this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = Xd; + let r = this.type; + this.render = function(P, y1, B) { + if (l.enabled === !1 || l.autoUpdate === !1 && l.needsUpdate === !1 || P.length === 0) return; + let p = e.getRenderTarget(), f = e.getActiveCubeFace(), A = e.getActiveMipmapLevel(), q = e.state; + q.setBlending(Ul), q.buffers.color.setClear(1, 1, 1, 1), q.buffers.depth.setTest(!0), q.setScissorTest(!1); + let V = r !== Zd && this.type === Zd, Y = r === Zd && this.type !== Zd; + for(let Q = 0, z = P.length; Q < z; Q++){ + let j = P[Q], F = j.shadow; + if (F === void 0) { + console.warn("THREE.WebGLShadowMap:", j, "has no shadow."); + continue; + } + if (F.autoUpdate === !1 && F.needsUpdate === !1) continue; + c.copy(F.mapSize); + let me = F.getFrameExtents(); + if (c.multiply(me), s.copy(F.mapSize), (c.x > C || c.y > C) && (c.x > C && (s.x = Math.floor(C / me.x), c.x = s.x * me.x, F.mapSize.x = s.x), c.y > C && (s.y = Math.floor(C / me.y), c.y = s.y * me.y, F.mapSize.y = s.y)), F.map === null || V === !0 || Y === !0) { + let Le = this.type !== Zd ? { + minFilter: Ut, + magFilter: Ut + } : {}; + F.map !== null && F.map.dispose(), F.map = new Hi(c.x, c.y, Le), F.map.texture.name = j.name + ".shadowMap", F.camera.updateProjectionMatrix(); + } + e.setRenderTarget(F.map), e.clear(); + let Me = F.getViewportCount(); + for(let Le = 0; Le < Me; Le++){ + let Ge = F.getViewport(Le); + h.set(s.x * Ge.x, s.y * Ge.y, s.x * Ge.z, s.y * Ge.w), q.viewport(h), F.updateMatrices(j, Le), i = F.getFrustum(), _(y1, B, F.camera, j, this.type); + } + F.isPointLightShadow !== !0 && this.type === Zd && w(F, B), F.needsUpdate = !1; + } + r = this.type, l.needsUpdate = !1, e.setRenderTarget(p, f, A); + }; + function w(P, y1) { + let B = n.update(L1); + S.defines.VSM_SAMPLES !== P.blurSamples && (S.defines.VSM_SAMPLES = P.blurSamples, x1.defines.VSM_SAMPLES = P.blurSamples, S.needsUpdate = !0, x1.needsUpdate = !0), P.mapPass === null && (P.mapPass = new Hi(c.x, c.y)), S.uniforms.shadow_pass.value = P.map.texture, S.uniforms.resolution.value = P.mapSize, S.uniforms.radius.value = P.radius, e.setRenderTarget(P.mapPass), e.clear(), e.renderBufferDirect(y1, null, B, S, L1, null), x1.uniforms.shadow_pass.value = P.mapPass.texture, x1.uniforms.resolution.value = P.mapSize, x1.uniforms.radius.value = P.radius, e.setRenderTarget(P.map), e.clear(), e.renderBufferDirect(y1, null, B, x1, L1, null); + } + function M(P, y1, B, p) { + let f = null, A = B.isPointLight === !0 ? P.customDistanceMaterial : P.customDepthMaterial; + if (A !== void 0) f = A; + else if (f = B.isPointLight === !0 ? I : d, e.localClippingEnabled && y1.clipShadows === !0 && Array.isArray(y1.clippingPlanes) && y1.clippingPlanes.length !== 0 || y1.displacementMap && y1.displacementScale !== 0 || y1.alphaMap && y1.alphaTest > 0 || y1.map && y1.alphaTest > 0) { + let q = f.uuid, V = y1.uuid, Y = T1[q]; + Y === void 0 && (Y = {}, T1[q] = Y); + let Q = Y[V]; + Q === void 0 && (Q = f.clone(), Y[V] = Q, y1.addEventListener("dispose", H)), f = Q; + } + if (f.visible = y1.visible, f.wireframe = y1.wireframe, p === Zd ? f.side = y1.shadowSide !== null ? y1.shadowSide : y1.side : f.side = y1.shadowSide !== null ? y1.shadowSide : R[y1.side], f.alphaMap = y1.alphaMap, f.alphaTest = y1.alphaTest, f.map = y1.map, f.clipShadows = y1.clipShadows, f.clippingPlanes = y1.clippingPlanes, f.clipIntersection = y1.clipIntersection, f.displacementMap = y1.displacementMap, f.displacementScale = y1.displacementScale, f.displacementBias = y1.displacementBias, f.wireframeLinewidth = y1.wireframeLinewidth, f.linewidth = y1.linewidth, B.isPointLight === !0 && f.isMeshDistanceMaterial === !0) { + let q = e.properties.get(f); + q.light = B; + } + return f; + } + function _(P, y1, B, p, f) { + if (P.visible === !1) return; + if (P.layers.test(y1.layers) && (P.isMesh || P.isLine || P.isPoints) && (P.castShadow || P.receiveShadow && f === Zd) && (!P.frustumCulled || i.intersectsObject(P))) { + P.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse, P.matrixWorld); + let V = n.update(P), Y = P.material; + if (Array.isArray(Y)) { + let Q = V.groups; + for(let z = 0, j = Q.length; z < j; z++){ + let F = Q[z], me = Y[F.materialIndex]; + if (me && me.visible) { + let Me = M(P, me, p, f); + P.onBeforeShadow(e, P, y1, B, V, Me, F), e.renderBufferDirect(B, null, V, Me, P, F), P.onAfterShadow(e, P, y1, B, V, Me, F); + } + } + } else if (Y.visible) { + let Q = M(P, Y, p, f); + P.onBeforeShadow(e, P, y1, B, V, Q, null), e.renderBufferDirect(B, null, V, Q, P, null), P.onAfterShadow(e, P, y1, B, V, Q, null); + } + } + let q = P.children; + for(let V = 0, Y = q.length; V < Y; V++)_(q[V], y1, B, p, f); } - setFromCenterAndSize(e, t) { - let n = Bu.copy(t).multiplyScalar(.5); - return this.min.copy(e).sub(n), this.max.copy(e).add(n), this; + function H(P) { + P.target.removeEventListener("dispose", H); + for(let B in T1){ + let p = T1[B], f = P.target.uuid; + f in p && (p[f].dispose(), delete p[f]); + } } - clone() { - return new this.constructor().copy(this); +} +var Df = { + [gp]: xp, + [bp]: _p, + [wp]: vp, + [ra]: Mp, + [xp]: gp, + [_p]: bp, + [vp]: wp, + [Mp]: ra +}; +function wf1(e, n) { + function t() { + let v = !1, te = new ot, N = null, X = new ot(0, 0, 0, 0); + return { + setMask: function(oe) { + N !== oe && !v && (e.colorMask(oe, oe, oe, oe), N = oe); + }, + setLocked: function(oe) { + v = oe; + }, + setClear: function(oe, ae, Ce, Qe, at) { + at === !0 && (oe *= Qe, ae *= Qe, Ce *= Qe), te.set(oe, ae, Ce, Qe), X.equals(te) === !1 && (e.clearColor(oe, ae, Ce, Qe), X.copy(te)); + }, + reset: function() { + v = !1, N = null, X.set(-1, 0, 0, 0); + } + }; } - copy(e) { - return this.min.copy(e.min), this.max.copy(e.max), this; + function i() { + let v = !1, te = !1, N = null, X = null, oe = null; + return { + setReversed: function(ae) { + if (te !== ae) { + let Ce = n.get("EXT_clip_control"); + te ? Ce.clipControlEXT(Ce.LOWER_LEFT_EXT, Ce.ZERO_TO_ONE_EXT) : Ce.clipControlEXT(Ce.LOWER_LEFT_EXT, Ce.NEGATIVE_ONE_TO_ONE_EXT); + let Qe = oe; + oe = null, this.setClear(Qe); + } + te = ae; + }, + getReversed: function() { + return te; + }, + setTest: function(ae) { + ae ? ie(e.DEPTH_TEST) : Ee(e.DEPTH_TEST); + }, + setMask: function(ae) { + N !== ae && !v && (e.depthMask(ae), N = ae); + }, + setFunc: function(ae) { + if (te && (ae = Df[ae]), X !== ae) { + switch(ae){ + case gp: + e.depthFunc(e.NEVER); + break; + case xp: + e.depthFunc(e.ALWAYS); + break; + case bp: + e.depthFunc(e.LESS); + break; + case ra: + e.depthFunc(e.LEQUAL); + break; + case wp: + e.depthFunc(e.EQUAL); + break; + case Mp: + e.depthFunc(e.GEQUAL); + break; + case _p: + e.depthFunc(e.GREATER); + break; + case vp: + e.depthFunc(e.NOTEQUAL); + break; + default: + e.depthFunc(e.LEQUAL); + } + X = ae; + } + }, + setLocked: function(ae) { + v = ae; + }, + setClear: function(ae) { + oe !== ae && (te && (ae = 1 - ae), e.clearDepth(ae), oe = ae); + }, + reset: function() { + v = !1, N = null, X = null, oe = null, te = !1; + } + }; } - makeEmpty() { - return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this; + function c() { + let v = !1, te = null, N = null, X = null, oe = null, ae = null, Ce = null, Qe = null, at = null; + return { + setTest: function(ke) { + v || (ke ? ie(e.STENCIL_TEST) : Ee(e.STENCIL_TEST)); + }, + setMask: function(ke) { + te !== ke && !v && (e.stencilMask(ke), te = ke); + }, + setFunc: function(ke, _t, St) { + (N !== ke || X !== _t || oe !== St) && (e.stencilFunc(ke, _t, St), N = ke, X = _t, oe = St); + }, + setOp: function(ke, _t, St) { + (ae !== ke || Ce !== _t || Qe !== St) && (e.stencilOp(ke, _t, St), ae = ke, Ce = _t, Qe = St); + }, + setLocked: function(ke) { + v = ke; + }, + setClear: function(ke) { + at !== ke && (e.clearStencil(ke), at = ke); + }, + reset: function() { + v = !1, te = null, N = null, X = null, oe = null, ae = null, Ce = null, Qe = null, at = null; + } + }; } - isEmpty() { - return this.max.x < this.min.x || this.max.y < this.min.y; + let s = new t, h = new i, d = new c, I = new WeakMap, T = new WeakMap, C = {}, R = {}, S = new WeakMap, x1 = [], O = null, L = !1, l = null, r = null, w = null, M = null, _ = null, H = null, P1 = null, y1 = new P(0, 0, 0), B = 0, p = !1, f = null, A = null, q = null, V = null, Y = null, Q = e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS), z = !1, j = 0, F = e.getParameter(e.VERSION); + F.indexOf("WebGL") !== -1 ? (j = parseFloat(/^WebGL (\d)/.exec(F)[1]), z = j >= 1) : F.indexOf("OpenGL ES") !== -1 && (j = parseFloat(/^OpenGL ES (\d)/.exec(F)[1]), z = j >= 2); + let me = null, Me = {}, Le = e.getParameter(e.SCISSOR_BOX), Ge = e.getParameter(e.VIEWPORT), Ze = new ot().fromArray(Le), k = new ot().fromArray(Ge); + function J(v, te, N, X) { + let oe = new Uint8Array(4), ae = e.createTexture(); + e.bindTexture(v, ae), e.texParameteri(v, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(v, e.TEXTURE_MAG_FILTER, e.NEAREST); + for(let Ce = 0; Ce < N; Ce++)v === e.TEXTURE_3D || v === e.TEXTURE_2D_ARRAY ? e.texImage3D(te, 0, e.RGBA, 1, 1, X, 0, e.RGBA, e.UNSIGNED_BYTE, oe) : e.texImage2D(te + Ce, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, oe); + return ae; + } + let ue = {}; + ue[e.TEXTURE_2D] = J(e.TEXTURE_2D, e.TEXTURE_2D, 1), ue[e.TEXTURE_CUBE_MAP] = J(e.TEXTURE_CUBE_MAP, e.TEXTURE_CUBE_MAP_POSITIVE_X, 6), ue[e.TEXTURE_2D_ARRAY] = J(e.TEXTURE_2D_ARRAY, e.TEXTURE_2D_ARRAY, 1, 1), ue[e.TEXTURE_3D] = J(e.TEXTURE_3D, e.TEXTURE_3D, 1, 1), s.setClear(0, 0, 0, 1), h.setClear(1), d.setClear(0), ie(e.DEPTH_TEST), h.setFunc(ra), De(!1), we(Wd), ie(e.CULL_FACE), m(Ul); + function ie(v) { + C[v] !== !0 && (e.enable(v), C[v] = !0); + } + function Ee(v) { + C[v] !== !1 && (e.disable(v), C[v] = !1); + } + function Be(v, te) { + return R[v] !== te ? (e.bindFramebuffer(v, te), R[v] = te, v === e.DRAW_FRAMEBUFFER && (R[e.FRAMEBUFFER] = te), v === e.FRAMEBUFFER && (R[e.DRAW_FRAMEBUFFER] = te), !0) : !1; + } + function Te(v, te) { + let N = x1, X = !1; + if (v) { + N = S.get(te), N === void 0 && (N = [], S.set(te, N)); + let oe = v.textures; + if (N.length !== oe.length || N[0] !== e.COLOR_ATTACHMENT0) { + for(let ae = 0, Ce = oe.length; ae < Ce; ae++)N[ae] = e.COLOR_ATTACHMENT0 + ae; + N.length = oe.length, X = !0; + } + } else N[0] !== e.BACK && (N[0] = e.BACK, X = !0); + X && e.drawBuffers(N); + } + function je(v) { + return O !== v ? (e.useProgram(v), O = v, !0) : !1; + } + let $e = { + [ia]: e.FUNC_ADD, + [tp]: e.FUNC_SUBTRACT, + [ep]: e.FUNC_REVERSE_SUBTRACT + }; + $e[ip] = e.MIN, $e[sp] = e.MAX; + let Ue = { + [np]: e.ZERO, + [rp]: e.ONE, + [op]: e.SRC_COLOR, + [sa]: e.SRC_ALPHA, + [dp]: e.SRC_ALPHA_SATURATE, + [cp]: e.DST_COLOR, + [hp]: e.DST_ALPHA, + [ap]: e.ONE_MINUS_SRC_COLOR, + [na]: e.ONE_MINUS_SRC_ALPHA, + [up]: e.ONE_MINUS_DST_COLOR, + [lp]: e.ONE_MINUS_DST_ALPHA, + [pp]: e.CONSTANT_COLOR, + [fp]: e.ONE_MINUS_CONSTANT_COLOR, + [mp]: e.CONSTANT_ALPHA, + [yp]: e.ONE_MINUS_CONSTANT_ALPHA + }; + function m(v, te, N, X, oe, ae, Ce, Qe, at, ke) { + if (v === Ul) { + L === !0 && (Ee(e.BLEND), L = !1); + return; + } + if (L === !1 && (ie(e.BLEND), L = !0), v !== Kd) { + if (v !== l || ke !== p) { + if ((r !== ia || _ !== ia) && (e.blendEquation(e.FUNC_ADD), r = ia, _ = ia), ke) switch(v){ + case ea: + e.blendFuncSeparate(e.ONE, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA); + break; + case $d: + e.blendFunc(e.ONE, e.ONE); + break; + case Qd: + e.blendFuncSeparate(e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ZERO, e.ONE); + break; + case jd: + e.blendFuncSeparate(e.ZERO, e.SRC_COLOR, e.ZERO, e.SRC_ALPHA); + break; + default: + console.error("THREE.WebGLState: Invalid blending: ", v); + break; + } + else switch(v){ + case ea: + e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA); + break; + case $d: + e.blendFunc(e.SRC_ALPHA, e.ONE); + break; + case Qd: + e.blendFuncSeparate(e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ZERO, e.ONE); + break; + case jd: + e.blendFunc(e.ZERO, e.SRC_COLOR); + break; + default: + console.error("THREE.WebGLState: Invalid blending: ", v); + break; + } + w = null, M = null, H = null, P1 = null, y1.set(0, 0, 0), B = 0, l = v, p = ke; + } + return; + } + oe = oe || te, ae = ae || N, Ce = Ce || X, (te !== r || oe !== _) && (e.blendEquationSeparate($e[te], $e[oe]), r = te, _ = oe), (N !== w || X !== M || ae !== H || Ce !== P1) && (e.blendFuncSeparate(Ue[N], Ue[X], Ue[ae], Ue[Ce]), w = N, M = X, H = ae, P1 = Ce), (Qe.equals(y1) === !1 || at !== B) && (e.blendColor(Qe.r, Qe.g, Qe.b, at), y1.copy(Qe), B = at), l = v, p = !1; } - getCenter(e) { - return this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5); + function ut(v, te) { + v.side === Yd ? Ee(e.CULL_FACE) : ie(e.CULL_FACE); + let N = v.side === Al; + te && (N = !N), De(N), v.blending === ea && v.transparent === !1 ? m(Ul) : m(v.blending, v.blendEquation, v.blendSrc, v.blendDst, v.blendEquationAlpha, v.blendSrcAlpha, v.blendDstAlpha, v.blendColor, v.blendAlpha, v.premultipliedAlpha), h.setFunc(v.depthFunc), h.setTest(v.depthTest), h.setMask(v.depthWrite), s.setMask(v.colorWrite); + let X = v.stencilWrite; + d.setTest(X), X && (d.setMask(v.stencilWriteMask), d.setFunc(v.stencilFunc, v.stencilRef, v.stencilFuncMask), d.setOp(v.stencilFail, v.stencilZFail, v.stencilZPass)), Xe(v.polygonOffset, v.polygonOffsetFactor, v.polygonOffsetUnits), v.alphaToCoverage === !0 ? ie(e.SAMPLE_ALPHA_TO_COVERAGE) : Ee(e.SAMPLE_ALPHA_TO_COVERAGE); } - getSize(e) { - return this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min); + function De(v) { + f !== v && (v ? e.frontFace(e.CW) : e.frontFace(e.CCW), f = v); } - expandByPoint(e) { - return this.min.min(e), this.max.max(e), this; + function we(v) { + v !== Ud ? (ie(e.CULL_FACE), v !== A && (v === Wd ? e.cullFace(e.BACK) : v === Hd ? e.cullFace(e.FRONT) : e.cullFace(e.FRONT_AND_BACK))) : Ee(e.CULL_FACE), A = v; } - expandByVector(e) { - return this.min.sub(e), this.max.add(e), this; + function _e(v) { + v !== q && (z && e.lineWidth(v), q = v); } - expandByScalar(e) { - return this.min.addScalar(-e), this.max.addScalar(e), this; + function Xe(v, te, N) { + v ? (ie(e.POLYGON_OFFSET_FILL), (V !== te || Y !== N) && (e.polygonOffset(te, N), V = te, Y = N)) : Ee(e.POLYGON_OFFSET_FILL); } - containsPoint(e) { - return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y); + function he(v) { + v ? ie(e.SCISSOR_TEST) : Ee(e.SCISSOR_TEST); } - 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; + function u(v) { + v === void 0 && (v = e.TEXTURE0 + Q - 1), me !== v && (e.activeTexture(v), me = v); } - 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)); + function a(v, te, N) { + N === void 0 && (me === null ? N = e.TEXTURE0 + Q - 1 : N = me); + let X = Me[N]; + X === void 0 && (X = { + type: void 0, + texture: void 0 + }, Me[N] = X), (X.type !== v || X.texture !== te) && (me !== N && (e.activeTexture(N), me = N), e.bindTexture(v, te || ue[v]), X.type = v, X.texture = te); } - 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); + function b() { + let v = Me[me]; + v !== void 0 && v.type !== void 0 && (e.bindTexture(v.type, null), v.type = void 0, v.texture = void 0); } - clampPoint(e, t) { - return t.copy(e).clamp(this.min, this.max); + function W() { + try { + e.compressedTexImage2D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - distanceToPoint(e) { - return this.clampPoint(e, Bu).distanceTo(e); + function K() { + try { + e.compressedTexImage3D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - intersect(e) { - return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this; + function G() { + try { + e.texSubImage2D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - union(e) { - return this.min.min(e.min), this.max.max(e.max), this; + function pe() { + try { + e.texSubImage3D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - translate(e) { - return this.min.add(e), this.max.add(e), this; + function re() { + try { + e.compressedTexSubImage2D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - equals(e) { - return e.min.equals(this.min) && e.max.equals(this.max); + function ce() { + try { + e.compressedTexSubImage3D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } -}, Vu = new A, Tr = new A, ku = class { - constructor(e = new A, t = new A){ - this.start = e, this.end = t; + function ye() { + try { + e.texStorage2D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - set(e, t) { - return this.start.copy(e), this.end.copy(t), this; + function Z() { + try { + e.texStorage3D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - copy(e) { - return this.start.copy(e.start), this.end.copy(e.end), this; + function le() { + try { + e.texImage2D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - getCenter(e) { - return e.addVectors(this.start, this.end).multiplyScalar(.5); + function Se() { + try { + e.texImage3D.apply(e, arguments); + } catch (v) { + console.error("THREE.WebGLState:", v); + } } - delta(e) { - return e.subVectors(this.end, this.start); + function xe(v) { + Ze.equals(v) === !1 && (e.scissor(v.x, v.y, v.z, v.w), Ze.copy(v)); } - distanceSq() { - return this.start.distanceToSquared(this.end); + function fe(v) { + k.equals(v) === !1 && (e.viewport(v.x, v.y, v.z, v.w), k.copy(v)); } - distance() { - return this.start.distanceTo(this.end); + function Ie(v, te) { + let N = T.get(te); + N === void 0 && (N = new WeakMap, T.set(te, N)); + let X = N.get(v); + X === void 0 && (X = e.getUniformBlockIndex(te, v.name), N.set(v, X)); } - at(e, t) { - return this.delta(t).multiplyScalar(e).add(this.start); + function be(v, te) { + let X = T.get(te).get(v); + I.get(te) !== X && (e.uniformBlockBinding(te, X, v.__bindingPointIndex), I.set(te, X)); } - closestPointToPointParameter(e, t) { - Vu.subVectors(e, this.start), Tr.subVectors(this.end, this.start); - let n = Tr.dot(Tr), r = Tr.dot(Vu) / n; - return t && (r = ct(r, 0, 1)), r; + function ze() { + e.disable(e.BLEND), e.disable(e.CULL_FACE), e.disable(e.DEPTH_TEST), e.disable(e.POLYGON_OFFSET_FILL), e.disable(e.SCISSOR_TEST), e.disable(e.STENCIL_TEST), e.disable(e.SAMPLE_ALPHA_TO_COVERAGE), e.blendEquation(e.FUNC_ADD), e.blendFunc(e.ONE, e.ZERO), e.blendFuncSeparate(e.ONE, e.ZERO, e.ONE, e.ZERO), e.blendColor(0, 0, 0, 0), e.colorMask(!0, !0, !0, !0), e.clearColor(0, 0, 0, 0), e.depthMask(!0), e.depthFunc(e.LESS), h.setReversed(!1), e.clearDepth(1), e.stencilMask(4294967295), e.stencilFunc(e.ALWAYS, 0, 4294967295), e.stencilOp(e.KEEP, e.KEEP, e.KEEP), e.clearStencil(0), e.cullFace(e.BACK), e.frontFace(e.CCW), e.polygonOffset(0, 0), e.activeTexture(e.TEXTURE0), e.bindFramebuffer(e.FRAMEBUFFER, null), e.bindFramebuffer(e.DRAW_FRAMEBUFFER, null), e.bindFramebuffer(e.READ_FRAMEBUFFER, null), e.useProgram(null), e.lineWidth(1), e.scissor(0, 0, e.canvas.width, e.canvas.height), e.viewport(0, 0, e.canvas.width, e.canvas.height), C = {}, me = null, Me = {}, R = {}, S = new WeakMap, x1 = [], O = null, L = !1, l = null, r = null, w = null, M = null, _ = null, H = null, P1 = null, y1 = new P(0, 0, 0), B = 0, p = !1, f = null, A = null, q = null, V = null, Y = null, Ze.set(0, 0, e.canvas.width, e.canvas.height), k.set(0, 0, e.canvas.width, e.canvas.height), s.reset(), h.reset(), d.reset(); } - closestPointToPoint(e, t, n) { - let i = this.closestPointToPointParameter(e, t); - return this.delta(n).multiplyScalar(i).add(this.start); + return { + buffers: { + color: s, + depth: h, + stencil: d + }, + enable: ie, + disable: Ee, + bindFramebuffer: Be, + drawBuffers: Te, + useProgram: je, + setBlending: m, + setMaterial: ut, + setFlipSided: De, + setCullFace: we, + setLineWidth: _e, + setPolygonOffset: Xe, + setScissorTest: he, + activeTexture: u, + bindTexture: a, + unbindTexture: b, + compressedTexImage2D: W, + compressedTexImage3D: K, + texImage2D: le, + texImage3D: Se, + updateUBOMapping: Ie, + uniformBlockBinding: be, + texStorage2D: ye, + texStorage3D: Z, + texSubImage2D: G, + texSubImage3D: pe, + compressedTexSubImage2D: re, + compressedTexSubImage3D: ce, + scissor: xe, + viewport: fe, + reset: ze + }; +} +function If1(e, n, t, i, c, s, h) { + let d = n.has("WEBGL_multisampled_render_to_texture") ? n.get("WEBGL_multisampled_render_to_texture") : null, I = typeof navigator > "u" ? !1 : /OculusBrowser/g.test(navigator.userAgent), T1 = new T, C = new WeakMap, R, S = new WeakMap, x1 = !1; + try { + x1 = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null; + } catch {} + function O(u, a) { + return x1 ? new OffscreenCanvas(u, a) : Ys("canvas"); + } + function L(u, a, b) { + let W = 1, K = he(u); + if ((K.width > b || K.height > b) && (W = b / Math.max(K.width, K.height)), W < 1) if (typeof HTMLImageElement < "u" && u instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && u instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && u instanceof ImageBitmap || typeof VideoFrame < "u" && u instanceof VideoFrame) { + let G = Math.floor(W * K.width), pe = Math.floor(W * K.height); + R === void 0 && (R = O(G, pe)); + let re = a ? O(G, pe) : R; + return re.width = G, re.height = pe, re.getContext("2d").drawImage(u, 0, 0, G, pe), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + K.width + "x" + K.height + ") to (" + G + "x" + pe + ")."), re; + } else return "data" in u && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + K.width + "x" + K.height + ")."), u; + return u; } - applyMatrix4(e) { - return this.start.applyMatrix4(e), this.end.applyMatrix4(e), this; + function l(u) { + return u.generateMipmaps; } - equals(e) { - return e.start.equals(this.start) && e.end.equals(this.end); + function r(u) { + e.generateMipmap(u); } - clone() { - return new this.constructor().copy(this); + function w(u) { + return u.isWebGLCubeRenderTarget ? e.TEXTURE_CUBE_MAP : u.isWebGL3DRenderTarget ? e.TEXTURE_3D : u.isWebGLArrayRenderTarget || u.isCompressedArrayTexture ? e.TEXTURE_2D_ARRAY : e.TEXTURE_2D; } -}, Hu = new A, Gu = class extends Je { - constructor(e, t){ - super(), this.light = e, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t, this.type = "SpotLightHelper"; - let n = new Ge, i = [ - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - -1, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - -1, - 1 - ]; - for(let a = 0, o = 1, c = 32; a < c; a++, o++){ - let l = a / c * Math.PI * 2, h = o / c * Math.PI * 2; - i.push(Math.cos(l), Math.sin(l), 1, Math.cos(h), Math.sin(h), 1); + function M(u, a, b, W, K = !1) { + if (u !== null) { + if (e[u] !== void 0) return e[u]; + console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + u + "'"); } - n.setAttribute("position", new ve(i, 3)); - let r = new wt({ - fog: !1, - toneMapped: !1 - }); - this.cone = new en(n, r), this.add(this.cone), this.update(); - } - dispose() { - this.cone.geometry.dispose(), this.cone.material.dispose(); - } - update() { - this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1); - let e = this.light.distance ? this.light.distance : 1e3, t = e * Math.tan(this.light.angle); - this.cone.scale.set(t, t, e), Hu.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(Hu), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color); - } -}, Pn = new A, wr = new ze, lo = new ze, Wu = class extends en { - constructor(e){ - let t = Nd(e), n = new Ge, i = [], r = [], a = new pe(0, 0, 1), o = new pe(0, 1, 0); - for(let l = 0; l < t.length; l++){ - let h = t[l]; - h.parent && h.parent.isBone && (i.push(0, 0, 0), i.push(0, 0, 0), r.push(a.r, a.g, a.b), r.push(o.r, o.g, o.b)); - } - n.setAttribute("position", new ve(i, 3)), n.setAttribute("color", new ve(r, 3)); - let c = new wt({ - vertexColors: !0, - depthTest: !1, - depthWrite: !1, - toneMapped: !1, - transparent: !0 - }); - super(n, c), this.isSkeletonHelper = !0, this.type = "SkeletonHelper", this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1; - } - updateMatrixWorld(e) { - let t = this.bones, n = this.geometry, i = n.getAttribute("position"); - lo.copy(this.root.matrixWorld).invert(); - for(let r = 0, a = 0; r < t.length; r++){ - let o = t[r]; - o.parent && o.parent.isBone && (wr.multiplyMatrices(lo, o.matrixWorld), Pn.setFromMatrixPosition(wr), i.setXYZ(a, Pn.x, Pn.y, Pn.z), wr.multiplyMatrices(lo, o.parent.matrixWorld), Pn.setFromMatrixPosition(wr), i.setXYZ(a + 1, Pn.x, Pn.y, Pn.z), a += 2); + let G = a; + if (a === e.RED && (b === e.FLOAT && (G = e.R32F), b === e.HALF_FLOAT && (G = e.R16F), b === e.UNSIGNED_BYTE && (G = e.R8)), a === e.RED_INTEGER && (b === e.UNSIGNED_BYTE && (G = e.R8UI), b === e.UNSIGNED_SHORT && (G = e.R16UI), b === e.UNSIGNED_INT && (G = e.R32UI), b === e.BYTE && (G = e.R8I), b === e.SHORT && (G = e.R16I), b === e.INT && (G = e.R32I)), a === e.RG && (b === e.FLOAT && (G = e.RG32F), b === e.HALF_FLOAT && (G = e.RG16F), b === e.UNSIGNED_BYTE && (G = e.RG8)), a === e.RG_INTEGER && (b === e.UNSIGNED_BYTE && (G = e.RG8UI), b === e.UNSIGNED_SHORT && (G = e.RG16UI), b === e.UNSIGNED_INT && (G = e.RG32UI), b === e.BYTE && (G = e.RG8I), b === e.SHORT && (G = e.RG16I), b === e.INT && (G = e.RG32I)), a === e.RGB_INTEGER && (b === e.UNSIGNED_BYTE && (G = e.RGB8UI), b === e.UNSIGNED_SHORT && (G = e.RGB16UI), b === e.UNSIGNED_INT && (G = e.RGB32UI), b === e.BYTE && (G = e.RGB8I), b === e.SHORT && (G = e.RGB16I), b === e.INT && (G = e.RGB32I)), a === e.RGBA_INTEGER && (b === e.UNSIGNED_BYTE && (G = e.RGBA8UI), b === e.UNSIGNED_SHORT && (G = e.RGBA16UI), b === e.UNSIGNED_INT && (G = e.RGBA32UI), b === e.BYTE && (G = e.RGBA8I), b === e.SHORT && (G = e.RGBA16I), b === e.INT && (G = e.RGBA32I)), a === e.RGB && b === e.UNSIGNED_INT_5_9_9_9_REV && (G = e.RGB9_E5), a === e.RGBA) { + let pe = K ? la : Tt.getTransfer(W); + b === e.FLOAT && (G = e.RGBA32F), b === e.HALF_FLOAT && (G = e.RGBA16F), b === e.UNSIGNED_BYTE && (G = pe === Fn ? e.SRGB8_ALPHA8 : e.RGBA8), b === e.UNSIGNED_SHORT_4_4_4_4 && (G = e.RGBA4), b === e.UNSIGNED_SHORT_5_5_5_1 && (G = e.RGB5_A1); } - n.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e); + return (G === e.R16F || G === e.R32F || G === e.RG16F || G === e.RG32F || G === e.RGBA16F || G === e.RGBA32F) && n.get("EXT_color_buffer_float"), G; } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function _(u, a) { + let b; + return u ? a === null || a === Wo || a === sc ? b = e.DEPTH24_STENCIL8 : a === pi ? b = e.DEPTH32F_STENCIL8 : a === jl && (b = e.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : a === null || a === Wo || a === sc ? b = e.DEPTH_COMPONENT24 : a === pi ? b = e.DEPTH_COMPONENT32F : a === jl && (b = e.DEPTH_COMPONENT16), b; } -}; -function Nd(s1) { - let e = []; - s1.isBone === !0 && e.push(s1); - for(let t = 0; t < s1.children.length; t++)e.push.apply(e, Nd(s1.children[t])); - return e; -} -var Xu = class extends Mt { - constructor(e, t, n){ - let i = new ua(t, 4, 2), r = new Sn({ - wireframe: !0, - fog: !1, - toneMapped: !1 - }); - super(i, r), this.light = e, this.color = n, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update(); + function H(u, a) { + return l(u) === !0 || u.isFramebufferTexture && u.minFilter !== Ut && u.minFilter !== Et ? Math.log2(Math.max(a.width, a.height)) + 1 : u.mipmaps !== void 0 && u.mipmaps.length > 0 ? u.mipmaps.length : u.isCompressedTexture && Array.isArray(u.image) ? a.mipmaps.length : 1; } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function P(u) { + let a = u.target; + a.removeEventListener("dispose", P), B(a), a.isVideoTexture && C.delete(a); } - update() { - this.light.updateWorldMatrix(!0, !1), this.color !== void 0 ? this.material.color.set(this.color) : this.material.color.copy(this.light.color); + function y1(u) { + let a = u.target; + a.removeEventListener("dispose", y1), f(a); } -}, Bx = new A, qu = new pe, Yu = new pe, Zu = class extends Je { - constructor(e, t, n){ - super(), this.light = e, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, this.type = "HemisphereLightHelper"; - let i = new ha(t); - i.rotateY(Math.PI * .5), this.material = new Sn({ - wireframe: !0, - fog: !1, - toneMapped: !1 - }), this.color === void 0 && (this.material.vertexColors = !0); - let r = i.getAttribute("position"), a = new Float32Array(r.count * 3); - i.setAttribute("color", new et(a, 3)), this.add(new Mt(i, this.material)), this.update(); + function B(u) { + let a = i.get(u); + if (a.__webglInit === void 0) return; + let b = u.source, W = S.get(b); + if (W) { + let K = W[a.__cacheKey]; + K.usedTimes--, K.usedTimes === 0 && p(u), Object.keys(W).length === 0 && S.delete(b); + } + i.remove(u); } - dispose() { - this.children[0].geometry.dispose(), this.children[0].material.dispose(); + function p(u) { + let a = i.get(u); + e.deleteTexture(a.__webglTexture); + let b = u.source, W = S.get(b); + delete W[a.__cacheKey], h.memory.textures--; } - update() { - let e = this.children[0]; - if (this.color !== void 0) this.material.color.set(this.color); + function f(u) { + let a = i.get(u); + if (u.depthTexture && (u.depthTexture.dispose(), i.remove(u.depthTexture)), u.isWebGLCubeRenderTarget) for(let W = 0; W < 6; W++){ + if (Array.isArray(a.__webglFramebuffer[W])) for(let K = 0; K < a.__webglFramebuffer[W].length; K++)e.deleteFramebuffer(a.__webglFramebuffer[W][K]); + else e.deleteFramebuffer(a.__webglFramebuffer[W]); + a.__webglDepthbuffer && e.deleteRenderbuffer(a.__webglDepthbuffer[W]); + } else { - let t = e.geometry.getAttribute("color"); - qu.copy(this.light.color), Yu.copy(this.light.groundColor); - for(let n = 0, i = t.count; n < i; n++){ - let r = n < i / 2 ? qu : Yu; - t.setXYZ(n, r.r, r.g, r.b); - } - t.needsUpdate = !0; - } - this.light.updateWorldMatrix(!0, !1), e.lookAt(Bx.setFromMatrixPosition(this.light.matrixWorld).negate()); - } -}, Ju = class extends en { - constructor(e = 10, t = 10, n = 4473924, i = 8947848){ - n = new pe(n), i = new pe(i); - let r = t / 2, a = e / t, o = e / 2, c = [], l = []; - for(let d = 0, f = 0, m = -o; d <= t; d++, m += a){ - c.push(-o, 0, m, o, 0, m), c.push(m, 0, -o, m, 0, o); - let _ = d === r ? n : i; - _.toArray(l, f), f += 3, _.toArray(l, f), f += 3, _.toArray(l, f), f += 3, _.toArray(l, f), f += 3; - } - let h = new Ge; - h.setAttribute("position", new ve(c, 3)), h.setAttribute("color", new ve(l, 3)); - let u = new wt({ - vertexColors: !0, - toneMapped: !1 - }); - super(h, u), this.type = "GridHelper"; - } - dispose() { - this.geometry.dispose(), this.material.dispose(); + if (Array.isArray(a.__webglFramebuffer)) for(let W = 0; W < a.__webglFramebuffer.length; W++)e.deleteFramebuffer(a.__webglFramebuffer[W]); + else e.deleteFramebuffer(a.__webglFramebuffer); + if (a.__webglDepthbuffer && e.deleteRenderbuffer(a.__webglDepthbuffer), a.__webglMultisampledFramebuffer && e.deleteFramebuffer(a.__webglMultisampledFramebuffer), a.__webglColorRenderbuffer) for(let W = 0; W < a.__webglColorRenderbuffer.length; W++)a.__webglColorRenderbuffer[W] && e.deleteRenderbuffer(a.__webglColorRenderbuffer[W]); + a.__webglDepthRenderbuffer && e.deleteRenderbuffer(a.__webglDepthRenderbuffer); + } + let b = u.textures; + for(let W = 0, K = b.length; W < K; W++){ + let G = i.get(b[W]); + G.__webglTexture && (e.deleteTexture(G.__webglTexture), h.memory.textures--), i.remove(b[W]); + } + i.remove(u); } -}, $u = class extends en { - constructor(e = 10, t = 16, n = 8, i = 64, r = 4473924, a = 8947848){ - r = new pe(r), a = new pe(a); - let o = [], c = []; - if (t > 1) for(let u = 0; u < t; u++){ - let d = u / t * (Math.PI * 2), f = Math.sin(d) * e, m = Math.cos(d) * e; - o.push(0, 0, 0), o.push(f, 0, m); - let _ = u & 1 ? r : a; - c.push(_.r, _.g, _.b), c.push(_.r, _.g, _.b); - } - for(let u = 0; u < n; u++){ - let d = u & 1 ? r : a, f = e - e / n * u; - for(let m = 0; m < i; m++){ - let _ = m / i * (Math.PI * 2), g = Math.sin(_) * f, p = Math.cos(_) * f; - o.push(g, 0, p), c.push(d.r, d.g, d.b), _ = (m + 1) / i * (Math.PI * 2), g = Math.sin(_) * f, p = Math.cos(_) * f, o.push(g, 0, p), c.push(d.r, d.g, d.b); - } - } - let l = new Ge; - l.setAttribute("position", new ve(o, 3)), l.setAttribute("color", new ve(c, 3)); - let h = new wt({ - vertexColors: !0, - toneMapped: !1 - }); - super(l, h), this.type = "PolarGridHelper"; + let A = 0; + function q() { + A = 0; } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function V() { + let u = A; + return u >= c.maxTextures && console.warn("THREE.WebGLTextures: Trying to use " + u + " texture units while this GPU supports only " + c.maxTextures), A += 1, u; } -}, Ku = new A, Ar = new A, Qu = new A, ju = class extends Je { - constructor(e, t, n){ - super(), this.light = e, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, this.type = "DirectionalLightHelper", t === void 0 && (t = 1); - let i = new Ge; - i.setAttribute("position", new ve([ - -t, - t, - 0, - t, - t, - 0, - t, - -t, - 0, - -t, - -t, - 0, - -t, - t, - 0 - ], 3)); - let r = new wt({ - fog: !1, - toneMapped: !1 - }); - this.lightPlane = new bn(i, r), this.add(this.lightPlane), i = new Ge, i.setAttribute("position", new ve([ - 0, - 0, - 0, - 0, - 0, - 1 - ], 3)), this.targetLine = new bn(i, r), this.add(this.targetLine), this.update(); + function Y(u) { + let a = []; + return a.push(u.wrapS), a.push(u.wrapT), a.push(u.wrapR || 0), a.push(u.magFilter), a.push(u.minFilter), a.push(u.anisotropy), a.push(u.internalFormat), a.push(u.format), a.push(u.type), a.push(u.generateMipmaps), a.push(u.premultiplyAlpha), a.push(u.flipY), a.push(u.unpackAlignment), a.push(u.colorSpace), a.join(); + } + function Q(u, a) { + let b = i.get(u); + if (u.isVideoTexture && _e(u), u.isRenderTargetTexture === !1 && u.version > 0 && b.__version !== u.version) { + let W = u.image; + if (W === null) console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found."); + else if (W.complete === !1) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); + else { + k(b, u, a); + return; + } + } + t.bindTexture(e.TEXTURE_2D, b.__webglTexture, e.TEXTURE0 + a); } - dispose() { - this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose(); + function z(u, a) { + let b = i.get(u); + if (u.version > 0 && b.__version !== u.version) { + k(b, u, a); + return; + } + t.bindTexture(e.TEXTURE_2D_ARRAY, b.__webglTexture, e.TEXTURE0 + a); } - update() { - this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1), Ku.setFromMatrixPosition(this.light.matrixWorld), Ar.setFromMatrixPosition(this.light.target.matrixWorld), Qu.subVectors(Ar, Ku), this.lightPlane.lookAt(Ar), this.color !== void 0 ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(Ar), this.targetLine.scale.z = Qu.length(); + function j(u, a) { + let b = i.get(u); + if (u.version > 0 && b.__version !== u.version) { + k(b, u, a); + return; + } + t.bindTexture(e.TEXTURE_3D, b.__webglTexture, e.TEXTURE0 + a); } -}, Rr = new A, ot = new Cs, ed = class extends en { - constructor(e){ - let t = new Ge, n = new wt({ - color: 16777215, - vertexColors: !0, - toneMapped: !1 - }), i = [], r = [], a = {}; - o("n1", "n2"), o("n2", "n4"), o("n4", "n3"), o("n3", "n1"), o("f1", "f2"), o("f2", "f4"), o("f4", "f3"), o("f3", "f1"), o("n1", "f1"), o("n2", "f2"), o("n3", "f3"), o("n4", "f4"), o("p", "n1"), o("p", "n2"), o("p", "n3"), o("p", "n4"), o("u1", "u2"), o("u2", "u3"), o("u3", "u1"), o("c", "t"), o("p", "c"), o("cn1", "cn2"), o("cn3", "cn4"), o("cf1", "cf2"), o("cf3", "cf4"); - function o(m, _) { - c(m), c(_); + function F(u, a) { + let b = i.get(u); + if (u.version > 0 && b.__version !== u.version) { + J(b, u, a); + return; } - function c(m) { - i.push(0, 0, 0), r.push(0, 0, 0), a[m] === void 0 && (a[m] = []), a[m].push(i.length / 3 - 1); + t.bindTexture(e.TEXTURE_CUBE_MAP, b.__webglTexture, e.TEXTURE0 + a); + } + let me = { + [pr]: e.REPEAT, + [Ht]: e.CLAMP_TO_EDGE, + [fr]: e.MIRRORED_REPEAT + }, Me = { + [Ut]: e.NEAREST, + [Jl]: e.NEAREST_MIPMAP_NEAREST, + [Zl]: e.NEAREST_MIPMAP_LINEAR, + [Et]: e.LINEAR, + [Yl]: e.LINEAR_MIPMAP_NEAREST, + [vn]: e.LINEAR_MIPMAP_LINEAR + }, Le = { + [af]: e.NEVER, + [ff]: e.ALWAYS, + [hf]: e.LESS, + [cf]: e.LEQUAL, + [lf]: e.EQUAL, + [pf]: e.GEQUAL, + [uf]: e.GREATER, + [df]: e.NOTEQUAL + }; + function Ge(u, a) { + if (a.type === pi && n.has("OES_texture_float_linear") === !1 && (a.magFilter === Et || a.magFilter === Yl || a.magFilter === Zl || a.magFilter === vn || a.minFilter === Et || a.minFilter === Yl || a.minFilter === Zl || a.minFilter === vn) && console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), e.texParameteri(u, e.TEXTURE_WRAP_S, me[a.wrapS]), e.texParameteri(u, e.TEXTURE_WRAP_T, me[a.wrapT]), (u === e.TEXTURE_3D || u === e.TEXTURE_2D_ARRAY) && e.texParameteri(u, e.TEXTURE_WRAP_R, me[a.wrapR]), e.texParameteri(u, e.TEXTURE_MAG_FILTER, Me[a.magFilter]), e.texParameteri(u, e.TEXTURE_MIN_FILTER, Me[a.minFilter]), a.compareFunction && (e.texParameteri(u, e.TEXTURE_COMPARE_MODE, e.COMPARE_REF_TO_TEXTURE), e.texParameteri(u, e.TEXTURE_COMPARE_FUNC, Le[a.compareFunction])), n.has("EXT_texture_filter_anisotropic") === !0) { + if (a.magFilter === Ut || a.minFilter !== Zl && a.minFilter !== vn || a.type === pi && n.has("OES_texture_float_linear") === !1) return; + if (a.anisotropy > 1 || i.get(a).__currentAnisotropy) { + let b = n.get("EXT_texture_filter_anisotropic"); + e.texParameterf(u, b.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(a.anisotropy, c.getMaxAnisotropy())), i.get(a).__currentAnisotropy = a.anisotropy; + } + } + } + function Ze(u, a) { + let b = !1; + u.__webglInit === void 0 && (u.__webglInit = !0, a.addEventListener("dispose", P)); + let W = a.source, K = S.get(W); + K === void 0 && (K = {}, S.set(W, K)); + let G = Y(a); + if (G !== u.__cacheKey) { + K[G] === void 0 && (K[G] = { + texture: e.createTexture(), + usedTimes: 0 + }, h.memory.textures++, b = !0), K[G].usedTimes++; + let pe = K[u.__cacheKey]; + pe !== void 0 && (K[u.__cacheKey].usedTimes--, pe.usedTimes === 0 && p(a)), u.__cacheKey = G, u.__webglTexture = K[G].texture; + } + return b; + } + function k(u, a, b) { + let W = e.TEXTURE_2D; + (a.isDataArrayTexture || a.isCompressedArrayTexture) && (W = e.TEXTURE_2D_ARRAY), a.isData3DTexture && (W = e.TEXTURE_3D); + let K = Ze(u, a), G = a.source; + t.bindTexture(W, u.__webglTexture, e.TEXTURE0 + b); + let pe = i.get(G); + if (G.version !== pe.__version || K === !0) { + t.activeTexture(e.TEXTURE0 + b); + let re = Tt.getPrimaries(Tt.workingColorSpace), ce = a.colorSpace === zl ? null : Tt.getPrimaries(a.colorSpace), ye = a.colorSpace === zl || re === ce ? e.NONE : e.BROWSER_DEFAULT_WEBGL; + e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, a.flipY), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, a.premultiplyAlpha), e.pixelStorei(e.UNPACK_ALIGNMENT, a.unpackAlignment), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, ye); + let Z = L(a.image, !1, c.maxTextureSize); + Z = Xe(a, Z); + let le = s.convert(a.format, a.colorSpace), Se = s.convert(a.type), xe = M(a.internalFormat, le, Se, a.colorSpace, a.isVideoTexture); + Ge(W, a); + let fe, Ie = a.mipmaps, be = a.isVideoTexture !== !0, ze = pe.__version === void 0 || K === !0, v = G.dataReady, te = H(a, Z); + if (a.isDepthTexture) xe = _(a.format === aa, a.type), ze && (be ? t.texStorage2D(e.TEXTURE_2D, 1, xe, Z.width, Z.height) : t.texImage2D(e.TEXTURE_2D, 0, xe, Z.width, Z.height, 0, le, Se, null)); + else if (a.isDataTexture) if (Ie.length > 0) { + be && ze && t.texStorage2D(e.TEXTURE_2D, te, xe, Ie[0].width, Ie[0].height); + for(let N = 0, X = Ie.length; N < X; N++)fe = Ie[N], be ? v && t.texSubImage2D(e.TEXTURE_2D, N, 0, 0, fe.width, fe.height, le, Se, fe.data) : t.texImage2D(e.TEXTURE_2D, N, xe, fe.width, fe.height, 0, le, Se, fe.data); + a.generateMipmaps = !1; + } else be ? (ze && t.texStorage2D(e.TEXTURE_2D, te, xe, Z.width, Z.height), v && t.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, Z.width, Z.height, le, Se, Z.data)) : t.texImage2D(e.TEXTURE_2D, 0, xe, Z.width, Z.height, 0, le, Se, Z.data); + else if (a.isCompressedTexture) if (a.isCompressedArrayTexture) { + be && ze && t.texStorage3D(e.TEXTURE_2D_ARRAY, te, xe, Ie[0].width, Ie[0].height, Z.depth); + for(let N = 0, X = Ie.length; N < X; N++)if (fe = Ie[N], a.format !== Li) if (le !== null) if (be) { + if (v) if (a.layerUpdates.size > 0) { + let oe = Nd(fe.width, fe.height, a.format, a.type); + for (let ae of a.layerUpdates){ + let Ce = fe.data.subarray(ae * oe / fe.data.BYTES_PER_ELEMENT, (ae + 1) * oe / fe.data.BYTES_PER_ELEMENT); + t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY, N, 0, 0, ae, fe.width, fe.height, 1, le, Ce); + } + a.clearLayerUpdates(); + } else t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY, N, 0, 0, 0, fe.width, fe.height, Z.depth, le, fe.data); + } else t.compressedTexImage3D(e.TEXTURE_2D_ARRAY, N, xe, fe.width, fe.height, Z.depth, 0, fe.data, 0, 0); + else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"); + else be ? v && t.texSubImage3D(e.TEXTURE_2D_ARRAY, N, 0, 0, 0, fe.width, fe.height, Z.depth, le, Se, fe.data) : t.texImage3D(e.TEXTURE_2D_ARRAY, N, xe, fe.width, fe.height, Z.depth, 0, le, Se, fe.data); + } else { + be && ze && t.texStorage2D(e.TEXTURE_2D, te, xe, Ie[0].width, Ie[0].height); + for(let N = 0, X = Ie.length; N < X; N++)fe = Ie[N], a.format !== Li ? le !== null ? be ? v && t.compressedTexSubImage2D(e.TEXTURE_2D, N, 0, 0, fe.width, fe.height, le, fe.data) : t.compressedTexImage2D(e.TEXTURE_2D, N, xe, fe.width, fe.height, 0, fe.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : be ? v && t.texSubImage2D(e.TEXTURE_2D, N, 0, 0, fe.width, fe.height, le, Se, fe.data) : t.texImage2D(e.TEXTURE_2D, N, xe, fe.width, fe.height, 0, le, Se, fe.data); + } + else if (a.isDataArrayTexture) if (be) { + if (ze && t.texStorage3D(e.TEXTURE_2D_ARRAY, te, xe, Z.width, Z.height, Z.depth), v) if (a.layerUpdates.size > 0) { + let N = Nd(Z.width, Z.height, a.format, a.type); + for (let X of a.layerUpdates){ + let oe = Z.data.subarray(X * N / Z.data.BYTES_PER_ELEMENT, (X + 1) * N / Z.data.BYTES_PER_ELEMENT); + t.texSubImage3D(e.TEXTURE_2D_ARRAY, 0, 0, 0, X, Z.width, Z.height, 1, le, Se, oe); + } + a.clearLayerUpdates(); + } else t.texSubImage3D(e.TEXTURE_2D_ARRAY, 0, 0, 0, 0, Z.width, Z.height, Z.depth, le, Se, Z.data); + } else t.texImage3D(e.TEXTURE_2D_ARRAY, 0, xe, Z.width, Z.height, Z.depth, 0, le, Se, Z.data); + else if (a.isData3DTexture) be ? (ze && t.texStorage3D(e.TEXTURE_3D, te, xe, Z.width, Z.height, Z.depth), v && t.texSubImage3D(e.TEXTURE_3D, 0, 0, 0, 0, Z.width, Z.height, Z.depth, le, Se, Z.data)) : t.texImage3D(e.TEXTURE_3D, 0, xe, Z.width, Z.height, Z.depth, 0, le, Se, Z.data); + else if (a.isFramebufferTexture) { + if (ze) if (be) t.texStorage2D(e.TEXTURE_2D, te, xe, Z.width, Z.height); + else { + let N = Z.width, X = Z.height; + for(let oe = 0; oe < te; oe++)t.texImage2D(e.TEXTURE_2D, oe, xe, N, X, 0, le, Se, null), N >>= 1, X >>= 1; + } + } else if (Ie.length > 0) { + if (be && ze) { + let N = he(Ie[0]); + t.texStorage2D(e.TEXTURE_2D, te, xe, N.width, N.height); + } + for(let N = 0, X = Ie.length; N < X; N++)fe = Ie[N], be ? v && t.texSubImage2D(e.TEXTURE_2D, N, 0, 0, le, Se, fe) : t.texImage2D(e.TEXTURE_2D, N, xe, le, Se, fe); + a.generateMipmaps = !1; + } else if (be) { + if (ze) { + let N = he(Z); + t.texStorage2D(e.TEXTURE_2D, te, xe, N.width, N.height); + } + v && t.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, le, Se, Z); + } else t.texImage2D(e.TEXTURE_2D, 0, xe, le, Se, Z); + l(a) && r(W), pe.__version = G.version, a.onUpdate && a.onUpdate(a); + } + u.__version = a.version; + } + function J(u, a, b) { + if (a.image.length !== 6) return; + let W = Ze(u, a), K = a.source; + t.bindTexture(e.TEXTURE_CUBE_MAP, u.__webglTexture, e.TEXTURE0 + b); + let G = i.get(K); + if (K.version !== G.__version || W === !0) { + t.activeTexture(e.TEXTURE0 + b); + let pe = Tt.getPrimaries(Tt.workingColorSpace), re = a.colorSpace === zl ? null : Tt.getPrimaries(a.colorSpace), ce = a.colorSpace === zl || pe === re ? e.NONE : e.BROWSER_DEFAULT_WEBGL; + e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, a.flipY), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, a.premultiplyAlpha), e.pixelStorei(e.UNPACK_ALIGNMENT, a.unpackAlignment), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, ce); + let ye = a.isCompressedTexture || a.image[0].isCompressedTexture, Z = a.image[0] && a.image[0].isDataTexture, le = []; + for(let X = 0; X < 6; X++)!ye && !Z ? le[X] = L(a.image[X], !0, c.maxCubemapSize) : le[X] = Z ? a.image[X].image : a.image[X], le[X] = Xe(a, le[X]); + let Se = le[0], xe = s.convert(a.format, a.colorSpace), fe = s.convert(a.type), Ie = M(a.internalFormat, xe, fe, a.colorSpace), be = a.isVideoTexture !== !0, ze = G.__version === void 0 || W === !0, v = K.dataReady, te = H(a, Se); + Ge(e.TEXTURE_CUBE_MAP, a); + let N; + if (ye) { + be && ze && t.texStorage2D(e.TEXTURE_CUBE_MAP, te, Ie, Se.width, Se.height); + for(let X = 0; X < 6; X++){ + N = le[X].mipmaps; + for(let oe = 0; oe < N.length; oe++){ + let ae = N[oe]; + a.format !== Li ? xe !== null ? be ? v && t.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe, 0, 0, ae.width, ae.height, xe, ae.data) : t.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe, Ie, ae.width, ae.height, 0, ae.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : be ? v && t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe, 0, 0, ae.width, ae.height, xe, fe, ae.data) : t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe, Ie, ae.width, ae.height, 0, xe, fe, ae.data); + } + } + } else { + if (N = a.mipmaps, be && ze) { + N.length > 0 && te++; + let X = he(le[0]); + t.texStorage2D(e.TEXTURE_CUBE_MAP, te, Ie, X.width, X.height); + } + for(let X = 0; X < 6; X++)if (Z) { + be ? v && t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, 0, 0, 0, le[X].width, le[X].height, xe, fe, le[X].data) : t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, 0, Ie, le[X].width, le[X].height, 0, xe, fe, le[X].data); + for(let oe = 0; oe < N.length; oe++){ + let Ce = N[oe].image[X].image; + be ? v && t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe + 1, 0, 0, Ce.width, Ce.height, xe, fe, Ce.data) : t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe + 1, Ie, Ce.width, Ce.height, 0, xe, fe, Ce.data); + } + } else { + be ? v && t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, 0, 0, 0, xe, fe, le[X]) : t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, 0, Ie, xe, fe, le[X]); + for(let oe = 0; oe < N.length; oe++){ + let ae = N[oe]; + be ? v && t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe + 1, 0, 0, xe, fe, ae.image[X]) : t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + X, oe + 1, Ie, xe, fe, ae.image[X]); + } + } + } + l(a) && r(e.TEXTURE_CUBE_MAP), G.__version = K.version, a.onUpdate && a.onUpdate(a); } - t.setAttribute("position", new ve(i, 3)), t.setAttribute("color", new ve(r, 3)), super(t, n), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = a, this.update(); - let l = new pe(16755200), h = new pe(16711680), u = new pe(43775), d = new pe(16777215), f = new pe(3355443); - this.setColors(l, h, u, d, f); + u.__version = a.version; } - setColors(e, t, n, i, r) { - let o = this.geometry.getAttribute("color"); - o.setXYZ(0, e.r, e.g, e.b), o.setXYZ(1, e.r, e.g, e.b), o.setXYZ(2, e.r, e.g, e.b), o.setXYZ(3, e.r, e.g, e.b), o.setXYZ(4, e.r, e.g, e.b), o.setXYZ(5, e.r, e.g, e.b), o.setXYZ(6, e.r, e.g, e.b), o.setXYZ(7, e.r, e.g, e.b), o.setXYZ(8, e.r, e.g, e.b), o.setXYZ(9, e.r, e.g, e.b), o.setXYZ(10, e.r, e.g, e.b), o.setXYZ(11, e.r, e.g, e.b), o.setXYZ(12, e.r, e.g, e.b), o.setXYZ(13, e.r, e.g, e.b), o.setXYZ(14, e.r, e.g, e.b), o.setXYZ(15, e.r, e.g, e.b), o.setXYZ(16, e.r, e.g, e.b), o.setXYZ(17, e.r, e.g, e.b), o.setXYZ(18, e.r, e.g, e.b), o.setXYZ(19, e.r, e.g, e.b), o.setXYZ(20, e.r, e.g, e.b), o.setXYZ(21, e.r, e.g, e.b), o.setXYZ(22, e.r, e.g, e.b), o.setXYZ(23, e.r, e.g, e.b), o.setXYZ(24, t.r, t.g, t.b), o.setXYZ(25, t.r, t.g, t.b), o.setXYZ(26, t.r, t.g, t.b), o.setXYZ(27, t.r, t.g, t.b), o.setXYZ(28, t.r, t.g, t.b), o.setXYZ(29, t.r, t.g, t.b), o.setXYZ(30, t.r, t.g, t.b), o.setXYZ(31, t.r, t.g, t.b), o.setXYZ(32, n.r, n.g, n.b), o.setXYZ(33, n.r, n.g, n.b), o.setXYZ(34, n.r, n.g, n.b), o.setXYZ(35, n.r, n.g, n.b), o.setXYZ(36, n.r, n.g, n.b), o.setXYZ(37, n.r, n.g, n.b), o.setXYZ(38, i.r, i.g, i.b), o.setXYZ(39, i.r, i.g, i.b), o.setXYZ(40, r.r, r.g, r.b), o.setXYZ(41, r.r, r.g, r.b), o.setXYZ(42, r.r, r.g, r.b), o.setXYZ(43, r.r, r.g, r.b), o.setXYZ(44, r.r, r.g, r.b), o.setXYZ(45, r.r, r.g, r.b), o.setXYZ(46, r.r, r.g, r.b), o.setXYZ(47, r.r, r.g, r.b), o.setXYZ(48, r.r, r.g, r.b), o.setXYZ(49, r.r, r.g, r.b), o.needsUpdate = !0; + function ue(u, a, b, W, K, G) { + let pe = s.convert(b.format, b.colorSpace), re = s.convert(b.type), ce = M(b.internalFormat, pe, re, b.colorSpace), ye = i.get(a), Z = i.get(b); + if (Z.__renderTarget = a, !ye.__hasExternalTextures) { + let le = Math.max(1, a.width >> G), Se = Math.max(1, a.height >> G); + K === e.TEXTURE_3D || K === e.TEXTURE_2D_ARRAY ? t.texImage3D(K, G, ce, le, Se, a.depth, 0, pe, re, null) : t.texImage2D(K, G, ce, le, Se, 0, pe, re, null); + } + t.bindFramebuffer(e.FRAMEBUFFER, u), we(a) ? d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, W, K, Z.__webglTexture, 0, De(a)) : (K === e.TEXTURE_2D || K >= e.TEXTURE_CUBE_MAP_POSITIVE_X && K <= e.TEXTURE_CUBE_MAP_NEGATIVE_Z) && e.framebufferTexture2D(e.FRAMEBUFFER, W, K, Z.__webglTexture, G), t.bindFramebuffer(e.FRAMEBUFFER, null); } - update() { - let e = this.geometry, t = this.pointMap, n = 1, i = 1; - ot.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), ht("c", t, e, ot, 0, 0, -1), ht("t", t, e, ot, 0, 0, 1), ht("n1", t, e, ot, -n, -i, -1), ht("n2", t, e, ot, n, -i, -1), ht("n3", t, e, ot, -n, i, -1), ht("n4", t, e, ot, n, i, -1), ht("f1", t, e, ot, -n, -i, 1), ht("f2", t, e, ot, n, -i, 1), ht("f3", t, e, ot, -n, i, 1), ht("f4", t, e, ot, n, i, 1), ht("u1", t, e, ot, n * .7, i * 1.1, -1), ht("u2", t, e, ot, -n * .7, i * 1.1, -1), ht("u3", t, e, ot, 0, i * 2, -1), ht("cf1", t, e, ot, -n, 0, 1), ht("cf2", t, e, ot, n, 0, 1), ht("cf3", t, e, ot, 0, -i, 1), ht("cf4", t, e, ot, 0, i, 1), ht("cn1", t, e, ot, -n, 0, -1), ht("cn2", t, e, ot, n, 0, -1), ht("cn3", t, e, ot, 0, -i, -1), ht("cn4", t, e, ot, 0, i, -1), e.getAttribute("position").needsUpdate = !0; + function ie(u, a, b) { + if (e.bindRenderbuffer(e.RENDERBUFFER, u), a.depthBuffer) { + let W = a.depthTexture, K = W && W.isDepthTexture ? W.type : null, G = _(a.stencilBuffer, K), pe = a.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT, re = De(a); + we(a) ? d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER, re, G, a.width, a.height) : b ? e.renderbufferStorageMultisample(e.RENDERBUFFER, re, G, a.width, a.height) : e.renderbufferStorage(e.RENDERBUFFER, G, a.width, a.height), e.framebufferRenderbuffer(e.FRAMEBUFFER, pe, e.RENDERBUFFER, u); + } else { + let W = a.textures; + for(let K = 0; K < W.length; K++){ + let G = W[K], pe = s.convert(G.format, G.colorSpace), re = s.convert(G.type), ce = M(G.internalFormat, pe, re, G.colorSpace), ye = De(a); + b && we(a) === !1 ? e.renderbufferStorageMultisample(e.RENDERBUFFER, ye, ce, a.width, a.height) : we(a) ? d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER, ye, ce, a.width, a.height) : e.renderbufferStorage(e.RENDERBUFFER, ce, a.width, a.height); + } + } + e.bindRenderbuffer(e.RENDERBUFFER, null); + } + function Ee(u, a) { + if (a && a.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); + if (t.bindFramebuffer(e.FRAMEBUFFER, u), !(a.depthTexture && a.depthTexture.isDepthTexture)) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); + let W = i.get(a.depthTexture); + W.__renderTarget = a, (!W.__webglTexture || a.depthTexture.image.width !== a.width || a.depthTexture.image.height !== a.height) && (a.depthTexture.image.width = a.width, a.depthTexture.image.height = a.height, a.depthTexture.needsUpdate = !0), Q(a.depthTexture, 0); + let K = W.__webglTexture, G = De(a); + if (a.depthTexture.format === Cn) we(a) ? d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.TEXTURE_2D, K, 0, G) : e.framebufferTexture2D(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.TEXTURE_2D, K, 0); + else if (a.depthTexture.format === aa) we(a) ? d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.TEXTURE_2D, K, 0, G) : e.framebufferTexture2D(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.TEXTURE_2D, K, 0); + else throw new Error("Unknown depthTexture format"); } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function Be(u) { + let a = i.get(u), b = u.isWebGLCubeRenderTarget === !0; + if (a.__boundDepthTexture !== u.depthTexture) { + let W = u.depthTexture; + if (a.__depthDisposeCallback && a.__depthDisposeCallback(), W) { + let K = ()=>{ + delete a.__boundDepthTexture, delete a.__depthDisposeCallback, W.removeEventListener("dispose", K); + }; + W.addEventListener("dispose", K), a.__depthDisposeCallback = K; + } + a.__boundDepthTexture = W; + } + if (u.depthTexture && !a.__autoAllocateDepthBuffer) { + if (b) throw new Error("target.depthTexture not supported in Cube render targets"); + Ee(a.__webglFramebuffer, u); + } else if (b) { + a.__webglDepthbuffer = []; + for(let W = 0; W < 6; W++)if (t.bindFramebuffer(e.FRAMEBUFFER, a.__webglFramebuffer[W]), a.__webglDepthbuffer[W] === void 0) a.__webglDepthbuffer[W] = e.createRenderbuffer(), ie(a.__webglDepthbuffer[W], u, !1); + else { + let K = u.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT, G = a.__webglDepthbuffer[W]; + e.bindRenderbuffer(e.RENDERBUFFER, G), e.framebufferRenderbuffer(e.FRAMEBUFFER, K, e.RENDERBUFFER, G); + } + } else if (t.bindFramebuffer(e.FRAMEBUFFER, a.__webglFramebuffer), a.__webglDepthbuffer === void 0) a.__webglDepthbuffer = e.createRenderbuffer(), ie(a.__webglDepthbuffer, u, !1); + else { + let W = u.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT, K = a.__webglDepthbuffer; + e.bindRenderbuffer(e.RENDERBUFFER, K), e.framebufferRenderbuffer(e.FRAMEBUFFER, W, e.RENDERBUFFER, K); + } + t.bindFramebuffer(e.FRAMEBUFFER, null); + } + function Te(u, a, b) { + let W = i.get(u); + a !== void 0 && ue(W.__webglFramebuffer, u, u.texture, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, 0), b !== void 0 && Be(u); + } + function je(u) { + let a = u.texture, b = i.get(u), W = i.get(a); + u.addEventListener("dispose", y1); + let K = u.textures, G = u.isWebGLCubeRenderTarget === !0, pe = K.length > 1; + if (pe || (W.__webglTexture === void 0 && (W.__webglTexture = e.createTexture()), W.__version = a.version, h.memory.textures++), G) { + b.__webglFramebuffer = []; + for(let re = 0; re < 6; re++)if (a.mipmaps && a.mipmaps.length > 0) { + b.__webglFramebuffer[re] = []; + for(let ce = 0; ce < a.mipmaps.length; ce++)b.__webglFramebuffer[re][ce] = e.createFramebuffer(); + } else b.__webglFramebuffer[re] = e.createFramebuffer(); + } else { + if (a.mipmaps && a.mipmaps.length > 0) { + b.__webglFramebuffer = []; + for(let re = 0; re < a.mipmaps.length; re++)b.__webglFramebuffer[re] = e.createFramebuffer(); + } else b.__webglFramebuffer = e.createFramebuffer(); + if (pe) for(let re = 0, ce = K.length; re < ce; re++){ + let ye = i.get(K[re]); + ye.__webglTexture === void 0 && (ye.__webglTexture = e.createTexture(), h.memory.textures++); + } + if (u.samples > 0 && we(u) === !1) { + b.__webglMultisampledFramebuffer = e.createFramebuffer(), b.__webglColorRenderbuffer = [], t.bindFramebuffer(e.FRAMEBUFFER, b.__webglMultisampledFramebuffer); + for(let re = 0; re < K.length; re++){ + let ce = K[re]; + b.__webglColorRenderbuffer[re] = e.createRenderbuffer(), e.bindRenderbuffer(e.RENDERBUFFER, b.__webglColorRenderbuffer[re]); + let ye = s.convert(ce.format, ce.colorSpace), Z = s.convert(ce.type), le = M(ce.internalFormat, ye, Z, ce.colorSpace, u.isXRRenderTarget === !0), Se = De(u); + e.renderbufferStorageMultisample(e.RENDERBUFFER, Se, le, u.width, u.height), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + re, e.RENDERBUFFER, b.__webglColorRenderbuffer[re]); + } + e.bindRenderbuffer(e.RENDERBUFFER, null), u.depthBuffer && (b.__webglDepthRenderbuffer = e.createRenderbuffer(), ie(b.__webglDepthRenderbuffer, u, !0)), t.bindFramebuffer(e.FRAMEBUFFER, null); + } + } + if (G) { + t.bindTexture(e.TEXTURE_CUBE_MAP, W.__webglTexture), Ge(e.TEXTURE_CUBE_MAP, a); + for(let re = 0; re < 6; re++)if (a.mipmaps && a.mipmaps.length > 0) for(let ce = 0; ce < a.mipmaps.length; ce++)ue(b.__webglFramebuffer[re][ce], u, a, e.COLOR_ATTACHMENT0, e.TEXTURE_CUBE_MAP_POSITIVE_X + re, ce); + else ue(b.__webglFramebuffer[re], u, a, e.COLOR_ATTACHMENT0, e.TEXTURE_CUBE_MAP_POSITIVE_X + re, 0); + l(a) && r(e.TEXTURE_CUBE_MAP), t.unbindTexture(); + } else if (pe) { + for(let re = 0, ce = K.length; re < ce; re++){ + let ye = K[re], Z = i.get(ye); + t.bindTexture(e.TEXTURE_2D, Z.__webglTexture), Ge(e.TEXTURE_2D, ye), ue(b.__webglFramebuffer, u, ye, e.COLOR_ATTACHMENT0 + re, e.TEXTURE_2D, 0), l(ye) && r(e.TEXTURE_2D); + } + t.unbindTexture(); + } else { + let re = e.TEXTURE_2D; + if ((u.isWebGL3DRenderTarget || u.isWebGLArrayRenderTarget) && (re = u.isWebGL3DRenderTarget ? e.TEXTURE_3D : e.TEXTURE_2D_ARRAY), t.bindTexture(re, W.__webglTexture), Ge(re, a), a.mipmaps && a.mipmaps.length > 0) for(let ce = 0; ce < a.mipmaps.length; ce++)ue(b.__webglFramebuffer[ce], u, a, e.COLOR_ATTACHMENT0, re, ce); + else ue(b.__webglFramebuffer, u, a, e.COLOR_ATTACHMENT0, re, 0); + l(a) && r(re), t.unbindTexture(); + } + u.depthBuffer && Be(u); + } + function $e(u) { + let a = u.textures; + for(let b = 0, W = a.length; b < W; b++){ + let K = a[b]; + if (l(K)) { + let G = w(u), pe = i.get(K).__webglTexture; + t.bindTexture(G, pe), r(G), t.unbindTexture(); + } + } + } + let Ue = [], m = []; + function ut(u) { + if (u.samples > 0) { + if (we(u) === !1) { + let a = u.textures, b = u.width, W = u.height, K = e.COLOR_BUFFER_BIT, G = u.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT, pe = i.get(u), re = a.length > 1; + if (re) for(let ce = 0; ce < a.length; ce++)t.bindFramebuffer(e.FRAMEBUFFER, pe.__webglMultisampledFramebuffer), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + ce, e.RENDERBUFFER, null), t.bindFramebuffer(e.FRAMEBUFFER, pe.__webglFramebuffer), e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0 + ce, e.TEXTURE_2D, null, 0); + t.bindFramebuffer(e.READ_FRAMEBUFFER, pe.__webglMultisampledFramebuffer), t.bindFramebuffer(e.DRAW_FRAMEBUFFER, pe.__webglFramebuffer); + for(let ce = 0; ce < a.length; ce++){ + if (u.resolveDepthBuffer && (u.depthBuffer && (K |= e.DEPTH_BUFFER_BIT), u.stencilBuffer && u.resolveStencilBuffer && (K |= e.STENCIL_BUFFER_BIT)), re) { + e.framebufferRenderbuffer(e.READ_FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.RENDERBUFFER, pe.__webglColorRenderbuffer[ce]); + let ye = i.get(a[ce]).__webglTexture; + e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, ye, 0); + } + e.blitFramebuffer(0, 0, b, W, 0, 0, b, W, K, e.NEAREST), I === !0 && (Ue.length = 0, m.length = 0, Ue.push(e.COLOR_ATTACHMENT0 + ce), u.depthBuffer && u.resolveDepthBuffer === !1 && (Ue.push(G), m.push(G), e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER, m)), e.invalidateFramebuffer(e.READ_FRAMEBUFFER, Ue)); + } + if (t.bindFramebuffer(e.READ_FRAMEBUFFER, null), t.bindFramebuffer(e.DRAW_FRAMEBUFFER, null), re) for(let ce = 0; ce < a.length; ce++){ + t.bindFramebuffer(e.FRAMEBUFFER, pe.__webglMultisampledFramebuffer), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + ce, e.RENDERBUFFER, pe.__webglColorRenderbuffer[ce]); + let ye = i.get(a[ce]).__webglTexture; + t.bindFramebuffer(e.FRAMEBUFFER, pe.__webglFramebuffer), e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0 + ce, e.TEXTURE_2D, ye, 0); + } + t.bindFramebuffer(e.DRAW_FRAMEBUFFER, pe.__webglMultisampledFramebuffer); + } else if (u.depthBuffer && u.resolveDepthBuffer === !1 && I) { + let a = u.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT; + e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER, [ + a + ]); + } + } } -}; -function ht(s1, e, t, n, i, r, a) { - Rr.set(i, r, a).unproject(n); - let o = e[s1]; - if (o !== void 0) { - let c = t.getAttribute("position"); - for(let l = 0, h = o.length; l < h; l++)c.setXYZ(o[l], Rr.x, Rr.y, Rr.z); + function De(u) { + return Math.min(c.maxSamples, u.samples); + } + function we(u) { + let a = i.get(u); + return u.samples > 0 && n.has("WEBGL_multisampled_render_to_texture") === !0 && a.__useRenderToTexture !== !1; + } + function _e(u) { + let a = h.render.frame; + C.get(u) !== a && (C.set(u, a), u.update()); + } + function Xe(u, a) { + let b = u.colorSpace, W = u.format, K = u.type; + return u.isCompressedTexture === !0 || u.isVideoTexture === !0 || b !== ha && b !== zl && (Tt.getTransfer(b) === Fn ? (W !== Li || K !== Sl) && console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", b)), a; + } + function he(u) { + return typeof HTMLImageElement < "u" && u instanceof HTMLImageElement ? (T1.width = u.naturalWidth || u.width, T1.height = u.naturalHeight || u.height) : typeof VideoFrame < "u" && u instanceof VideoFrame ? (T1.width = u.displayWidth, T1.height = u.displayHeight) : (T1.width = u.width, T1.height = u.height), T1; + } + this.allocateTextureUnit = V, this.resetTextureUnits = q, this.setTexture2D = Q, this.setTexture2DArray = z, this.setTexture3D = j, this.setTextureCube = F, this.rebindTextures = Te, this.setupRenderTarget = je, this.updateRenderTargetMipmap = $e, this.updateMultisampleRenderTarget = ut, this.setupDepthRenderbuffer = Be, this.setupFrameBufferTexture = ue, this.useMultisampledRTT = we; +} +function yf1(e, n) { + function t(i, c = zl) { + let s, h = Tt.getTransfer(c); + if (i === Sl) return e.UNSIGNED_BYTE; + if (i === ec) return e.UNSIGNED_SHORT_4_4_4_4; + if (i === ic) return e.UNSIGNED_SHORT_5_5_5_1; + if (i === nc) return e.UNSIGNED_INT_5_9_9_9_REV; + if (i === $l) return e.BYTE; + if (i === Ql) return e.SHORT; + if (i === jl) return e.UNSIGNED_SHORT; + if (i === Kl) return e.INT; + if (i === Wo) return e.UNSIGNED_INT; + if (i === pi) return e.FLOAT; + if (i === tc) return e.HALF_FLOAT; + if (i === rc) return e.ALPHA; + if (i === oc) return e.RGB; + if (i === Li) return e.RGBA; + if (i === ac) return e.LUMINANCE; + if (i === hc) return e.LUMINANCE_ALPHA; + if (i === Cn) return e.DEPTH_COMPONENT; + if (i === aa) return e.DEPTH_STENCIL; + if (i === Tl) return e.RED; + if (i === Il) return e.RED_INTEGER; + if (i === lc) return e.RG; + if (i === cc) return e.RG_INTEGER; + if (i === uc) return e.RGBA_INTEGER; + if (i === dc || i === pc || i === fc || i === mc) if (h === Fn) if (s = n.get("WEBGL_compressed_texture_s3tc_srgb"), s !== null) { + if (i === dc) return s.COMPRESSED_SRGB_S3TC_DXT1_EXT; + if (i === pc) return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; + if (i === fc) return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; + if (i === mc) return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; + } else return null; + else if (s = n.get("WEBGL_compressed_texture_s3tc"), s !== null) { + if (i === dc) return s.COMPRESSED_RGB_S3TC_DXT1_EXT; + if (i === pc) return s.COMPRESSED_RGBA_S3TC_DXT1_EXT; + if (i === fc) return s.COMPRESSED_RGBA_S3TC_DXT3_EXT; + if (i === mc) return s.COMPRESSED_RGBA_S3TC_DXT5_EXT; + } else return null; + if (i === yc || i === gc || i === xc || i === bc) if (s = n.get("WEBGL_compressed_texture_pvrtc"), s !== null) { + if (i === yc) return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + if (i === gc) return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + if (i === xc) return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + if (i === bc) return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + } else return null; + if (i === wc || i === Mc || i === _c) if (s = n.get("WEBGL_compressed_texture_etc"), s !== null) { + if (i === wc || i === Mc) return h === Fn ? s.COMPRESSED_SRGB8_ETC2 : s.COMPRESSED_RGB8_ETC2; + if (i === _c) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : s.COMPRESSED_RGBA8_ETC2_EAC; + } else return null; + if (i === vc || i === Ac || i === Sc || i === Tc || i === Ic || i === Cc || i === zc || i === Fc || i === Bc || i === Ec || i === Rc || i === kc || i === Pc || i === Oc) if (s = n.get("WEBGL_compressed_texture_astc"), s !== null) { + if (i === vc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : s.COMPRESSED_RGBA_ASTC_4x4_KHR; + if (i === Ac) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : s.COMPRESSED_RGBA_ASTC_5x4_KHR; + if (i === Sc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : s.COMPRESSED_RGBA_ASTC_5x5_KHR; + if (i === Tc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : s.COMPRESSED_RGBA_ASTC_6x5_KHR; + if (i === Ic) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : s.COMPRESSED_RGBA_ASTC_6x6_KHR; + if (i === Cc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : s.COMPRESSED_RGBA_ASTC_8x5_KHR; + if (i === zc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : s.COMPRESSED_RGBA_ASTC_8x6_KHR; + if (i === Fc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : s.COMPRESSED_RGBA_ASTC_8x8_KHR; + if (i === Bc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : s.COMPRESSED_RGBA_ASTC_10x5_KHR; + if (i === Ec) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : s.COMPRESSED_RGBA_ASTC_10x6_KHR; + if (i === Rc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : s.COMPRESSED_RGBA_ASTC_10x8_KHR; + if (i === kc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : s.COMPRESSED_RGBA_ASTC_10x10_KHR; + if (i === Pc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : s.COMPRESSED_RGBA_ASTC_12x10_KHR; + if (i === Oc) return h === Fn ? s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : s.COMPRESSED_RGBA_ASTC_12x12_KHR; + } else return null; + if (i === Nc || i === Vc || i === Dc) if (s = n.get("EXT_texture_compression_bptc"), s !== null) { + if (i === Nc) return h === Fn ? s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : s.COMPRESSED_RGBA_BPTC_UNORM_EXT; + if (i === Vc) return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; + if (i === Dc) return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; + } else return null; + if (i === Lc || i === Uc || i === Wc || i === Hc) if (s = n.get("EXT_texture_compression_rgtc"), s !== null) { + if (i === Nc) return s.COMPRESSED_RED_RGTC1_EXT; + if (i === Uc) return s.COMPRESSED_SIGNED_RED_RGTC1_EXT; + if (i === Wc) return s.COMPRESSED_RED_GREEN_RGTC2_EXT; + if (i === Hc) return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; + } else return null; + return i === sc ? e.UNSIGNED_INT_24_8 : e[i] !== void 0 ? e[i] : null; } + return { + convert: t + }; } -var Cr = new Qt, td = class extends en { - constructor(e, t = 16776960){ - let n = new Uint16Array([ - 0, - 1, - 1, - 2, - 2, - 3, - 3, - 0, - 4, - 5, - 5, - 6, - 6, - 7, - 7, - 4, - 0, - 4, - 1, - 5, - 2, - 6, - 3, - 7 - ]), i = new Float32Array(8 * 3), r = new Ge; - r.setIndex(new et(n, 1)), r.setAttribute("position", new et(i, 3)), super(r, new wt({ - color: t, - toneMapped: !1 - })), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update(); - } - update(e) { - if (e !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && Cr.setFromObject(this.object), Cr.isEmpty()) return; - let t = Cr.min, n = Cr.max, i = this.geometry.attributes.position, r = i.array; - r[0] = n.x, r[1] = n.y, r[2] = n.z, r[3] = t.x, r[4] = n.y, r[5] = n.z, r[6] = t.x, r[7] = t.y, r[8] = n.z, r[9] = n.x, r[10] = t.y, r[11] = n.z, r[12] = n.x, r[13] = n.y, r[14] = t.z, r[15] = t.x, r[16] = n.y, r[17] = t.z, r[18] = t.x, r[19] = t.y, r[20] = t.z, r[21] = n.x, r[22] = t.y, r[23] = t.z, i.needsUpdate = !0, this.geometry.computeBoundingSphere(); - } - setFromObject(e) { - return this.object = e, this.update(), this; +var Nf = ` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`, Of1 = ` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`, $n1 = class { + constructor(){ + this.texture = null, this.mesh = null, this.depthNear = 0, this.depthFar = 0; + } + init(n, t, i) { + if (this.texture === null) { + let c = new lt, s = n.properties.get(c); + s.__webglTexture = t.texture, (t.depthNear !== i.depthNear || t.depthFar !== i.depthFar) && (this.depthNear = t.depthNear, this.depthFar = t.depthFar), this.texture = c; + } + } + getMesh(n) { + if (this.texture !== null && this.mesh === null) { + let t = n.cameras[0].viewport, i = new qi({ + vertexShader: Nf, + fragmentShader: Of1, + uniforms: { + depthColor: { + value: this.texture + }, + depthWidth: { + value: t.z + }, + depthHeight: { + value: t.w + } + } + }); + this.mesh = new Ct(new Zr(20, 20), i); + } + return this.mesh; } - copy(e, t) { - return super.copy(e, t), this.object = e.object, this; + reset() { + this.texture = null, this.mesh = null; } - dispose() { - this.geometry.dispose(), this.material.dispose(); + getDepthTexture() { + return this.texture; } -}, nd = class extends en { - constructor(e, t = 16776960){ - let n = new Uint16Array([ - 0, - 1, - 1, - 2, - 2, - 3, - 3, - 0, - 4, - 5, - 5, - 6, - 6, - 7, - 7, - 4, - 0, - 4, - 1, - 5, - 2, - 6, - 3, - 7 - ]), i = [ - 1, - 1, - 1, - -1, - 1, - 1, - -1, - -1, - 1, - 1, - -1, - 1, - 1, - 1, - -1, - -1, - 1, - -1, - -1, - -1, - -1, - 1, - -1, - -1 - ], r = new Ge; - r.setIndex(new et(n, 1)), r.setAttribute("position", new ve(i, 3)), super(r, new wt({ - color: t, - toneMapped: !1 - })), this.box = e, this.type = "Box3Helper", this.geometry.computeBoundingSphere(); +}, Zn1 = class extends qt { + constructor(n, t){ + super(); + let i = this, c = null, s = 1, h = null, d = "local-floor", I = 1, T1 = null, C = null, R = null, S = null, x1 = null, O = null, L = new $n1, l = t.getContextAttributes(), r = null, w1 = null, M = [], _ = [], H = new T, P = null, y1 = new vt; + y1.viewport = new ot; + let B = new vt; + B.viewport = new ot; + let p = [ + y1, + B + ], f = new Bh, A = null, q = null; + this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(k) { + let J = M[k]; + return J === void 0 && (J = new Va, M[k] = J), J.getTargetRaySpace(); + }, this.getControllerGrip = function(k) { + let J = M[k]; + return J === void 0 && (J = new Va, M[k] = J), J.getGripSpace(); + }, this.getHand = function(k) { + let J = M[k]; + return J === void 0 && (J = new Va, M[k] = J), J.getHandSpace(); + }; + function V(k) { + let J = _.indexOf(k.inputSource); + if (J === -1) return; + let ue = M[J]; + ue !== void 0 && (ue.update(k.inputSource, k.frame, T1 || h), ue.dispatchEvent({ + type: k.type, + data: k.inputSource + })); + } + function Y() { + c.removeEventListener("select", V), c.removeEventListener("selectstart", V), c.removeEventListener("selectend", V), c.removeEventListener("squeeze", V), c.removeEventListener("squeezestart", V), c.removeEventListener("squeezeend", V), c.removeEventListener("end", Y), c.removeEventListener("inputsourceschange", Q); + for(let k = 0; k < M.length; k++){ + let J = _[k]; + J !== null && (_[k] = null, M[k].disconnect(J)); + } + A = null, q = null, L.reset(), n.setRenderTarget(r), x1 = null, S = null, R = null, c = null, w1 = null, Ze.stop(), i.isPresenting = !1, n.setPixelRatio(P), n.setSize(H.width, H.height, !1), i.dispatchEvent({ + type: "sessionend" + }); + } + this.setFramebufferScaleFactor = function(k) { + s = k, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); + }, this.setReferenceSpaceType = function(k) { + d = k, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); + }, this.getReferenceSpace = function() { + return T1 || h; + }, this.setReferenceSpace = function(k) { + T1 = k; + }, this.getBaseLayer = function() { + return S !== null ? S : x1; + }, this.getBinding = function() { + return R; + }, this.getFrame = function() { + return O; + }, this.getSession = function() { + return c; + }, this.setSession = async function(k) { + if (c = k, c !== null) { + if (r = n.getRenderTarget(), c.addEventListener("select", V), c.addEventListener("selectstart", V), c.addEventListener("selectend", V), c.addEventListener("squeeze", V), c.addEventListener("squeezestart", V), c.addEventListener("squeezeend", V), c.addEventListener("end", Y), c.addEventListener("inputsourceschange", Q), l.xrCompatible !== !0 && await t.makeXRCompatible(), P = n.getPixelRatio(), n.getSize(H), typeof XRWebGLBinding < "u" && "createProjectionLayer" in XRWebGLBinding.prototype) { + let ue = null, ie = null, Ee = null; + l.depth && (Ee = l.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, ue = l.stencil ? aa : Cn, ie = l.stencil ? sc : Wo); + let Be = { + colorFormat: t.RGBA8, + depthFormat: Ee, + scaleFactor: s + }; + R = new XRWebGLBinding(c, t), S = R.createProjectionLayer(Be), c.updateRenderState({ + layers: [ + S + ] + }), n.setPixelRatio(1), n.setSize(S.textureWidth, S.textureHeight, !1), w1 = new Hi(S.textureWidth, S.textureHeight, { + format: Li, + type: Sl, + depthTexture: new hh(S.textureWidth, S.textureHeight, ie, void 0, void 0, void 0, void 0, void 0, void 0, ue), + stencilBuffer: l.stencil, + colorSpace: n.outputColorSpace, + samples: l.antialias ? 4 : 0, + resolveDepthBuffer: S.ignoreDepthValues === !1 + }); + } else { + let ue = { + antialias: l.antialias, + alpha: !0, + depth: l.depth, + stencil: l.stencil, + framebufferScaleFactor: s + }; + x1 = new XRWebGLLayer(c, t, ue), c.updateRenderState({ + baseLayer: x1 + }), n.setPixelRatio(1), n.setSize(x1.framebufferWidth, x1.framebufferHeight, !1), w1 = new Hi(x1.framebufferWidth, x1.framebufferHeight, { + format: Li, + type: Sl, + colorSpace: n.outputColorSpace, + stencilBuffer: l.stencil + }); + } + w1.isXRRenderTarget = !0, this.setFoveation(I), T1 = null, h = await c.requestReferenceSpace(d), Ze.setContext(c), Ze.start(), i.isPresenting = !0, i.dispatchEvent({ + type: "sessionstart" + }); + } + }, this.getEnvironmentBlendMode = function() { + if (c !== null) return c.environmentBlendMode; + }, this.getDepthTexture = function() { + return L.getDepthTexture(); + }; + function Q(k) { + for(let J = 0; J < k.removed.length; J++){ + let ue = k.removed[J], ie = _.indexOf(ue); + ie >= 0 && (_[ie] = null, M[ie].disconnect(ue)); + } + for(let J = 0; J < k.added.length; J++){ + let ue = k.added[J], ie = _.indexOf(ue); + if (ie === -1) { + for(let Be = 0; Be < M.length; Be++)if (Be >= _.length) { + _.push(ue), ie = Be; + break; + } else if (_[Be] === null) { + _[Be] = ue, ie = Be; + break; + } + if (ie === -1) break; + } + let Ee = M[ie]; + Ee && Ee.connect(ue); + } + } + let z = new w, j = new w; + function F(k, J, ue) { + z.setFromMatrixPosition(J.matrixWorld), j.setFromMatrixPosition(ue.matrixWorld); + let ie = z.distanceTo(j), Ee = J.projectionMatrix.elements, Be = ue.projectionMatrix.elements, Te = Ee[14] / (Ee[10] - 1), je = Ee[14] / (Ee[10] + 1), $e = (Ee[9] + 1) / Ee[5], Ue = (Ee[9] - 1) / Ee[5], m = (Ee[8] - 1) / Ee[0], ut = (Be[8] + 1) / Be[0], De = Te * m, we = Te * ut, _e = ie / (-m + ut), Xe = _e * -m; + if (J.matrixWorld.decompose(k.position, k.quaternion, k.scale), k.translateX(Xe), k.translateZ(_e), k.matrixWorld.compose(k.position, k.quaternion, k.scale), k.matrixWorldInverse.copy(k.matrixWorld).invert(), Ee[10] === -1) k.projectionMatrix.copy(J.projectionMatrix), k.projectionMatrixInverse.copy(J.projectionMatrixInverse); + else { + let he = Te + _e, u = je + _e, a = De - Xe, b = we + (ie - Xe), W = $e * je / u * he, K = Ue * je / u * he; + k.projectionMatrix.makePerspective(a, b, W, K, he, u), k.projectionMatrixInverse.copy(k.projectionMatrix).invert(); + } + } + function me(k, J) { + J === null ? k.matrixWorld.copy(k.matrix) : k.matrixWorld.multiplyMatrices(J.matrixWorld, k.matrix), k.matrixWorldInverse.copy(k.matrixWorld).invert(); + } + this.updateCamera = function(k) { + if (c === null) return; + let J = k.near, ue = k.far; + L.texture !== null && (L.depthNear > 0 && (J = L.depthNear), L.depthFar > 0 && (ue = L.depthFar)), f.near = B.near = y1.near = J, f.far = B.far = y1.far = ue, (A !== f.near || q !== f.far) && (c.updateRenderState({ + depthNear: f.near, + depthFar: f.far + }), A = f.near, q = f.far), y1.layers.mask = k.layers.mask | 2, B.layers.mask = k.layers.mask | 4, f.layers.mask = y1.layers.mask | B.layers.mask; + let ie = k.parent, Ee = f.cameras; + me(f, ie); + for(let Be = 0; Be < Ee.length; Be++)me(Ee[Be], ie); + Ee.length === 2 ? F(f, y1, B) : f.projectionMatrix.copy(y1.projectionMatrix), Me(k, f, ie); + }; + function Me(k, J, ue) { + ue === null ? k.matrix.copy(J.matrixWorld) : (k.matrix.copy(ue.matrixWorld), k.matrix.invert(), k.matrix.multiply(J.matrixWorld)), k.matrix.decompose(k.position, k.quaternion, k.scale), k.updateMatrixWorld(!0), k.projectionMatrix.copy(J.projectionMatrix), k.projectionMatrixInverse.copy(J.projectionMatrixInverse), k.isPerspectiveCamera && (k.fov = Ui * 2 * Math.atan(1 / k.projectionMatrix.elements[5]), k.zoom = 1); + } + this.getCamera = function() { + return f; + }, this.getFoveation = function() { + if (!(S === null && x1 === null)) return I; + }, this.setFoveation = function(k) { + I = k, S !== null && (S.fixedFoveation = k), x1 !== null && x1.fixedFoveation !== void 0 && (x1.fixedFoveation = k); + }, this.hasDepthSensing = function() { + return L.texture !== null; + }, this.getDepthSensingMesh = function() { + return L.getMesh(f); + }; + let Le = null; + function Ge(k, J) { + if (C = J.getViewerPose(T1 || h), O = J, C !== null) { + let ue = C.views; + x1 !== null && (n.setRenderTargetFramebuffer(w1, x1.framebuffer), n.setRenderTarget(w1)); + let ie = !1; + ue.length !== f.cameras.length && (f.cameras.length = 0, ie = !0); + for(let Te = 0; Te < ue.length; Te++){ + let je = ue[Te], $e = null; + if (x1 !== null) $e = x1.getViewport(je); + else { + let m = R.getViewSubImage(S, je); + $e = m.viewport, Te === 0 && (n.setRenderTargetTextures(w1, m.colorTexture, S.ignoreDepthValues ? void 0 : m.depthStencilTexture), n.setRenderTarget(w1)); + } + let Ue = p[Te]; + Ue === void 0 && (Ue = new vt, Ue.layers.enable(Te), Ue.viewport = new ot, p[Te] = Ue), Ue.matrix.fromArray(je.transform.matrix), Ue.matrix.decompose(Ue.position, Ue.quaternion, Ue.scale), Ue.projectionMatrix.fromArray(je.projectionMatrix), Ue.projectionMatrixInverse.copy(Ue.projectionMatrix).invert(), Ue.viewport.set($e.x, $e.y, $e.width, $e.height), Te === 0 && (f.matrix.copy(Ue.matrix), f.matrix.decompose(f.position, f.quaternion, f.scale)), ie === !0 && f.cameras.push(Ue); + } + let Ee = c.enabledFeatures; + if (Ee && Ee.includes("depth-sensing") && c.depthUsage == "gpu-optimized" && R) { + let Te = R.getDepthInformation(ue[0]); + Te && Te.isValid && Te.texture && L.init(n, Te, c.renderState); + } + } + for(let ue = 0; ue < M.length; ue++){ + let ie = _[ue], Ee = M[ue]; + ie !== null && Ee !== void 0 && Ee.update(ie, J, T1 || h); + } + Le && Le(k, J), J.detectedPlanes && i.dispatchEvent({ + type: "planesdetected", + data: J + }), O = null; + } + let Ze = new br1; + Ze.setAnimationLoop(Ge), this.setAnimationLoop = function(k) { + Le = k; + }, this.dispose = function() {}; } - updateMatrixWorld(e) { - let t = this.box; - t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(.5), super.updateMatrixWorld(e)); +}, Pt = new Xt, Ff1 = new D; +function Bf1(e, n) { + function t(l, r) { + l.matrixAutoUpdate === !0 && l.updateMatrix(), r.value.copy(l.matrix); } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function i(l, r) { + r.color.getRGB(l.fogColor.value, Rf(e)), r.isFog ? (l.fogNear.value = r.near, l.fogFar.value = r.far) : r.isFogExp2 && (l.fogDensity.value = r.density); } -}, id = class extends bn { - constructor(e, t = 1, n = 16776960){ - let i = n, r = [ - 1, - -1, - 0, - -1, - 1, - 0, - -1, - -1, - 0, - 1, - 1, - 0, - -1, - 1, - 0, - -1, - -1, - 0, - 1, - -1, - 0, - 1, - 1, - 0 - ], a = new Ge; - a.setAttribute("position", new ve(r, 3)), a.computeBoundingSphere(), super(a, new wt({ - color: i, - toneMapped: !1 - })), this.type = "PlaneHelper", this.plane = e, this.size = t; - let o = [ - 1, - 1, - 0, - -1, - 1, - 0, - -1, - -1, - 0, - 1, - 1, - 0, - -1, - -1, - 0, - 1, - -1, - 0 - ], c = new Ge; - c.setAttribute("position", new ve(o, 3)), c.computeBoundingSphere(), this.add(new Mt(c, new Sn({ - color: i, - opacity: .2, - transparent: !0, - depthWrite: !1, - toneMapped: !1 - }))); + function c(l, r, w, M, _) { + r.isMeshBasicMaterial || r.isMeshLambertMaterial ? s(l, r) : r.isMeshToonMaterial ? (s(l, r), R(l, r)) : r.isMeshPhongMaterial ? (s(l, r), C(l, r)) : r.isMeshStandardMaterial ? (s(l, r), S(l, r), r.isMeshPhysicalMaterial && x1(l, r, _)) : r.isMeshMatcapMaterial ? (s(l, r), O(l, r)) : r.isMeshDepthMaterial ? s(l, r) : r.isMeshDistanceMaterial ? (s(l, r), L(l, r)) : r.isMeshNormalMaterial ? s(l, r) : r.isLineBasicMaterial ? (h(l, r), r.isLineDashedMaterial && d(l, r)) : r.isPointsMaterial ? I(l, r, w, M) : r.isSpriteMaterial ? T(l, r) : r.isShadowMaterial ? (l.color.value.copy(r.color), l.opacity.value = r.opacity) : r.isShaderMaterial && (r.uniformsNeedUpdate = !1); } - updateMatrixWorld(e) { - this.position.set(0, 0, 0), this.scale.set(.5 * this.size, .5 * this.size, 1), this.lookAt(this.plane.normal), this.translateZ(-this.plane.constant), super.updateMatrixWorld(e); + function s(l, r) { + l.opacity.value = r.opacity, r.color && l.diffuse.value.copy(r.color), r.emissive && l.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity), r.map && (l.map.value = r.map, t(r.map, l.mapTransform)), r.alphaMap && (l.alphaMap.value = r.alphaMap, t(r.alphaMap, l.alphaMapTransform)), r.bumpMap && (l.bumpMap.value = r.bumpMap, t(r.bumpMap, l.bumpMapTransform), l.bumpScale.value = r.bumpScale, r.side === Al && (l.bumpScale.value *= -1)), r.normalMap && (l.normalMap.value = r.normalMap, t(r.normalMap, l.normalMapTransform), l.normalScale.value.copy(r.normalScale), r.side === Al && l.normalScale.value.negate()), r.displacementMap && (l.displacementMap.value = r.displacementMap, t(r.displacementMap, l.displacementMapTransform), l.displacementScale.value = r.displacementScale, l.displacementBias.value = r.displacementBias), r.emissiveMap && (l.emissiveMap.value = r.emissiveMap, t(r.emissiveMap, l.emissiveMapTransform)), r.specularMap && (l.specularMap.value = r.specularMap, t(r.specularMap, l.specularMapTransform)), r.alphaTest > 0 && (l.alphaTest.value = r.alphaTest); + let w = n.get(r), M = w.envMap, _ = w.envMapRotation; + M && (l.envMap.value = M, Pt.copy(_), Pt.x *= -1, Pt.y *= -1, Pt.z *= -1, M.isCubeTexture && M.isRenderTargetTexture === !1 && (Pt.y *= -1, Pt.z *= -1), l.envMapRotation.value.setFromMatrix4(Ff1.makeRotationFromEuler(Pt)), l.flipEnvMap.value = M.isCubeTexture && M.isRenderTargetTexture === !1 ? -1 : 1, l.reflectivity.value = r.reflectivity, l.ior.value = r.ior, l.refractionRatio.value = r.refractionRatio), r.lightMap && (l.lightMap.value = r.lightMap, l.lightMapIntensity.value = r.lightMapIntensity, t(r.lightMap, l.lightMapTransform)), r.aoMap && (l.aoMap.value = r.aoMap, l.aoMapIntensity.value = r.aoMapIntensity, t(r.aoMap, l.aoMapTransform)); } - dispose() { - this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose(); + function h(l, r) { + l.diffuse.value.copy(r.color), l.opacity.value = r.opacity, r.map && (l.map.value = r.map, t(r.map, l.mapTransform)); } -}, sd = new A, Pr, ho, rd = class extends Je { - constructor(e = new A(0, 0, 1), t = new A(0, 0, 0), n = 1, i = 16776960, r = n * .2, a = r * .2){ - super(), this.type = "ArrowHelper", Pr === void 0 && (Pr = new Ge, Pr.setAttribute("position", new ve([ - 0, - 0, - 0, - 0, - 1, - 0 - ], 3)), ho = new Ns(0, .5, 1, 5, 1), ho.translate(0, -.5, 0)), this.position.copy(t), this.line = new bn(Pr, new wt({ - color: i, - toneMapped: !1 - })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new Mt(ho, new Sn({ - color: i, - toneMapped: !1 - })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(n, r, a); + function d(l, r) { + l.dashSize.value = r.dashSize, l.totalSize.value = r.dashSize + r.gapSize, l.scale.value = r.scale; } - setDirection(e) { - if (e.y > .99999) this.quaternion.set(0, 0, 0, 1); - else if (e.y < -.99999) this.quaternion.set(1, 0, 0, 0); - else { - sd.set(e.z, 0, -e.x).normalize(); - let t = Math.acos(e.y); - this.quaternion.setFromAxisAngle(sd, t); - } + function I(l, r, w, M) { + l.diffuse.value.copy(r.color), l.opacity.value = r.opacity, l.size.value = r.size * w, l.scale.value = M * .5, r.map && (l.map.value = r.map, t(r.map, l.uvTransform)), r.alphaMap && (l.alphaMap.value = r.alphaMap, t(r.alphaMap, l.alphaMapTransform)), r.alphaTest > 0 && (l.alphaTest.value = r.alphaTest); } - setLength(e, t = e * .2, n = t * .2) { - this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(n, t, n), this.cone.position.y = e, this.cone.updateMatrix(); + function T(l, r) { + l.diffuse.value.copy(r.color), l.opacity.value = r.opacity, l.rotation.value = r.rotation, r.map && (l.map.value = r.map, t(r.map, l.mapTransform)), r.alphaMap && (l.alphaMap.value = r.alphaMap, t(r.alphaMap, l.alphaMapTransform)), r.alphaTest > 0 && (l.alphaTest.value = r.alphaTest); } - setColor(e) { - this.line.material.color.set(e), this.cone.material.color.set(e); + function C(l, r) { + l.specular.value.copy(r.specular), l.shininess.value = Math.max(r.shininess, 1e-4); } - copy(e) { - return super.copy(e, !1), this.line.copy(e.line), this.cone.copy(e.cone), this; + function R(l, r) { + r.gradientMap && (l.gradientMap.value = r.gradientMap); } - dispose() { - this.line.geometry.dispose(), this.line.material.dispose(), this.cone.geometry.dispose(), this.cone.material.dispose(); + function S(l, r) { + l.metalness.value = r.metalness, r.metalnessMap && (l.metalnessMap.value = r.metalnessMap, t(r.metalnessMap, l.metalnessMapTransform)), l.roughness.value = r.roughness, r.roughnessMap && (l.roughnessMap.value = r.roughnessMap, t(r.roughnessMap, l.roughnessMapTransform)), r.envMap && (l.envMapIntensity.value = r.envMapIntensity); } -}, ad = class extends en { - constructor(e = 1){ - let t = [ - 0, - 0, - 0, - e, - 0, - 0, - 0, - 0, - 0, - 0, - e, - 0, - 0, - 0, - 0, - 0, - 0, - e - ], n = [ - 1, - 0, - 0, - 1, - .6, - 0, - 0, - 1, - 0, - .6, - 1, - 0, - 0, - 0, - 1, - 0, - .6, - 1 - ], i = new Ge; - i.setAttribute("position", new ve(t, 3)), i.setAttribute("color", new ve(n, 3)); - let r = new wt({ - vertexColors: !0, - toneMapped: !1 - }); - super(i, r), this.type = "AxesHelper"; + function x1(l, r, w) { + l.ior.value = r.ior, r.sheen > 0 && (l.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen), l.sheenRoughness.value = r.sheenRoughness, r.sheenColorMap && (l.sheenColorMap.value = r.sheenColorMap, t(r.sheenColorMap, l.sheenColorMapTransform)), r.sheenRoughnessMap && (l.sheenRoughnessMap.value = r.sheenRoughnessMap, t(r.sheenRoughnessMap, l.sheenRoughnessMapTransform))), r.clearcoat > 0 && (l.clearcoat.value = r.clearcoat, l.clearcoatRoughness.value = r.clearcoatRoughness, r.clearcoatMap && (l.clearcoatMap.value = r.clearcoatMap, t(r.clearcoatMap, l.clearcoatMapTransform)), r.clearcoatRoughnessMap && (l.clearcoatRoughnessMap.value = r.clearcoatRoughnessMap, t(r.clearcoatRoughnessMap, l.clearcoatRoughnessMapTransform)), r.clearcoatNormalMap && (l.clearcoatNormalMap.value = r.clearcoatNormalMap, t(r.clearcoatNormalMap, l.clearcoatNormalMapTransform), l.clearcoatNormalScale.value.copy(r.clearcoatNormalScale), r.side === Al && l.clearcoatNormalScale.value.negate())), r.dispersion > 0 && (l.dispersion.value = r.dispersion), r.iridescence > 0 && (l.iridescence.value = r.iridescence, l.iridescenceIOR.value = r.iridescenceIOR, l.iridescenceThicknessMinimum.value = r.iridescenceThicknessRange[0], l.iridescenceThicknessMaximum.value = r.iridescenceThicknessRange[1], r.iridescenceMap && (l.iridescenceMap.value = r.iridescenceMap, t(r.iridescenceMap, l.iridescenceMapTransform)), r.iridescenceThicknessMap && (l.iridescenceThicknessMap.value = r.iridescenceThicknessMap, t(r.iridescenceThicknessMap, l.iridescenceThicknessMapTransform))), r.transmission > 0 && (l.transmission.value = r.transmission, l.transmissionSamplerMap.value = w.texture, l.transmissionSamplerSize.value.set(w.width, w.height), r.transmissionMap && (l.transmissionMap.value = r.transmissionMap, t(r.transmissionMap, l.transmissionMapTransform)), l.thickness.value = r.thickness, r.thicknessMap && (l.thicknessMap.value = r.thicknessMap, t(r.thicknessMap, l.thicknessMapTransform)), l.attenuationDistance.value = r.attenuationDistance, l.attenuationColor.value.copy(r.attenuationColor)), r.anisotropy > 0 && (l.anisotropyVector.value.set(r.anisotropy * Math.cos(r.anisotropyRotation), r.anisotropy * Math.sin(r.anisotropyRotation)), r.anisotropyMap && (l.anisotropyMap.value = r.anisotropyMap, t(r.anisotropyMap, l.anisotropyMapTransform))), l.specularIntensity.value = r.specularIntensity, l.specularColor.value.copy(r.specularColor), r.specularColorMap && (l.specularColorMap.value = r.specularColorMap, t(r.specularColorMap, l.specularColorMapTransform)), r.specularIntensityMap && (l.specularIntensityMap.value = r.specularIntensityMap, t(r.specularIntensityMap, l.specularIntensityMapTransform)); } - setColors(e, t, n) { - let i = new pe, r = this.geometry.attributes.color.array; - return i.set(e), i.toArray(r, 0), i.toArray(r, 3), i.set(t), i.toArray(r, 6), i.toArray(r, 9), i.set(n), i.toArray(r, 12), i.toArray(r, 15), this.geometry.attributes.color.needsUpdate = !0, this; + function O(l, r) { + r.matcap && (l.matcap.value = r.matcap); } - dispose() { - this.geometry.dispose(), this.material.dispose(); + function L(l, r) { + let w = n.get(r).light; + l.referencePosition.value.setFromMatrixPosition(w.matrixWorld), l.nearDistance.value = w.shadow.camera.near, l.farDistance.value = w.shadow.camera.far; } -}, od = class { - constructor(){ - this.type = "ShapePath", this.color = new pe, this.subPaths = [], this.currentPath = null; + return { + refreshFogUniforms: i, + refreshMaterialUniforms: c + }; +} +function Gf(e, n, t, i) { + let c = {}, s = {}, h = [], d = e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS); + function I(w, M) { + let _ = M.program; + i.uniformBlockBinding(w, _); + } + function T(w, M) { + let _ = c[w.id]; + _ === void 0 && (O(w), _ = C(w), c[w.id] = _, w.addEventListener("dispose", l)); + let H = M.program; + i.updateUBOMapping(w, H); + let P = n.render.frame; + s[w.id] !== P && (S(w), s[w.id] = P); + } + function C(w) { + let M = R(); + w.__bindingPointIndex = M; + let _ = e.createBuffer(), H = w.__size, P = w.usage; + return e.bindBuffer(e.UNIFORM_BUFFER, _), e.bufferData(e.UNIFORM_BUFFER, H, P), e.bindBuffer(e.UNIFORM_BUFFER, null), e.bindBufferBase(e.UNIFORM_BUFFER, M, _), _; + } + function R() { + for(let w = 0; w < d; w++)if (h.indexOf(w) === -1) return h.push(w), w; + return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."), 0; + } + function S(w) { + let M = c[w.id], _ = w.uniforms, H = w.__cache; + e.bindBuffer(e.UNIFORM_BUFFER, M); + for(let P = 0, y1 = _.length; P < y1; P++){ + let B = Array.isArray(_[P]) ? _[P] : [ + _[P] + ]; + for(let p = 0, f = B.length; p < f; p++){ + let A = B[p]; + if (x1(A, P, p, H) === !0) { + let q = A.__offset, V = Array.isArray(A.value) ? A.value : [ + A.value + ], Y = 0; + for(let Q = 0; Q < V.length; Q++){ + let z = V[Q], j = L(z); + typeof z == "number" || typeof z == "boolean" ? (A.__data[0] = z, e.bufferSubData(e.UNIFORM_BUFFER, q + Y, A.__data)) : z.isMatrix3 ? (A.__data[0] = z.elements[0], A.__data[1] = z.elements[1], A.__data[2] = z.elements[2], A.__data[3] = 0, A.__data[4] = z.elements[3], A.__data[5] = z.elements[4], A.__data[6] = z.elements[5], A.__data[7] = 0, A.__data[8] = z.elements[6], A.__data[9] = z.elements[7], A.__data[10] = z.elements[8], A.__data[11] = 0) : (z.toArray(A.__data, Y), Y += j.storage / Float32Array.BYTES_PER_ELEMENT); + } + e.bufferSubData(e.UNIFORM_BUFFER, q, A.__data); + } + } + } + e.bindBuffer(e.UNIFORM_BUFFER, null); } - moveTo(e, t) { - return this.currentPath = new ji, this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this; + function x1(w, M, _, H) { + let P = w.value, y1 = M + "_" + _; + if (H[y1] === void 0) return typeof P == "number" || typeof P == "boolean" ? H[y1] = P : H[y1] = P.clone(), !0; + { + let B = H[y1]; + if (typeof P == "number" || typeof P == "boolean") { + if (B !== P) return H[y1] = P, !0; + } else if (B.equals(P) === !1) return B.copy(P), !0; + } + return !1; } - lineTo(e, t) { - return this.currentPath.lineTo(e, t), this; + function O(w) { + let M = w.uniforms, _ = 0, H = 16; + for(let y1 = 0, B = M.length; y1 < B; y1++){ + let p = Array.isArray(M[y1]) ? M[y1] : [ + M[y1] + ]; + for(let f = 0, A = p.length; f < A; f++){ + let q = p[f], V = Array.isArray(q.value) ? q.value : [ + q.value + ]; + for(let Y = 0, Q = V.length; Y < Q; Y++){ + let z = V[Y], j = L(z), F = _ % H, me = F % j.boundary, Me = F + me; + _ += me, Me !== 0 && H - Me < j.storage && (_ += H - Me), q.__data = new Float32Array(j.storage / Float32Array.BYTES_PER_ELEMENT), q.__offset = _, _ += j.storage; + } + } + } + let P = _ % H; + return P > 0 && (_ += H - P), w.__size = _, w.__cache = {}, this; } - quadraticCurveTo(e, t, n, i) { - return this.currentPath.quadraticCurveTo(e, t, n, i), this; + function L(w) { + let M = { + boundary: 0, + storage: 0 + }; + return typeof w == "number" || typeof w == "boolean" ? (M.boundary = 4, M.storage = 4) : w.isVector2 ? (M.boundary = 8, M.storage = 8) : w.isVector3 || w.isColor ? (M.boundary = 16, M.storage = 12) : w.isVector4 ? (M.boundary = 16, M.storage = 16) : w.isMatrix3 ? (M.boundary = 48, M.storage = 48) : w.isMatrix4 ? (M.boundary = 64, M.storage = 64) : w.isTexture ? console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.") : console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", w), M; } - bezierCurveTo(e, t, n, i, r, a) { - return this.currentPath.bezierCurveTo(e, t, n, i, r, a), this; + function l(w) { + let M = w.target; + M.removeEventListener("dispose", l); + let _ = h.indexOf(M.__bindingPointIndex); + h.splice(_, 1), e.deleteBuffer(c[M.id]), delete c[M.id], delete s[M.id]; } - splineThru(e) { - return this.currentPath.splineThru(e), this; + function r() { + for(let w in c)e.deleteBuffer(c[w]); + h = [], c = {}, s = {}; } - toShapes(e) { - function t(p) { - let v = []; - for(let x1 = 0, y1 = p.length; x1 < y1; x1++){ - let b = p[x1], w = new Fn; - w.curves = b.curves, v.push(w); + return { + bind: I, + update: T, + dispose: r + }; +} +var cr1 = class { + constructor(n = {}){ + let { canvas: t = If() , context: i = null , depth: c = !0 , stencil: s = !1 , alpha: h = !1 , antialias: d = !1 , premultipliedAlpha: I = !0 , preserveDrawingBuffer: T = !1 , powerPreference: C = "default" , failIfMajorPerformanceCaveat: R = !1 , reverseDepthBuffer: S = !1 } = n; + this.isWebGLRenderer = !0; + let x1; + if (i !== null) { + if (typeof WebGLRenderingContext < "u" && i instanceof WebGLRenderingContext) throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163."); + x1 = i.getContextAttributes().alpha; + } else x1 = h; + let O = new Uint32Array(4), L = new Int32Array(4), l = null, r = null, w1 = [], M = []; + this.domElement = t, this.debug = { + checkShaderErrors: !0, + onShaderError: null + }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this._outputColorSpace = Bt, this.toneMapping = Tp, this.toneMappingExposure = 1; + let _ = this, H = !1, P1 = 0, y1 = 0, B = null, p = -1, f = null, A = new ot, q = new ot, V = null, Y = new P(0), Q = 0, z = t.width, j = t.height, F = 1, me = null, Me = null, Le = new ot(0, 0, z, j), Ge = new ot(0, 0, z, j), Ze = !1, k = new sn, J = !1, ue = !1; + this.transmissionResolutionScale = 1; + let ie = new D, Ee = new D, Be = new w, Te = new ot, je = { + background: null, + fog: null, + environment: null, + overrideMaterial: null, + isScene: !0 + }, $e = !1; + function Ue() { + return B === null ? F : 1; + } + let m = i; + function ut(o, g) { + return t.getContext(o, g); + } + try { + let o = { + alpha: !0, + depth: c, + stencil: s, + antialias: d, + premultipliedAlpha: I, + preserveDrawingBuffer: T, + powerPreference: C, + failIfMajorPerformanceCaveat: R + }; + if ("setAttribute" in t && t.setAttribute("data-engine", `three.js r${vl}`), t.addEventListener("webglcontextlost", X, !1), t.addEventListener("webglcontextrestored", oe, !1), t.addEventListener("webglcontextcreationerror", ae, !1), m === null) { + let g = "webgl2"; + if (m = ut(g, o), m === null) throw ut(g) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); } - return v; + } catch (o) { + throw console.error("THREE.WebGLRenderer: " + o.message), o; } - function n(p, v) { - let x1 = v.length, y1 = !1; - for(let b = x1 - 1, w = 0; w < x1; b = w++){ - let R = v[b], I = v[w], M = I.x - R.x, T = I.y - R.y; - if (Math.abs(T) > Number.EPSILON) { - if (T < 0 && (R = v[w], M = -M, I = v[b], T = -T), p.y < R.y || p.y > I.y) continue; - if (p.y === R.y) { - if (p.x === R.x) return !0; - } else { - let O = T * (p.x - R.x) - M * (p.y - R.y); - if (O === 0) return !0; - if (O < 0) continue; - y1 = !y1; + let De, we, _e, Xe, he, u, a, b, W, K, G, pe, re, ce, ye, Z, le, Se, xe, fe, Ie, be, ze, v; + function te() { + De = new nl1(m), De.init(), be = new yf1(m, De), we = new Zc1(m, De, n, be), _e = new wf1(m, De), we.reverseDepthBuffer && S && _e.buffers.depth.setReversed(!0), Xe = new al1(m), he = new Sf1, u = new If1(m, De, _e, he, we, be, Xe), a = new Jc1(_), b = new tl1(_), W = new uo1(m), ze = new Kc1(m, W), K = new il1(m, W, Xe, ze), G = new sl1(m, K, W, Xe), xe = new ol1(m, we, u), Z = new Qc1(he), pe = new gf1(_, a, b, De, we, ze, Z), re = new Bf1(_, he), ce = new Mf1, ye = new bf1(De), Se = new qc1(_, a, b, _e, G, x1, I), le = new Uf(_, G, we), v = new Gf(m, Xe, we, _e), fe = new $c1(m, De, Xe), Ie = new rl1(m, De, Xe), Xe.programs = pe.programs, _.capabilities = we, _.extensions = De, _.properties = he, _.renderLists = ce, _.shadowMap = le, _.state = _e, _.info = Xe; + } + te(); + let N = new Zn1(_, m); + this.xr = N, this.getContext = function() { + return m; + }, this.getContextAttributes = function() { + return m.getContextAttributes(); + }, this.forceContextLoss = function() { + let o = De.get("WEBGL_lose_context"); + o && o.loseContext(); + }, this.forceContextRestore = function() { + let o = De.get("WEBGL_lose_context"); + o && o.restoreContext(); + }, this.getPixelRatio = function() { + return F; + }, this.setPixelRatio = function(o) { + o !== void 0 && (F = o, this.setSize(z, j, !1)); + }, this.getSize = function(o) { + return o.set(z, j); + }, this.setSize = function(o, g, U = !0) { + if (N.isPresenting) { + console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); + return; + } + z = o, j = g, t.width = Math.floor(o * F), t.height = Math.floor(g * F), U === !0 && (t.style.width = o + "px", t.style.height = g + "px"), this.setViewport(0, 0, o, g); + }, this.getDrawingBufferSize = function(o) { + return o.set(z * F, j * F).floor(); + }, this.setDrawingBufferSize = function(o, g, U) { + z = o, j = g, F = U, t.width = Math.floor(o * U), t.height = Math.floor(g * U), this.setViewport(0, 0, o, g); + }, this.getCurrentViewport = function(o) { + return o.copy(A); + }, this.getViewport = function(o) { + return o.copy(Le); + }, this.setViewport = function(o, g, U, D) { + o.isVector4 ? Le.set(o.x, o.y, o.z, o.w) : Le.set(o, g, U, D), _e.viewport(A.copy(Le).multiplyScalar(F).round()); + }, this.getScissor = function(o) { + return o.copy(Ge); + }, this.setScissor = function(o, g, U, D) { + o.isVector4 ? Ge.set(o.x, o.y, o.z, o.w) : Ge.set(o, g, U, D), _e.scissor(q.copy(Ge).multiplyScalar(F).round()); + }, this.getScissorTest = function() { + return Ze; + }, this.setScissorTest = function(o) { + _e.setScissorTest(Ze = o); + }, this.setOpaqueSort = function(o) { + me = o; + }, this.setTransparentSort = function(o) { + Me = o; + }, this.getClearColor = function(o) { + return o.copy(Se.getClearColor()); + }, this.setClearColor = function() { + Se.setClearColor.apply(Se, arguments); + }, this.getClearAlpha = function() { + return Se.getClearAlpha(); + }, this.setClearAlpha = function() { + Se.setClearAlpha.apply(Se, arguments); + }, this.clear = function(o = !0, g = !0, U = !0) { + let D = 0; + if (o) { + let E = !1; + if (B !== null) { + let $ = B.texture.format; + E = $ === uc || $ === cc || $ === Il; + } + if (E) { + let $ = B.texture.type, ne = $ === Sl || $ === Wo || $ === jl || $ === sc || $ === ec || $ === ic, se = Se.getClearColor(), de = Se.getClearAlpha(), Ae = se.r, Re = se.g, ve = se.b; + ne ? (O[0] = Ae, O[1] = Re, O[2] = ve, O[3] = de, m.clearBufferuiv(m.COLOR, 0, O)) : (L[0] = Ae, L[1] = Re, L[2] = ve, L[3] = de, m.clearBufferiv(m.COLOR, 0, L)); + } else D |= m.COLOR_BUFFER_BIT; + } + g && (D |= m.DEPTH_BUFFER_BIT), U && (D |= m.STENCIL_BUFFER_BIT, this.state.buffers.stencil.setMask(4294967295)), m.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", X, !1), t.removeEventListener("webglcontextrestored", oe, !1), t.removeEventListener("webglcontextcreationerror", ae, !1), Se.dispose(), ce.dispose(), ye.dispose(), he.dispose(), a.dispose(), b.dispose(), G.dispose(), ze.dispose(), v.dispose(), pe.dispose(), N.dispose(), N.removeEventListener("sessionstart", jn), N.removeEventListener("sessionend", ei), Rt.stop(); + }; + function X(o) { + o.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), H = !0; + } + function oe() { + console.log("THREE.WebGLRenderer: Context Restored."), H = !1; + let o = Xe.autoReset, g = le.enabled, U = le.autoUpdate, D = le.needsUpdate, E = le.type; + te(), Xe.autoReset = o, le.enabled = g, le.autoUpdate = U, le.needsUpdate = D, le.type = E; + } + function ae(o) { + console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", o.statusMessage); + } + function Ce(o) { + let g = o.target; + g.removeEventListener("dispose", Ce), Qe(g); + } + function Qe(o) { + at(o), he.remove(o); + } + function at(o) { + let g = he.get(o).programs; + g !== void 0 && (g.forEach(function(U) { + pe.releaseProgram(U); + }), o.isShaderMaterial && pe.releaseShaderCache(o)); + } + this.renderBufferDirect = function(o, g, U, D, E, $) { + g === null && (g = je); + let ne = E.isMesh && E.matrixWorld.determinant() < 0, se = wr(o, g, U, D, E); + _e.setMaterial(D, ne); + let de = U.index, Ae = 1; + if (D.wireframe === !0) { + if (de = K.getWireframeAttribute(U), de === void 0) return; + Ae = 2; + } + let Re = U.drawRange, ve = U.attributes.position, Ne = Re.start * Ae, He = (Re.start + Re.count) * Ae; + $ !== null && (Ne = Math.max(Ne, $.start * Ae), He = Math.min(He, ($.start + $.count) * Ae)), de !== null ? (Ne = Math.max(Ne, 0), He = Math.min(He, de.count)) : ve != null && (Ne = Math.max(Ne, 0), He = Math.min(He, ve.count)); + let et = He - Ne; + if (et < 0 || et === 1 / 0) return; + ze.setup(E, D, se, U, de); + let Je, Oe = fe; + if (de !== null && (Je = W.get(de), Oe = Ie, Oe.setIndex(Je)), E.isMesh) D.wireframe === !0 ? (_e.setLineWidth(D.wireframeLinewidth * Ue()), Oe.setMode(m.LINES)) : Oe.setMode(m.TRIANGLES); + else if (E.isLine) { + let ge = D.linewidth; + ge === void 0 && (ge = 1), _e.setLineWidth(ge * Ue()), E.isLineSegments ? Oe.setMode(m.LINES) : E.isLineLoop ? Oe.setMode(m.LINE_LOOP) : Oe.setMode(m.LINE_STRIP); + } else E.isPoints ? Oe.setMode(m.POINTS) : E.isSprite && Oe.setMode(m.TRIANGLES); + if (E.isBatchedMesh) if (E._multiDrawInstances !== null) Oe.renderMultiDrawInstances(E._multiDrawStarts, E._multiDrawCounts, E._multiDrawCount, E._multiDrawInstances); + else if (De.get("WEBGL_multi_draw")) Oe.renderMultiDraw(E._multiDrawStarts, E._multiDrawCounts, E._multiDrawCount); + else { + let ge = E._multiDrawStarts, rt = E._multiDrawCounts, Ve = E._multiDrawCount, vt = de ? W.get(de).bytesPerElement : 1, Nt = he.get(D).currentProgram.getUniforms(); + for(let dt = 0; dt < Ve; dt++)Nt.setValue(m, "_gl_DrawID", dt), Oe.render(ge[dt] / vt, rt[dt]); + } + else if (E.isInstancedMesh) Oe.renderInstances(Ne, et, E.count); + else if (U.isInstancedBufferGeometry) { + let ge = U._maxInstanceCount !== void 0 ? U._maxInstanceCount : 1 / 0, rt = Math.min(U.instanceCount, ge); + Oe.renderInstances(Ne, et, rt); + } else Oe.render(Ne, et); + }; + function ke(o, g, U) { + o.transparent === !0 && o.side === Yd && o.forceSinglePass === !1 ? (o.side = Al, o.needsUpdate = !0, nn(o, g, U), o.side = dr, o.needsUpdate = !0, nn(o, g, U), o.side = Yd) : nn(o, g, U); + } + this.compile = function(o, g, U = null) { + U === null && (U = o), r = ye.get(U), r.init(g), M.push(r), U.traverseVisible(function(E) { + E.isLight && E.layers.test(g.layers) && (r.pushLight(E), E.castShadow && r.pushShadow(E)); + }), o !== U && o.traverseVisible(function(E) { + E.isLight && E.layers.test(g.layers) && (r.pushLight(E), E.castShadow && r.pushShadow(E)); + }), r.setupLights(); + let D = new Set; + return o.traverse(function(E) { + if (!(E.isMesh || E.isPoints || E.isLine || E.isSprite)) return; + let $ = E.material; + if ($) if (Array.isArray($)) for(let ne = 0; ne < $.length; ne++){ + let se = $[ne]; + ke(se, U, E), D.add(se); + } + else ke($, U, E), D.add($); + }), M.pop(), r = null, D; + }, this.compileAsync = function(o, g, U = null) { + let D = this.compile(o, g, U); + return new Promise((E)=>{ + function $() { + if (D.forEach(function(ne) { + he.get(ne).currentProgram.isReady() && D.delete(ne); + }), D.size === 0) { + E(o); + return; } - } else { - if (p.y !== R.y) continue; - if (I.x <= p.x && p.x <= R.x || R.x <= p.x && p.x <= I.x) return !0; + setTimeout($, 10); } + De.get("KHR_parallel_shader_compile") !== null ? $() : setTimeout($, 10); + }); + }; + let _t = null; + function St(o) { + _t && _t(o); + } + function jn() { + Rt.stop(); + } + function ei() { + Rt.start(); + } + let Rt = new br1; + Rt.setAnimationLoop(St), typeof self < "u" && Rt.setContext(self), this.setAnimationLoop = function(o) { + _t = o, N.setAnimationLoop(o), o === null ? Rt.stop() : Rt.start(); + }, N.addEventListener("sessionstart", jn), N.addEventListener("sessionend", ei), this.render = function(o, g) { + if (g !== void 0 && g.isCamera !== !0) { + console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); + return; } - return y1; + if (H === !0) return; + if (o.matrixWorldAutoUpdate === !0 && o.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), N.enabled === !0 && N.isPresenting === !0 && (N.cameraAutoUpdate === !0 && N.updateCamera(g), g = N.getCamera()), o.isScene === !0 && o.onBeforeRender(_, o, g, B), r = ye.get(o, M.length), r.init(g), M.push(r), Ee.multiplyMatrices(g.projectionMatrix, g.matrixWorldInverse), k.setFromProjectionMatrix(Ee), ue = this.localClippingEnabled, J = Z.init(this.clippingPlanes, ue), l = ce.get(o, w1.length), l.init(), w1.push(l), N.enabled === !0 && N.isPresenting === !0) { + let $ = _.xr.getDepthSensingMesh(); + $ !== null && Sn($, g, -1 / 0, _.sortObjects); + } + Sn(o, g, 0, _.sortObjects), l.finish(), _.sortObjects === !0 && l.sort(me, Me), $e = N.enabled === !1 || N.isPresenting === !1 || N.hasDepthSensing() === !1, $e && Se.addToRenderList(l, o), this.info.render.frame++, J === !0 && Z.beginShadows(); + let U = r.state.shadowsArray; + le.render(U, o, g), J === !0 && Z.endShadows(), this.info.autoReset === !0 && this.info.reset(); + let D = l.opaque, E = l.transmissive; + if (r.setupLights(), g.isArrayCamera) { + let $ = g.cameras; + if (E.length > 0) for(let ne = 0, se = $.length; ne < se; ne++){ + let de = $[ne]; + ni(D, E, o, de); + } + $e && Se.render(o); + for(let ne = 0, se = $.length; ne < se; ne++){ + let de = $[ne]; + ti(l, o, de, de.viewport); + } + } else E.length > 0 && ni(D, E, o, g), $e && Se.render(o), ti(l, o, g); + B !== null && y1 === 0 && (u.updateMultisampleRenderTarget(B), u.updateRenderTargetMipmap(B)), o.isScene === !0 && o.onAfterRender(_, o, g), ze.resetDefaultState(), p = -1, f = null, M.pop(), M.length > 0 ? (r = M[M.length - 1], J === !0 && Z.setGlobalState(_.clippingPlanes, r.state.camera)) : r = null, w1.pop(), w1.length > 0 ? l = w1[w1.length - 1] : l = null; + }; + function Sn(o, g, U, D) { + if (o.visible === !1) return; + if (o.layers.test(g.layers)) { + if (o.isGroup) U = o.renderOrder; + else if (o.isLOD) o.autoUpdate === !0 && o.update(g); + else if (o.isLight) r.pushLight(o), o.castShadow && r.pushShadow(o); + else if (o.isSprite) { + if (!o.frustumCulled || k.intersectsSprite(o)) { + D && Te.setFromMatrixPosition(o.matrixWorld).applyMatrix4(Ee); + let ne = G.update(o), se = o.material; + se.visible && l.push(o, ne, se, U, Te.z, null); + } + } else if ((o.isMesh || o.isLine || o.isPoints) && (!o.frustumCulled || k.intersectsObject(o))) { + let ne = G.update(o), se = o.material; + if (D && (o.boundingSphere !== void 0 ? (o.boundingSphere === null && o.computeBoundingSphere(), Te.copy(o.boundingSphere.center)) : (ne.boundingSphere === null && ne.computeBoundingSphere(), Te.copy(ne.boundingSphere.center)), Te.applyMatrix4(o.matrixWorld).applyMatrix4(Ee)), Array.isArray(se)) { + let de = ne.groups; + for(let Ae = 0, Re = de.length; Ae < Re; Ae++){ + let ve = de[Ae], Ne = se[ve.materialIndex]; + Ne && Ne.visible && l.push(o, ne, Ne, U, Te.z, ve); + } + } else se.visible && l.push(o, ne, se, U, Te.z, null); + } + } + let $ = o.children; + for(let ne = 0, se = $.length; ne < se; ne++)Sn($[ne], g, U, D); } - let i = yn.isClockWise, r = this.subPaths; - if (r.length === 0) return []; - let a, o, c, l = []; - if (r.length === 1) return o = r[0], c = new Fn, c.curves = o.curves, l.push(c), l; - let h = !i(r[0].getPoints()); - h = e ? !h : h; - let u = [], d = [], f = [], m = 0, _; - d[m] = void 0, f[m] = []; - for(let p = 0, v = r.length; p < v; p++)o = r[p], _ = o.getPoints(), a = i(_), a = e ? !a : a, a ? (!h && d[m] && m++, d[m] = { - s: new Fn, - p: _ - }, d[m].s.curves = o.curves, h && m++, f[m] = []) : f[m].push({ - h: o, - p: _[0] - }); - if (!d[0]) return t(r); - if (d.length > 1) { - let p = !1, v = 0; - for(let x1 = 0, y1 = d.length; x1 < y1; x1++)u[x1] = []; - for(let x1 = 0, y1 = d.length; x1 < y1; x1++){ - let b = f[x1]; - for(let w = 0; w < b.length; w++){ - let R = b[w], I = !0; - for(let M = 0; M < d.length; M++)n(R.p, d[M].p) && (x1 !== M && v++, I ? (I = !1, u[M].push(R)) : p = !0); - I && u[x1].push(R); + function ti(o, g, U, D) { + let E = o.opaque, $ = o.transmissive, ne = o.transparent; + r.setupLightsView(U), J === !0 && Z.setGlobalState(_.clippingPlanes, U), D && _e.viewport(A.copy(D)), E.length > 0 && tn(E, g, U), $.length > 0 && tn($, g, U), ne.length > 0 && tn(ne, g, U), _e.buffers.depth.setTest(!0), _e.buffers.depth.setMask(!0), _e.buffers.color.setMask(!0), _e.setPolygonOffset(!1); + } + function ni(o, g, U, D) { + if ((U.isScene === !0 ? U.overrideMaterial : null) !== null) return; + r.state.transmissionRenderTarget[D.id] === void 0 && (r.state.transmissionRenderTarget[D.id] = new Hi(1, 1, { + generateMipmaps: !0, + type: De.has("EXT_color_buffer_half_float") || De.has("EXT_color_buffer_float") ? tc : Sl, + minFilter: vn, + samples: 4, + stencilBuffer: s, + resolveDepthBuffer: !1, + resolveStencilBuffer: !1, + colorSpace: Tt.workingColorSpace + })); + let $ = r.state.transmissionRenderTarget[D.id], ne = D.viewport || A; + $.setSize(ne.z * _.transmissionResolutionScale, ne.w * _.transmissionResolutionScale); + let se = _.getRenderTarget(); + _.setRenderTarget($), _.getClearColor(Y), Q = _.getClearAlpha(), Q < 1 && _.setClearColor(16777215, .5), _.clear(), $e && Se.render(U); + let de = _.toneMapping; + _.toneMapping = Tp; + let Ae = D.viewport; + if (D.viewport !== void 0 && (D.viewport = void 0), r.setupLightsView(D), J === !0 && Z.setGlobalState(_.clippingPlanes, D), tn(o, U, D), u.updateMultisampleRenderTarget($), u.updateRenderTargetMipmap($), De.has("WEBGL_multisampled_render_to_texture") === !1) { + let Re = !1; + for(let ve = 0, Ne = g.length; ve < Ne; ve++){ + let He = g[ve], et = He.object, Je = He.geometry, Oe = He.material, ge = He.group; + if (Oe.side === Yd && et.layers.test(D.layers)) { + let rt = Oe.side; + Oe.side = Al, Oe.needsUpdate = !0, ii(et, U, D, Je, Oe, ge), Oe.side = rt, Oe.needsUpdate = !0, Re = !0; + } + } + Re === !0 && (u.updateMultisampleRenderTarget($), u.updateRenderTargetMipmap($)); + } + _.setRenderTarget(se), _.setClearColor(Y, Q), Ae !== void 0 && (D.viewport = Ae), _.toneMapping = de; + } + function tn(o, g, U) { + let D = g.isScene === !0 ? g.overrideMaterial : null; + for(let E = 0, $ = o.length; E < $; E++){ + let ne = o[E], se = ne.object, de = ne.geometry, Ae = D === null ? ne.material : D, Re = ne.group; + se.layers.test(U.layers) && ii(se, g, U, de, Ae, Re); + } + } + function ii(o, g, U, D, E, $) { + o.onBeforeRender(_, g, U, D, E, $), o.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse, o.matrixWorld), o.normalMatrix.getNormalMatrix(o.modelViewMatrix), E.onBeforeRender(_, g, U, D, o, $), E.transparent === !0 && E.side === Yd && E.forceSinglePass === !1 ? (E.side = Al, E.needsUpdate = !0, _.renderBufferDirect(U, g, D, E, o, $), E.side = dr, E.needsUpdate = !0, _.renderBufferDirect(U, g, D, E, o, $), E.side = Yd) : _.renderBufferDirect(U, g, D, E, o, $), o.onAfterRender(_, g, U, D, E, $); + } + function nn(o, g, U) { + g.isScene !== !0 && (g = je); + let D = he.get(o), E = r.state.lights, $ = r.state.shadowsArray, ne = E.state.version, se = pe.getParameters(o, E.state, $, g, U), de = pe.getProgramCacheKey(se), Ae = D.programs; + D.environment = o.isMeshStandardMaterial ? g.environment : null, D.fog = g.fog, D.envMap = (o.isMeshStandardMaterial ? b : a).get(o.envMap || D.environment), D.envMapRotation = D.environment !== null && o.envMap === null ? g.environmentRotation : o.envMapRotation, Ae === void 0 && (o.addEventListener("dispose", Ce), Ae = new Map, D.programs = Ae); + let Re = Ae.get(de); + if (Re !== void 0) { + if (D.currentProgram === Re && D.lightsStateVersion === ne) return ai(o, se), Re; + } else se.uniforms = pe.getUniforms(o), o.onBeforeCompile(se, _), Re = pe.acquireProgram(se, de), Ae.set(de, Re), D.uniforms = se.uniforms; + let ve = D.uniforms; + return (!o.isShaderMaterial && !o.isRawShaderMaterial || o.clipping === !0) && (ve.clippingPlanes = Z.uniform), ai(o, se), D.needsLights = yr(o), D.lightsStateVersion = ne, D.needsLights && (ve.ambientLightColor.value = E.state.ambient, ve.lightProbe.value = E.state.probe, ve.directionalLights.value = E.state.directional, ve.directionalLightShadows.value = E.state.directionalShadow, ve.spotLights.value = E.state.spot, ve.spotLightShadows.value = E.state.spotShadow, ve.rectAreaLights.value = E.state.rectArea, ve.ltc_1.value = E.state.rectAreaLTC1, ve.ltc_2.value = E.state.rectAreaLTC2, ve.pointLights.value = E.state.point, ve.pointLightShadows.value = E.state.pointShadow, ve.hemisphereLights.value = E.state.hemi, ve.directionalShadowMap.value = E.state.directionalShadowMap, ve.directionalShadowMatrix.value = E.state.directionalShadowMatrix, ve.spotShadowMap.value = E.state.spotShadowMap, ve.spotLightMatrix.value = E.state.spotLightMatrix, ve.spotLightMap.value = E.state.spotLightMap, ve.pointShadowMap.value = E.state.pointShadowMap, ve.pointShadowMatrix.value = E.state.pointShadowMatrix), D.currentProgram = Re, D.uniformsList = null, Re; + } + function ri(o) { + if (o.uniformsList === null) { + let g = o.currentProgram.getUniforms(); + o.uniformsList = Vt1.seqWithValue(g.seq, o.uniforms); + } + return o.uniformsList; + } + function ai(o, g) { + let U = he.get(o); + U.outputColorSpace = g.outputColorSpace, U.batching = g.batching, U.batchingColor = g.batchingColor, U.instancing = g.instancing, U.instancingColor = g.instancingColor, U.instancingMorph = g.instancingMorph, U.skinning = g.skinning, U.morphTargets = g.morphTargets, U.morphNormals = g.morphNormals, U.morphColors = g.morphColors, U.morphTargetsCount = g.morphTargetsCount, U.numClippingPlanes = g.numClippingPlanes, U.numIntersection = g.numClipIntersection, U.vertexAlphas = g.vertexAlphas, U.vertexTangents = g.vertexTangents, U.toneMapping = g.toneMapping; + } + function wr(o, g, U, D, E) { + g.isScene !== !0 && (g = je), u.resetTextureUnits(); + let $ = g.fog, ne = D.isMeshStandardMaterial ? g.environment : null, se = B === null ? _.outputColorSpace : B.isXRRenderTarget === !0 ? B.texture.colorSpace : ha, de = (D.isMeshStandardMaterial ? b : a).get(D.envMap || ne), Ae = D.vertexColors === !0 && !!U.attributes.color && U.attributes.color.itemSize === 4, Re = !!U.attributes.tangent && (!!D.normalMap || D.anisotropy > 0), ve = !!U.morphAttributes.position, Ne = !!U.morphAttributes.normal, He = !!U.morphAttributes.color, et = Tp; + D.toneMapped && (B === null || B.isXRRenderTarget === !0) && (et = _.toneMapping); + let Je = U.morphAttributes.position || U.morphAttributes.normal || U.morphAttributes.color, Oe = Je !== void 0 ? Je.length : 0, ge = he.get(D), rt = r.state.lights; + if (J === !0 && (ue === !0 || o !== f)) { + let ot = o === f && D.id === p; + Z.setState(D, o, ot); + } + let Ve = !1; + D.version === ge.__version ? (ge.needsLights && ge.lightsStateVersion !== rt.state.version || ge.outputColorSpace !== se || E.isBatchedMesh && ge.batching === !1 || !E.isBatchedMesh && ge.batching === !0 || E.isBatchedMesh && ge.batchingColor === !0 && E.colorTexture === null || E.isBatchedMesh && ge.batchingColor === !1 && E.colorTexture !== null || E.isInstancedMesh && ge.instancing === !1 || !E.isInstancedMesh && ge.instancing === !0 || E.isSkinnedMesh && ge.skinning === !1 || !E.isSkinnedMesh && ge.skinning === !0 || E.isInstancedMesh && ge.instancingColor === !0 && E.instanceColor === null || E.isInstancedMesh && ge.instancingColor === !1 && E.instanceColor !== null || E.isInstancedMesh && ge.instancingMorph === !0 && E.morphTexture === null || E.isInstancedMesh && ge.instancingMorph === !1 && E.morphTexture !== null || ge.envMap !== de || D.fog === !0 && ge.fog !== $ || ge.numClippingPlanes !== void 0 && (ge.numClippingPlanes !== Z.numPlanes || ge.numIntersection !== Z.numIntersection) || ge.vertexAlphas !== Ae || ge.vertexTangents !== Re || ge.morphTargets !== ve || ge.morphNormals !== Ne || ge.morphColors !== He || ge.toneMapping !== et || ge.morphTargetsCount !== Oe) && (Ve = !0) : (Ve = !0, ge.__version = D.version); + let vt = ge.currentProgram; + Ve === !0 && (vt = nn(D, g, E)); + let Nt = !1, dt = !1, Yt = !1, qe = vt.getUniforms(), pt = ge.uniforms; + if (_e.useProgram(vt.program) && (Nt = !0, dt = !0, Yt = !0), D.id !== p && (p = D.id, dt = !0), Nt || f !== o) { + _e.buffers.depth.getReversed() ? (ie.copy(o.projectionMatrix), Ff(ie), Bf(ie), qe.setValue(m, "projectionMatrix", ie)) : qe.setValue(m, "projectionMatrix", o.projectionMatrix), qe.setValue(m, "viewMatrix", o.matrixWorldInverse); + let st = qe.map.cameraPosition; + st !== void 0 && st.setValue(m, Be.setFromMatrixPosition(o.matrixWorld)), we.logarithmicDepthBuffer && qe.setValue(m, "logDepthBufFC", 2 / (Math.log(o.far + 1) / Math.LN2)), (D.isMeshPhongMaterial || D.isMeshToonMaterial || D.isMeshLambertMaterial || D.isMeshBasicMaterial || D.isMeshStandardMaterial || D.isShaderMaterial) && qe.setValue(m, "isOrthographic", o.isOrthographicCamera === !0), f !== o && (f = o, dt = !0, Yt = !0); + } + if (E.isSkinnedMesh) { + qe.setOptional(m, E, "bindMatrix"), qe.setOptional(m, E, "bindMatrixInverse"); + let ot = E.skeleton; + ot && (ot.boneTexture === null && ot.computeBoneTexture(), qe.setValue(m, "boneTexture", ot.boneTexture, u)); + } + E.isBatchedMesh && (qe.setOptional(m, E, "batchingTexture"), qe.setValue(m, "batchingTexture", E._matricesTexture, u), qe.setOptional(m, E, "batchingIdTexture"), qe.setValue(m, "batchingIdTexture", E._indirectTexture, u), qe.setOptional(m, E, "batchingColorTexture"), E._colorsTexture !== null && qe.setValue(m, "batchingColorTexture", E._colorsTexture, u)); + let ht = U.morphAttributes; + if ((ht.position !== void 0 || ht.normal !== void 0 || ht.color !== void 0) && xe.update(E, U, vt), (dt || ge.receiveShadow !== E.receiveShadow) && (ge.receiveShadow = E.receiveShadow, qe.setValue(m, "receiveShadow", E.receiveShadow)), D.isMeshGouraudMaterial && D.envMap !== null && (pt.envMap.value = de, pt.flipEnvMap.value = de.isCubeTexture && de.isRenderTargetTexture === !1 ? -1 : 1), D.isMeshStandardMaterial && D.envMap === null && g.environment !== null && (pt.envMapIntensity.value = g.environmentIntensity), dt && (qe.setValue(m, "toneMappingExposure", _.toneMappingExposure), ge.needsLights && Ir(pt, Yt), $ && D.fog === !0 && re.refreshFogUniforms(pt, $), re.refreshMaterialUniforms(pt, D, F, j, r.state.transmissionRenderTarget[o.id]), Vt1.upload(m, ri(ge), pt, u)), D.isShaderMaterial && D.uniformsNeedUpdate === !0 && (Vt1.upload(m, ri(ge), pt, u), D.uniformsNeedUpdate = !1), D.isSpriteMaterial && qe.setValue(m, "center", E.center), qe.setValue(m, "modelViewMatrix", E.modelViewMatrix), qe.setValue(m, "normalMatrix", E.normalMatrix), qe.setValue(m, "modelMatrix", E.matrixWorld), D.isShaderMaterial || D.isRawShaderMaterial) { + let ot = D.uniformsGroups; + for(let st = 0, En = ot.length; st < En; st++){ + let Ct = ot[st]; + v.update(Ct, vt), v.bind(Ct, vt); } } - v > 0 && p === !1 && (f = u); + return vt; } - let g; - for(let p = 0, v = d.length; p < v; p++){ - c = d[p].s, l.push(c), g = f[p]; - for(let x1 = 0, y1 = g.length; x1 < y1; x1++)c.holes.push(g[x1].h); + function Ir(o, g) { + o.ambientLightColor.needsUpdate = g, o.lightProbe.needsUpdate = g, o.directionalLights.needsUpdate = g, o.directionalLightShadows.needsUpdate = g, o.pointLights.needsUpdate = g, o.pointLightShadows.needsUpdate = g, o.spotLights.needsUpdate = g, o.spotLightShadows.needsUpdate = g, o.rectAreaLights.needsUpdate = g, o.hemisphereLights.needsUpdate = g; } - return l; + function yr(o) { + return o.isMeshLambertMaterial || o.isMeshToonMaterial || o.isMeshPhongMaterial || o.isMeshStandardMaterial || o.isShadowMaterial || o.isShaderMaterial && o.lights === !0; + } + this.getActiveCubeFace = function() { + return P1; + }, this.getActiveMipmapLevel = function() { + return y1; + }, this.getRenderTarget = function() { + return B; + }, this.setRenderTargetTextures = function(o, g, U) { + he.get(o.texture).__webglTexture = g, he.get(o.depthTexture).__webglTexture = U; + let D = he.get(o); + D.__hasExternalTextures = !0, D.__autoAllocateDepthBuffer = U === void 0, D.__autoAllocateDepthBuffer || De.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(o, g) { + let U = he.get(o); + U.__webglFramebuffer = g, U.__useDefaultFramebuffer = g === void 0; + }; + let Nr = m.createFramebuffer(); + this.setRenderTarget = function(o, g = 0, U = 0) { + B = o, P1 = g, y1 = U; + let D = !0, E = null, $ = !1, ne = !1; + if (o) { + let de = he.get(o); + if (de.__useDefaultFramebuffer !== void 0) _e.bindFramebuffer(m.FRAMEBUFFER, null), D = !1; + else if (de.__webglFramebuffer === void 0) u.setupRenderTarget(o); + else if (de.__hasExternalTextures) u.rebindTextures(o, he.get(o.texture).__webglTexture, he.get(o.depthTexture).__webglTexture); + else if (o.depthBuffer) { + let ve = o.depthTexture; + if (de.__boundDepthTexture !== ve) { + if (ve !== null && he.has(ve) && (o.width !== ve.image.width || o.height !== ve.image.height)) throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size."); + u.setupDepthRenderbuffer(o); + } + } + let Ae = o.texture; + (Ae.isData3DTexture || Ae.isDataArrayTexture || Ae.isCompressedArrayTexture) && (ne = !0); + let Re = he.get(o).__webglFramebuffer; + o.isWebGLCubeRenderTarget ? (Array.isArray(Re[g]) ? E = Re[g][U] : E = Re[g], $ = !0) : o.samples > 0 && u.useMultisampledRTT(o) === !1 ? E = he.get(o).__webglMultisampledFramebuffer : Array.isArray(Re) ? E = Re[U] : E = Re, A.copy(o.viewport), q.copy(o.scissor), V = o.scissorTest; + } else A.copy(Le).multiplyScalar(F).floor(), q.copy(Ge).multiplyScalar(F).floor(), V = Ze; + if (U !== 0 && (E = Nr), _e.bindFramebuffer(m.FRAMEBUFFER, E) && D && _e.drawBuffers(o, E), _e.viewport(A), _e.scissor(q), _e.setScissorTest(V), $) { + let de = he.get(o.texture); + m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_CUBE_MAP_POSITIVE_X + g, de.__webglTexture, U); + } else if (ne) { + let de = he.get(o.texture), Ae = g; + m.framebufferTextureLayer(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0, de.__webglTexture, U, Ae); + } else if (o !== null && U !== 0) { + let de = he.get(o.texture); + m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_2D, de.__webglTexture, U); + } + p = -1; + }, this.readRenderTargetPixels = function(o, g, U, D, E, $, ne) { + if (!(o && o.isWebGLRenderTarget)) { + console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); + return; + } + let se = he.get(o).__webglFramebuffer; + if (o.isWebGLCubeRenderTarget && ne !== void 0 && (se = se[ne]), se) { + _e.bindFramebuffer(m.FRAMEBUFFER, se); + try { + let de = o.texture, Ae = de.format, Re = de.type; + if (!we.textureFormatReadable(Ae)) { + console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); + return; + } + if (!we.textureTypeReadable(Re)) { + console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); + return; + } + g >= 0 && g <= o.width - D && U >= 0 && U <= o.height - E && m.readPixels(g, U, D, E, be.convert(Ae), be.convert(Re), $); + } finally{ + let de = B !== null ? he.get(B).__webglFramebuffer : null; + _e.bindFramebuffer(m.FRAMEBUFFER, de); + } + } + }, this.readRenderTargetPixelsAsync = async function(o, g, U, D, E, $, ne) { + if (!(o && o.isWebGLRenderTarget)) throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); + let se = he.get(o).__webglFramebuffer; + if (o.isWebGLCubeRenderTarget && ne !== void 0 && (se = se[ne]), se) { + let de = o.texture, Ae = de.format, Re = de.type; + if (!we.textureFormatReadable(Ae)) throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format."); + if (!we.textureTypeReadable(Re)) throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type."); + if (g >= 0 && g <= o.width - D && U >= 0 && U <= o.height - E) { + _e.bindFramebuffer(m.FRAMEBUFFER, se); + let ve = m.createBuffer(); + m.bindBuffer(m.PIXEL_PACK_BUFFER, ve), m.bufferData(m.PIXEL_PACK_BUFFER, $.byteLength, m.STREAM_READ), m.readPixels(g, U, D, E, be.convert(Ae), be.convert(Re), 0); + let Ne = B !== null ? he.get(B).__webglFramebuffer : null; + _e.bindFramebuffer(m.FRAMEBUFFER, Ne); + let He = m.fenceSync(m.SYNC_GPU_COMMANDS_COMPLETE, 0); + return m.flush(), await zf(m, He, 4), m.bindBuffer(m.PIXEL_PACK_BUFFER, ve), m.getBufferSubData(m.PIXEL_PACK_BUFFER, 0, $), m.deleteBuffer(ve), m.deleteSync(He), $; + } else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range."); + } + }, this.copyFramebufferToTexture = function(o, g = null, U = 0) { + o.isTexture !== !0 && (Cf("WebGLRenderer: copyFramebufferToTexture function signature has changed."), g = arguments[0] || null, o = arguments[1]); + let D = Math.pow(2, -U), E = Math.floor(o.image.width * D), $ = Math.floor(o.image.height * D), ne = g !== null ? g.x : 0, se = g !== null ? g.y : 0; + u.setTexture2D(o, 0), m.copyTexSubImage2D(m.TEXTURE_2D, U, 0, 0, ne, se, E, $), _e.unbindTexture(); + }; + let Or = m.createFramebuffer(), Fr = m.createFramebuffer(); + this.copyTextureToTexture = function(o, g, U = null, D = null, E = 0, $ = null) { + o.isTexture !== !0 && (Cf("WebGLRenderer: copyTextureToTexture function signature has changed."), D = arguments[0] || null, o = arguments[1], g = arguments[2], $ = arguments[3] || 0, U = null), $ === null && (E !== 0 ? (Cf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."), $ = E, E = 0) : $ = 0); + let ne, se, de, Ae, Re, ve, Ne, He, et, Je = o.isCompressedTexture ? o.mipmaps[$] : o.image; + if (U !== null) ne = U.max.x - U.min.x, se = U.max.y - U.min.y, de = U.isBox3 ? U.max.z - U.min.z : 1, Ae = U.min.x, Re = U.min.y, ve = U.isBox3 ? U.min.z : 0; + else { + let ht = Math.pow(2, -E); + ne = Math.floor(Je.width * ht), se = Math.floor(Je.height * ht), o.isDataArrayTexture ? de = Je.depth : o.isData3DTexture ? de = Math.floor(Je.depth * ht) : de = 1, Ae = 0, Re = 0, ve = 0; + } + D !== null ? (Ne = D.x, He = D.y, et = D.z) : (Ne = 0, He = 0, et = 0); + let Oe = be.convert(g.format), ge = be.convert(g.type), rt; + g.isData3DTexture ? (u.setTexture3D(g, 0), rt = m.TEXTURE_3D) : g.isDataArrayTexture || g.isCompressedArrayTexture ? (u.setTexture2DArray(g, 0), rt = m.TEXTURE_2D_ARRAY) : (u.setTexture2D(g, 0), rt = m.TEXTURE_2D), m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL, g.flipY), m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL, g.premultiplyAlpha), m.pixelStorei(m.UNPACK_ALIGNMENT, g.unpackAlignment); + let Ve = m.getParameter(m.UNPACK_ROW_LENGTH), vt = m.getParameter(m.UNPACK_IMAGE_HEIGHT), Nt = m.getParameter(m.UNPACK_SKIP_PIXELS), dt = m.getParameter(m.UNPACK_SKIP_ROWS), Yt = m.getParameter(m.UNPACK_SKIP_IMAGES); + m.pixelStorei(m.UNPACK_ROW_LENGTH, Je.width), m.pixelStorei(m.UNPACK_IMAGE_HEIGHT, Je.height), m.pixelStorei(m.UNPACK_SKIP_PIXELS, Ae), m.pixelStorei(m.UNPACK_SKIP_ROWS, Re), m.pixelStorei(m.UNPACK_SKIP_IMAGES, ve); + let qe = o.isDataArrayTexture || o.isData3DTexture, pt = g.isDataArrayTexture || g.isData3DTexture; + if (o.isDepthTexture) { + let ht = he.get(o), ot = he.get(g), st = he.get(ht.__renderTarget), En = he.get(ot.__renderTarget); + _e.bindFramebuffer(m.READ_FRAMEBUFFER, st.__webglFramebuffer), _e.bindFramebuffer(m.DRAW_FRAMEBUFFER, En.__webglFramebuffer); + for(let Ct = 0; Ct < de; Ct++)qe && (m.framebufferTextureLayer(m.READ_FRAMEBUFFER, m.COLOR_ATTACHMENT0, he.get(o).__webglTexture, E, ve + Ct), m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER, m.COLOR_ATTACHMENT0, he.get(g).__webglTexture, $, et + Ct)), m.blitFramebuffer(Ae, Re, ne, se, Ne, He, ne, se, m.DEPTH_BUFFER_BIT, m.NEAREST); + _e.bindFramebuffer(m.READ_FRAMEBUFFER, null), _e.bindFramebuffer(m.DRAW_FRAMEBUFFER, null); + } else if (E !== 0 || o.isRenderTargetTexture || he.has(o)) { + let ht = he.get(o), ot = he.get(g); + _e.bindFramebuffer(m.READ_FRAMEBUFFER, Or), _e.bindFramebuffer(m.DRAW_FRAMEBUFFER, Fr); + for(let st = 0; st < de; st++)qe ? m.framebufferTextureLayer(m.READ_FRAMEBUFFER, m.COLOR_ATTACHMENT0, ht.__webglTexture, E, ve + st) : m.framebufferTexture2D(m.READ_FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_2D, ht.__webglTexture, E), pt ? m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER, m.COLOR_ATTACHMENT0, ot.__webglTexture, $, et + st) : m.framebufferTexture2D(m.DRAW_FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_2D, ot.__webglTexture, $), E !== 0 ? m.blitFramebuffer(Ae, Re, ne, se, Ne, He, ne, se, m.COLOR_BUFFER_BIT, m.NEAREST) : pt ? m.copyTexSubImage3D(rt, $, Ne, He, et + st, Ae, Re, ne, se) : m.copyTexSubImage2D(rt, $, Ne, He, Ae, Re, ne, se); + _e.bindFramebuffer(m.READ_FRAMEBUFFER, null), _e.bindFramebuffer(m.DRAW_FRAMEBUFFER, null); + } else pt ? o.isDataTexture || o.isData3DTexture ? m.texSubImage3D(rt, $, Ne, He, et, ne, se, de, Oe, ge, Je.data) : g.isCompressedArrayTexture ? m.compressedTexSubImage3D(rt, $, Ne, He, et, ne, se, de, Oe, Je.data) : m.texSubImage3D(rt, $, Ne, He, et, ne, se, de, Oe, ge, Je) : o.isDataTexture ? m.texSubImage2D(m.TEXTURE_2D, $, Ne, He, ne, se, Oe, ge, Je.data) : o.isCompressedTexture ? m.compressedTexSubImage2D(m.TEXTURE_2D, $, Ne, He, Je.width, Je.height, Oe, Je.data) : m.texSubImage2D(m.TEXTURE_2D, $, Ne, He, ne, se, Oe, ge, Je); + m.pixelStorei(m.UNPACK_ROW_LENGTH, Ve), m.pixelStorei(m.UNPACK_IMAGE_HEIGHT, vt), m.pixelStorei(m.UNPACK_SKIP_PIXELS, Nt), m.pixelStorei(m.UNPACK_SKIP_ROWS, dt), m.pixelStorei(m.UNPACK_SKIP_IMAGES, Yt), $ === 0 && g.generateMipmaps && m.generateMipmap(rt), _e.unbindTexture(); + }, this.copyTextureToTexture3D = function(o, g, U = null, D = null, E = 0) { + return o.isTexture !== !0 && (Cf("WebGLRenderer: copyTextureToTexture3D function signature has changed."), U = arguments[0] || null, D = arguments[1] || null, o = arguments[2], g = arguments[3], E = arguments[4] || 0), Cf('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(o, g, U, D, E); + }, this.initRenderTarget = function(o) { + he.get(o).__webglFramebuffer === void 0 && u.setupRenderTarget(o); + }, this.initTexture = function(o) { + o.isCubeTexture ? u.setTextureCube(o, 0) : o.isData3DTexture ? u.setTexture3D(o, 0) : o.isDataArrayTexture || o.isCompressedArrayTexture ? u.setTexture2DArray(o, 0) : u.setTexture2D(o, 0), _e.unbindTexture(); + }, this.resetState = function() { + P1 = 0, y1 = 0, B = null, _e.reset(), ze.reset(); + }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { + detail: this + })); } -}; -typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { - detail: { - revision: Hc + get coordinateSystem() { + return oe; } -})); -typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = Hc); + get outputColorSpace() { + return this._outputColorSpace; + } + set outputColorSpace(n) { + this._outputColorSpace = n; + let t = this.getContext(); + t.drawingBufferColorspace = Tt._getDrawingBufferColorSpace(n), t.unpackColorSpace = Tt._getUnpackColorSpace(); + } +}; const mod = { - ACESFilmicToneMapping: mf, - AddEquation: Bi, - AddOperation: uf, - AdditiveAnimationBlendMode: xd, - AdditiveBlending: al, - AlphaFormat: vf, - AlwaysCompare: Vf, - AlwaysDepth: sf, - AlwaysStencilFunc: If, - AmbientLight: Cc, - AnimationAction: Vc, - AnimationClip: is, - AnimationLoader: au, - AnimationMixer: Cu, - AnimationObjectGroup: Ru, - AnimationUtils: Sv, - ArcCurve: ko, - ArrayCamera: To, - ArrowHelper: rd, - Audio: Fc, - AudioAnalyser: Au, - AudioContext: _a, - AudioListener: Eu, - AudioLoader: xu, - AxesHelper: ad, - BackSide: Ft, - BasicDepthPacking: Cf, - BasicShadowMap: Hx, - Bone: ta, - BooleanKeyframeTrack: Vn, - Box2: zu, - Box3: Qt, - Box3Helper: nd, - BoxGeometry: Ji, - BoxHelper: td, - BufferAttribute: et, - BufferGeometry: Ge, - BufferGeometryLoader: Nc, - ByteType: _f, - Cache: ss, - Camera: Cs, - CameraHelper: ed, - CanvasTexture: jh, - CapsuleGeometry: qo, - CatmullRomCurve3: Ho, - CineonToneMapping: pf, - CircleGeometry: Yo, - ClampToEdgeWrapping: It, - Clock: Oc, - Color: pe, - ColorKeyframeTrack: pa, - ColorManagement: Qe, - CompressedArrayTexture: Kh, - CompressedCubeTexture: Qh, - CompressedTexture: Us, - CompressedTextureLoader: ou, - ConeGeometry: Zo, - CubeCamera: _o, - CubeReflectionMapping: zn, - CubeRefractionMapping: ci, - CubeTexture: Ki, - CubeTextureLoader: cu, - CubeUVReflectionMapping: Vs, - CubicBezierCurve: ia, - CubicBezierCurve3: Go, - CubicInterpolant: xc, - CullFaceBack: rl, + ACESFilmicToneMapping: Fp, + AddEquation: ia, + AddOperation: Sp, + AdditiveAnimationBlendMode: Cl, + AdditiveBlending: $d, + AgXToneMapping: Ep, + AlphaFormat: rc, + AlwaysCompare: ff, + AlwaysDepth: xp, + AlwaysStencilFunc: ca, + AmbientLight: To, + AnimationAction: No, + AnimationClip: wi, + AnimationLoader: mh, + AnimationMixer: Dh, + AnimationObjectGroup: Vh, + AnimationUtils: Pf, + ArcCurve: kr, + ArrayCamera: Bh, + ArrowHelper: bl, + AttachedBindMode: oa, + Audio: ko, + AudioAnalyser: Nh, + AudioContext: _n, + AudioListener: kh, + AudioLoader: Ih, + AxesHelper: wl, + BackSide: Al, + BasicDepthPacking: Jc, + BasicShadowMap: Gd, + BatchedMesh: zr, + Bone: en, + BooleanKeyframeTrack: ve, + Box2: Kh, + Box3: ft, + Box3Helper: yl, + BoxGeometry: Ks, + BoxHelper: ml, + BufferAttribute: Z, + BufferGeometry: L, + BufferGeometryLoader: Eo, + ByteType: $l, + Cache: we, + Camera: Gi, + CameraHelper: fl, + CanvasTexture: ah, + CapsuleGeometry: Dr, + CatmullRomCurve3: Pr, + CineonToneMapping: zp, + CircleGeometry: Lr, + ClampToEdgeWrapping: Ht, + Clock: Ro, + Color: P, + ColorKeyframeTrack: xn, + ColorManagement: Tt, + CompressedArrayTexture: rh, + CompressedCubeTexture: oh, + CompressedTexture: Zi, + CompressedTextureLoader: yh, + ConeGeometry: Ur, + ConstantAlphaFactor: mp, + ConstantColorFactor: pp, + Controls: _l, + CubeCamera: br, + CubeReflectionMapping: Uo, + CubeRefractionMapping: Hl, + CubeTexture: Xi, + CubeTextureLoader: gh, + CubeUVReflectionMapping: Xl, + CubicBezierCurve: an, + CubicBezierCurve3: Or, + CubicInterpolant: mo, + CullFaceBack: Wd, CullFaceFront: Hd, - CullFaceFrontBack: kx, - CullFaceNone: kd, - Curve: Zt, - CurvePath: Xo, - CustomBlending: Wd, - CustomToneMapping: gf, - CylinderGeometry: Ns, - Cylindrical: Fu, - Data3DTexture: qr, - DataArrayTexture: As, - DataTexture: oi, - DataTextureLoader: lu, - DataUtils: Mv, - DecrementStencilOp: ev, - DecrementWrapStencilOp: nv, - DefaultLoadingManager: Ex, - DepthFormat: si, - DepthStencilFormat: Yi, - DepthTexture: wo, - DirectionalLight: Rc, - DirectionalLightHelper: ju, - DiscreteInterpolant: vc, - DisplayP3ColorSpace: qc, - DodecahedronGeometry: Jo, - DoubleSide: gn, - DstAlphaFactor: Kd, - DstColorFactor: jd, - DynamicCopyUsage: _v, - DynamicDrawUsage: uv, - DynamicReadUsage: pv, - EdgesGeometry: $o, - EllipseCurve: Ds, - EqualCompare: Nf, - EqualDepth: af, - EqualStencilFunc: av, - EquirectangularReflectionMapping: Ir, - EquirectangularRefractionMapping: Ur, - Euler: Yr, - EventDispatcher: sn, - ExtrudeGeometry: jo, - FileLoader: rn, - Float16BufferAttribute: ih, - Float32BufferAttribute: ve, - Float64BufferAttribute: sh, - FloatType: xn, - Fog: Lo, - FogExp2: Po, - FramebufferTexture: $h, - FrontSide: Bn, - Frustum: Ps, - GLBufferAttribute: Uu, - GLSL1: vv, - GLSL3: Ol, - GreaterCompare: Ff, - GreaterDepth: cf, - GreaterEqualCompare: zf, - GreaterEqualDepth: of, - GreaterEqualStencilFunc: hv, - GreaterStencilFunc: cv, - GridHelper: Ju, - Group: ti, - HalfFloatType: Ts, - HemisphereLight: Sc, - HemisphereLightHelper: Zu, - IcosahedronGeometry: ec, - ImageBitmapLoader: _u, - ImageLoader: rs, - ImageUtils: Xr, - IncrementStencilOp: jx, - IncrementWrapStencilOp: tv, - InstancedBufferAttribute: ui, - InstancedBufferGeometry: Dc, - InstancedInterleavedBuffer: Iu, - InstancedMesh: Fo, - Int16BufferAttribute: th, - Int32BufferAttribute: nh, - Int8BufferAttribute: Ql, - IntType: dd, - InterleavedBuffer: Is, - InterleavedBufferAttribute: Qi, - Interpolant: es, - InterpolateDiscrete: Or, - InterpolateLinear: Fr, - InterpolateSmooth: La, - InvertStencilOp: iv, - KeepStencilOp: Ia, - KeyframeTrack: Jt, - LOD: Do, - LatheGeometry: la, - Layers: Rs, - LessCompare: Df, - LessDepth: rf, - LessEqualCompare: Of, - LessEqualDepth: uo, - LessEqualStencilFunc: ov, - LessStencilFunc: rv, - Light: En, - LightProbe: Ic, - Line: bn, - Line3: ku, - LineBasicMaterial: wt, - LineCurve: sa, - LineCurve3: Wo, - LineDashedMaterial: gc, - LineLoop: Bo, - LineSegments: en, - LinearDisplayP3ColorSpace: va, - LinearEncoding: vd, - LinearFilter: mt, - LinearInterpolant: fa, - LinearMipMapLinearFilter: Yx, - LinearMipMapNearestFilter: qx, - LinearMipmapLinearFilter: li, - LinearMipmapNearestFilter: ud, - LinearSRGBColorSpace: Mn, - LinearToneMapping: df, - LinearTransfer: zr, - Loader: Dt, - LoaderUtils: ga, - LoadingManager: ma, - LoopOnce: wf, - LoopPingPong: Rf, - LoopRepeat: Af, - LuminanceAlphaFormat: Mf, - LuminanceFormat: yf, - MOUSE: zx, - Material: bt, - MaterialLoader: Uc, - MathUtils: yv, - Matrix3: He, - Matrix4: ze, - MaxEquation: hl, - Mesh: Mt, - MeshBasicMaterial: Sn, - MeshDepthMaterial: Qr, - MeshDistanceMaterial: jr, - MeshLambertMaterial: pc, - MeshMatcapMaterial: mc, - MeshNormalMaterial: fc, - MeshPhongMaterial: uc, - MeshPhysicalMaterial: hc, - MeshStandardMaterial: da, - MeshToonMaterial: dc, - MinEquation: ll, - MirroredRepeatWrapping: Nr, - MixOperation: hf, - MultiplyBlending: cl, - MultiplyOperation: xa, - NearestFilter: pt, - NearestMipMapLinearFilter: Xx, - NearestMipMapNearestFilter: Wx, - NearestMipmapLinearFilter: Lr, - NearestMipmapNearestFilter: fo, - NeverCompare: Uf, - NeverDepth: nf, - NeverStencilFunc: sv, - NoBlending: Dn, - NoColorSpace: Xt, - NoToneMapping: Nn, - NormalAnimationBlendMode: Xc, - NormalBlending: Wi, - NotEqualCompare: Bf, - NotEqualDepth: lf, - NotEqualStencilFunc: lv, - NumberKeyframeTrack: ts, - Object3D: Je, - ObjectLoader: pu, - ObjectSpaceNormalMap: Lf, - OctahedronGeometry: ha, - OneFactor: Zd, - OneMinusDstAlphaFactor: Qd, - OneMinusDstColorFactor: ef, - OneMinusSrcAlphaFactor: hd, - OneMinusSrcColorFactor: $d, - OrthographicCamera: Ls, - P3Primaries: kr, - PCFShadowMap: cd, - PCFSoftShadowMap: Gd, - PMREMGenerator: Kr, - Path: ji, - PerspectiveCamera: yt, - Plane: mn, - PlaneGeometry: $r, - PlaneHelper: id, - PointLight: wc, - PointLightHelper: Xu, - Points: Vo, - PointsMaterial: na, - PolarGridHelper: $u, - PolyhedronGeometry: di, - PositionalAudio: wu, - PropertyBinding: Ke, - PropertyMixer: Bc, - QuadraticBezierCurve: ra, - QuadraticBezierCurve3: aa, - Quaternion: Ut, - QuaternionKeyframeTrack: pi, - QuaternionLinearInterpolant: yc, - RED_GREEN_RGTC2_Format: Dl, - RED_RGTC1_Format: Tf, - REVISION: Hc, - RGBADepthPacking: Pf, - RGBAFormat: Wt, - RGBAIntegerFormat: _d, - RGBA_ASTC_10x10_Format: Rl, - RGBA_ASTC_10x5_Format: Tl, - RGBA_ASTC_10x6_Format: wl, - RGBA_ASTC_10x8_Format: Al, - RGBA_ASTC_12x10_Format: Cl, - RGBA_ASTC_12x12_Format: Pl, - RGBA_ASTC_4x4_Format: _l, - RGBA_ASTC_5x4_Format: xl, - RGBA_ASTC_5x5_Format: vl, - RGBA_ASTC_6x5_Format: yl, - RGBA_ASTC_6x6_Format: Ml, - RGBA_ASTC_8x5_Format: Sl, - RGBA_ASTC_8x6_Format: bl, - RGBA_ASTC_8x8_Format: El, - RGBA_BPTC_Format: Pa, - RGBA_ETC2_EAC_Format: gl, - RGBA_PVRTC_2BPPV1_Format: pl, - RGBA_PVRTC_4BPPV1_Format: fl, - RGBA_S3TC_DXT1_Format: Aa, - RGBA_S3TC_DXT3_Format: Ra, - RGBA_S3TC_DXT5_Format: Ca, - RGB_BPTC_SIGNED_Format: Ll, - RGB_BPTC_UNSIGNED_Format: Il, - RGB_ETC1_Format: Ef, - RGB_ETC2_Format: ml, - RGB_PVRTC_2BPPV1_Format: dl, - RGB_PVRTC_4BPPV1_Format: ul, - RGB_S3TC_DXT1_Format: wa, - RGFormat: bf, - RGIntegerFormat: gd, - RawShaderMaterial: lc, - Ray: hi, - Raycaster: Du, - Rec709Primaries: Vr, - RectAreaLight: Pc, - RedFormat: Sf, - RedIntegerFormat: md, - ReinhardToneMapping: ff, - RenderTarget: go, - RepeatWrapping: Dr, - ReplaceStencilOp: Qx, - ReverseSubtractEquation: qd, - RingGeometry: tc, - SIGNED_RED_GREEN_RGTC2_Format: Nl, - SIGNED_RED_RGTC1_Format: Ul, - SRGBColorSpace: vt, - SRGBTransfer: nt, - Scene: Io, - ShaderChunk: ke, - ShaderLib: nn, - ShaderMaterial: jt, - ShadowMaterial: cc, - Shape: Fn, - ShapeGeometry: nc, - ShapePath: od, - ShapeUtils: yn, - ShortType: xf, - Skeleton: Oo, - SkeletonHelper: Wu, - SkinnedMesh: No, - Source: In, - Sphere: Yt, - SphereGeometry: ua, - Spherical: Ou, - SphericalHarmonics3: Lc, - SplineCurve: oa, - SpotLight: Ec, - SpotLightHelper: Gu, - Sprite: Uo, - SpriteMaterial: ea, - SrcAlphaFactor: ld, - SrcAlphaSaturateFactor: tf, - SrcColorFactor: Jd, - StaticCopyUsage: gv, - StaticDrawUsage: Hr, - StaticReadUsage: fv, - StereoCamera: Mu, - StreamCopyUsage: xv, - StreamDrawUsage: dv, - StreamReadUsage: mv, - StringKeyframeTrack: kn, - SubtractEquation: Xd, - SubtractiveBlending: ol, - TOUCH: Vx, - TangentSpaceNormalMap: mi, - TetrahedronGeometry: ic, - Texture: St, - TextureLoader: hu, - TorusGeometry: sc, - TorusKnotGeometry: rc, - Triangle: Un, - TriangleFanDrawMode: $x, - TriangleStripDrawMode: Jx, - TrianglesDrawMode: Zx, - TubeGeometry: ac, - TwoPassDoubleSide: Gx, - UVMapping: Gc, - Uint16BufferAttribute: Zr, - Uint32BufferAttribute: Jr, - Uint8BufferAttribute: jl, - Uint8ClampedBufferAttribute: eh, - Uniform: Pu, - UniformsGroup: Lu, - UniformsLib: le, - UniformsUtils: xp, - UnsignedByteType: On, - UnsignedInt248Type: ii, - UnsignedIntType: Ln, - UnsignedShort4444Type: fd, - UnsignedShort5551Type: pd, - UnsignedShortType: Wc, - VSMShadowMap: pn, - Vector2: Z, - Vector3: A, - Vector4: je, - VectorKeyframeTrack: ns, - VideoTexture: Jh, - WebGL1Renderer: Co, - WebGL3DRenderTarget: Hl, - WebGLArrayRenderTarget: kl, - WebGLCoordinateSystem: vn, - WebGLCubeRenderTarget: xo, - WebGLMultipleRenderTargets: Gl, - WebGLRenderTarget: qt, - WebGLRenderer: Ro, - WebGLUtils: V0, - WebGPUCoordinateSystem: Gr, - WireframeGeometry: oc, - WrapAroundEnding: Br, - ZeroCurvatureEnding: zi, - ZeroFactor: Yd, - ZeroSlopeEnding: Vi, - ZeroStencilOp: Kx, - _SRGBAFormat: po, - createCanvasElement: tp, - sRGBEncoding: ri + CullFaceFrontBack: qd, + CullFaceNone: Ud, + Curve: Rt, + CurvePath: Vr, + CustomBlending: Kd, + CustomToneMapping: Bp, + CylinderGeometry: $i, + Cylindrical: $h, + Data3DTexture: Qs, + DataArrayTexture: $s, + DataTexture: Lt, + DataTextureLoader: xh, + DataUtils: Ef, + DecrementStencilOp: Yp, + DecrementWrapStencilOp: Qp, + DefaultLoadingManager: bd, + DepthFormat: Cn, + DepthStencilFormat: aa, + DepthTexture: hh, + DetachedBindMode: Wl, + DirectionalLight: So, + DirectionalLightHelper: pl, + DiscreteInterpolant: yo, + DodecahedronGeometry: Wr, + DoubleSide: Yd, + DstAlphaFactor: hp, + DstColorFactor: cp, + DynamicCopyUsage: Mf, + DynamicDrawUsage: mf, + DynamicReadUsage: xf, + EdgesGeometry: Hr, + EllipseCurve: Yi, + EqualCompare: lf, + EqualDepth: wp, + EqualStencilFunc: ef, + EquirectangularReflectionMapping: ql, + EquirectangularRefractionMapping: Gl, + Euler: Xt, + EventDispatcher: qt, + ExtrudeGeometry: Xr, + FileLoader: Jt, + Float16BufferAttribute: Ba, + Float32BufferAttribute: E, + FloatType: pi, + Fog: Mr, + FogExp2: wr, + FramebufferTexture: nh, + FrontSide: dr, + Frustum: sn, + GLBufferAttribute: Gh, + GLSL1: vf, + GLSL3: Af, + GreaterCompare: uf, + GreaterDepth: _p, + GreaterEqualCompare: pf, + GreaterEqualDepth: Mp, + GreaterEqualStencilFunc: of, + GreaterStencilFunc: nf, + GridHelper: ll, + Group: Ne, + HalfFloatType: tc, + HemisphereLight: bo, + HemisphereLightHelper: hl, + IcosahedronGeometry: Jr, + ImageBitmapLoader: Th, + ImageLoader: Mi, + ImageUtils: yr, + IncrementStencilOp: Zp, + IncrementWrapStencilOp: $p, + InstancedBufferAttribute: Ue, + InstancedBufferGeometry: Bo, + InstancedInterleavedBuffer: qh, + InstancedMesh: Ir, + Int16BufferAttribute: za, + Int32BufferAttribute: Fa, + Int8BufferAttribute: Ta, + IntType: Kl, + InterleavedBuffer: Ji, + InterleavedBufferAttribute: fi, + Interpolant: yi, + InterpolateDiscrete: Gs, + InterpolateLinear: mr, + InterpolateSmooth: zn, + InvertStencilOp: jp, + KeepStencilOp: qe, + KeyframeTrack: kt, + LOD: Ar, + LatheGeometry: pn, + Layers: js, + LessCompare: hf, + LessDepth: bp, + LessEqualCompare: cf, + LessEqualDepth: ra, + LessEqualStencilFunc: sf, + LessStencilFunc: tf, + Light: ce, + LightProbe: zo, + Line: le, + Line3: el, + LineBasicMaterial: mt, + LineCurve: hn, + LineCurve3: Nr, + LineDashedMaterial: po, + LineLoop: Fr, + LineSegments: Wt, + LinearFilter: Et, + LinearInterpolant: gn, + LinearMipMapLinearFilter: Np, + LinearMipMapNearestFilter: Op, + LinearMipmapLinearFilter: vn, + LinearMipmapNearestFilter: Yl, + LinearSRGBColorSpace: ha, + LinearToneMapping: Ip, + LinearTransfer: la, + Loader: wt, + LoaderUtils: Mn, + LoadingManager: bn, + LoopOnce: qc, + LoopPingPong: Xc, + LoopRepeat: Gc, + LuminanceAlphaFormat: hc, + LuminanceFormat: ac, + MOUSE: Dd, + Material: ct, + MaterialLoader: Fo, + MathUtils: Tf, + Matrix2: Qh, + Matrix3: Gt, + Matrix4: D, + MaxEquation: sp, + Mesh: Ct, + MeshBasicMaterial: _e, + MeshDepthMaterial: lo, + MeshDistanceMaterial: co, + MeshLambertMaterial: ho, + MeshMatcapMaterial: uo, + MeshNormalMaterial: ao, + MeshPhongMaterial: ro, + MeshPhysicalMaterial: no, + MeshStandardMaterial: yn, + MeshToonMaterial: oo, + MinEquation: ip, + MirroredRepeatWrapping: fr, + MixOperation: Ap, + MultiplyBlending: jd, + MultiplyOperation: Do, + NearestFilter: Ut, + NearestMipMapLinearFilter: Pp, + NearestMipMapNearestFilter: kp, + NearestMipmapLinearFilter: Zl, + NearestMipmapNearestFilter: Jl, + NeutralToneMapping: Rp, + NeverCompare: af, + NeverDepth: gp, + NeverStencilFunc: Kp, + NoBlending: Ul, + NoColorSpace: zl, + NoToneMapping: Tp, + NormalAnimationBlendMode: Ho, + NormalBlending: ea, + NotEqualCompare: df, + NotEqualDepth: vp, + NotEqualStencilFunc: rf, + NumberKeyframeTrack: gi, + Object3D: G, + ObjectLoader: vh, + ObjectSpaceNormalMap: Gp, + OctahedronGeometry: fn, + OneFactor: rp, + OneMinusConstantAlphaFactor: yp, + OneMinusConstantColorFactor: fp, + OneMinusDstAlphaFactor: lp, + OneMinusDstColorFactor: up, + OneMinusSrcAlphaFactor: na, + OneMinusSrcColorFactor: ap, + OrthographicCamera: wn, + PCFShadowMap: Xd, + PCFSoftShadowMap: Jd, + PMREMGenerator: hn1, + Path: mi, + PerspectiveCamera: vt, + Plane: xe, + PlaneGeometry: Zr, + PlaneHelper: gl, + PointLight: vo, + PointLightHelper: rl, + Points: Er, + PointsMaterial: on, + PolarGridHelper: cl, + PolyhedronGeometry: We, + PositionalAudio: Oh, + PropertyBinding: J, + PropertyMixer: Po, + QuadraticBezierCurve: ln, + QuadraticBezierCurve3: cn, + Quaternion: bt, + QuaternionKeyframeTrack: xi, + QuaternionLinearInterpolant: go, + RED_GREEN_RGTC2_Format: Wc, + RED_RGTC1_Format: Lc, + REVISION: vl, + RGBADepthPacking: Wp, + RGBAFormat: Li, + RGBAIntegerFormat: uc, + RGBA_ASTC_10x10_Format: kc, + RGBA_ASTC_10x5_Format: Bc, + RGBA_ASTC_10x6_Format: Ec, + RGBA_ASTC_10x8_Format: Rc, + RGBA_ASTC_12x10_Format: Pc, + RGBA_ASTC_12x12_Format: Oc, + RGBA_ASTC_4x4_Format: vc, + RGBA_ASTC_5x4_Format: Ac, + RGBA_ASTC_5x5_Format: Sc, + RGBA_ASTC_6x5_Format: Tc, + RGBA_ASTC_6x6_Format: Ic, + RGBA_ASTC_8x5_Format: Cc, + RGBA_ASTC_8x6_Format: zc, + RGBA_ASTC_8x8_Format: Fc, + RGBA_BPTC_Format: Nc, + RGBA_ETC2_EAC_Format: _c, + RGBA_PVRTC_2BPPV1_Format: bc, + RGBA_PVRTC_4BPPV1_Format: xc, + RGBA_S3TC_DXT1_Format: pc, + RGBA_S3TC_DXT3_Format: fc, + RGBA_S3TC_DXT5_Format: mc, + RGBDepthPacking: Hp, + RGBFormat: oc, + RGBIntegerFormat: Vp, + RGB_BPTC_SIGNED_Format: Vc, + RGB_BPTC_UNSIGNED_Format: Dc, + RGB_ETC1_Format: wc, + RGB_ETC2_Format: Mc, + RGB_PVRTC_2BPPV1_Format: gc, + RGB_PVRTC_4BPPV1_Format: yc, + RGB_S3TC_DXT1_Format: dc, + RGDepthPacking: qp, + RGFormat: lc, + RGIntegerFormat: cc, + RawShaderMaterial: so, + Ray: Le, + Raycaster: Jh, + RectAreaLight: Io, + RedFormat: Tl, + RedIntegerFormat: Il, + ReinhardToneMapping: Cp, + RenderTarget: Wi, + RenderTarget3D: Lh, + RenderTargetArray: Uh, + RepeatWrapping: pr, + ReplaceStencilOp: Jp, + ReverseSubtractEquation: ep, + RingGeometry: Yr, + SIGNED_RED_GREEN_RGTC2_Format: Hc, + SIGNED_RED_RGTC1_Format: Uc, + SRGBColorSpace: Bt, + SRGBTransfer: Fn, + Scene: _r, + ShaderChunk: Pe1, + ShaderLib: gt1, + ShaderMaterial: qi, + ShadowMaterial: io, + Shape: Me, + ShapeGeometry: $r, + ShapePath: Ml, + ShapeUtils: he, + ShortType: Ql, + Skeleton: Tr, + SkeletonHelper: nl, + SkinnedMesh: Sr, + Source: be, + Sphere: ht, + SphereGeometry: mn, + Spherical: Yh, + SphericalHarmonics3: Co, + SplineCurve: un, + SpotLight: Mo, + SpotLightHelper: sl, + Sprite: vr, + SpriteMaterial: tn, + SrcAlphaFactor: sa, + SrcAlphaSaturateFactor: dp, + SrcColorFactor: op, + StaticCopyUsage: wf, + StaticDrawUsage: Js, + StaticReadUsage: gf, + StereoCamera: Fh, + StreamCopyUsage: _f, + StreamDrawUsage: yf, + StreamReadUsage: bf, + StringKeyframeTrack: Ae, + SubtractEquation: tp, + SubtractiveBlending: Qd, + TOUCH: Ld, + TangentSpaceNormalMap: _i, + TetrahedronGeometry: Qr, + Texture: lt, + TextureLoader: bh, + TextureUtils: Of, + TimestampQuery: Sf, + TorusGeometry: jr, + TorusKnotGeometry: Kr, + Triangle: ne, + TriangleFanDrawMode: Up, + TriangleStripDrawMode: Lp, + TrianglesDrawMode: Dp, + TubeGeometry: to, + UVMapping: Lo, + Uint16BufferAttribute: gr, + Uint32BufferAttribute: xr, + Uint8BufferAttribute: Ia, + Uint8ClampedBufferAttribute: Ca, + Uniform: Wh, + UniformsGroup: Hh, + UniformsLib: ee1, + UniformsUtils: kf, + UnsignedByteType: Sl, + UnsignedInt248Type: sc, + UnsignedInt5999Type: nc, + UnsignedIntType: Wo, + UnsignedShort4444Type: ec, + UnsignedShort5551Type: ic, + UnsignedShortType: jl, + VSMShadowMap: Zd, + Vector2: T, + Vector3: w, + Vector4: ot, + VectorKeyframeTrack: bi, + VideoFrameTexture: sh, + VideoTexture: Rr, + WebGL3DRenderTarget: ya, + WebGLArrayRenderTarget: ma, + WebGLCoordinateSystem: oe, + WebGLCubeRenderTarget: Na, + WebGLRenderTarget: Hi, + WebGLRenderer: cr1, + WebGLUtils: yf1, + WebGPUCoordinateSystem: Zs, + WebXRController: Va, + WireframeGeometry: eo, + WrapAroundEnding: Xs, + ZeroCurvatureEnding: hi, + ZeroFactor: np, + ZeroSlopeEnding: li, + ZeroStencilOp: Xp, + createCanvasElement: If }; function getWebGLErrorMessage() { return getErrorMessage(1); @@ -20277,18 +21489,18 @@ const _startEvent = { const _endEvent = { type: "end" }; -const _ray = new hi(); -const _plane = new mn(); -const TILT_LIMIT = Math.cos(70 * yv.DEG2RAD); -class OrbitControls extends sn { +const _ray = new Le(); +const _plane = new xe(); +const TILT_LIMIT = Math.cos(70 * Tf.DEG2RAD); +class OrbitControls extends qt { constructor(object, domElement, allow_update, is_in_scene){ super(); this.object = object; this.domElement = domElement; this.domElement.style.touchAction = "none"; this.enabled = true; - this.target = new A(); - this.cursor = new A(); + this.target = new w(); + this.cursor = new w(); this.minDistance = 0; this.maxDistance = Infinity; this.minZoom = 0; @@ -20319,13 +21531,13 @@ class OrbitControls extends sn { BOTTOM: "ArrowDown" }; this.mouseButtons = { - LEFT: zx.ROTATE, - MIDDLE: zx.DOLLY, - RIGHT: zx.PAN + LEFT: Dd.ROTATE, + MIDDLE: Dd.DOLLY, + RIGHT: Dd.PAN }; this.touches = { - ONE: Vx.ROTATE, - TWO: Vx.DOLLY_PAN + ONE: Ld.ROTATE, + TWO: Ld.DOLLY_PAN }; this.target0 = this.target.clone(); this.position0 = this.object.position.clone(); @@ -20363,12 +21575,12 @@ class OrbitControls extends sn { state = STATE.NONE; }; this.update = function() { - const offset = new A(); - const quat = new Ut().setFromUnitVectors(object.up, new A(0, 1, 0)); + const offset = new w(); + const quat = new bt().setFromUnitVectors(object.up, new w(0, 1, 0)); const quatInverse = quat.clone().invert(); - const lastPosition = new A(); - const lastQuaternion = new Ut(); - const lastTargetPosition = new A(); + const lastPosition = new w(); + const lastQuaternion = new bt(); + const lastTargetPosition = new w(); const twoPI = 2 * Math.PI; return function update(deltaTime = null) { if (!allow_update()) { @@ -20438,12 +21650,12 @@ class OrbitControls extends sn { scope.object.position.addScaledVector(dollyDirection, radiusDelta); scope.object.updateMatrixWorld(); } else if (scope.object.isOrthographicCamera) { - const mouseBefore = new A(mouse.x, mouse.y, 0); + const mouseBefore = new w(mouse.x, mouse.y, 0); mouseBefore.unproject(scope.object); scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale)); scope.object.updateProjectionMatrix(); zoomChanged = true; - const mouseAfter = new A(mouse.x, mouse.y, 0); + const mouseAfter = new w(mouse.x, mouse.y, 0); mouseAfter.unproject(scope.object); scope.object.position.sub(mouseAfter).add(mouseBefore); scope.object.updateMatrixWorld(); @@ -20509,21 +21721,21 @@ class OrbitControls extends sn { }; let state = STATE.NONE; const EPS = 0.000001; - const spherical = new Ou(); - const sphericalDelta = new Ou(); + const spherical = new Yh(); + const sphericalDelta = new Yh(); let scale = 1; - const panOffset = new A(); - const rotateStart = new Z(); - const rotateEnd = new Z(); - const rotateDelta = new Z(); - const panStart = new Z(); - const panEnd = new Z(); - const panDelta = new Z(); - const dollyStart = new Z(); - const dollyEnd = new Z(); - const dollyDelta = new Z(); - const dollyDirection = new A(); - const mouse = new Z(); + const panOffset = new w(); + const rotateStart = new T(); + const rotateEnd = new T(); + const rotateDelta = new T(); + const panStart = new T(); + const panEnd = new T(); + const panDelta = new T(); + const dollyStart = new T(); + const dollyEnd = new T(); + const dollyDelta = new T(); + const dollyDirection = new w(); + const mouse = new T(); let performCursorZoom = false; const pointers = []; const pointerPositions = {}; @@ -20544,7 +21756,7 @@ class OrbitControls extends sn { sphericalDelta.phi -= angle; } const panLeft = function() { - const v = new A(); + const v = new w(); return function panLeft(distance, objectMatrix) { v.setFromMatrixColumn(objectMatrix, 0); v.multiplyScalar(-distance); @@ -20552,7 +21764,7 @@ class OrbitControls extends sn { }; }(); const panUp = function() { - const v = new A(); + const v = new w(); return function panUp(distance, objectMatrix) { if (scope.screenSpacePanning === true) { v.setFromMatrixColumn(objectMatrix, 1); @@ -20565,7 +21777,7 @@ class OrbitControls extends sn { }; }(); const pan = function() { - const offset = new A(); + const offset = new w(); return function pan(deltaX, deltaY) { const element = scope.domElement; if (scope.object.isPerspectiveCamera) { @@ -20831,12 +22043,12 @@ class OrbitControls extends sn { mouseAction = -1; } switch(mouseAction){ - case zx.DOLLY: + case Dd.DOLLY: if (scope.enableZoom === false) return; handleMouseDownDolly(event); state = STATE.DOLLY; break; - case zx.ROTATE: + case Dd.ROTATE: if (event.ctrlKey || event.metaKey || event.shiftKey) { if (scope.enablePan === false) return; handleMouseDownPan(event); @@ -20847,7 +22059,7 @@ class OrbitControls extends sn { state = STATE.ROTATE; } break; - case zx.PAN: + case Dd.PAN: if (event.ctrlKey || event.metaKey || event.shiftKey) { if (scope.enableRotate === false) return; handleMouseDownRotate(event); @@ -20897,12 +22109,12 @@ class OrbitControls extends sn { switch(pointers.length){ case 1: switch(scope.touches.ONE){ - case Vx.ROTATE: + case Ld.ROTATE: if (scope.enableRotate === false) return; handleTouchStartRotate(); state = STATE.TOUCH_ROTATE; break; - case Vx.PAN: + case Ld.PAN: if (scope.enablePan === false) return; handleTouchStartPan(); state = STATE.TOUCH_PAN; @@ -20913,12 +22125,12 @@ class OrbitControls extends sn { break; case 2: switch(scope.touches.TWO){ - case Vx.DOLLY_PAN: + case Ld.DOLLY_PAN: if (scope.enableZoom === false && scope.enablePan === false) return; handleTouchStartDollyPan(); state = STATE.TOUCH_DOLLY_PAN; break; - case Vx.DOLLY_ROTATE: + case Ld.DOLLY_ROTATE: if (scope.enableZoom === false && scope.enableRotate === false) return; handleTouchStartDollyRotate(); state = STATE.TOUCH_DOLLY_ROTATE; @@ -20980,7 +22192,7 @@ class OrbitControls extends sn { function trackPointer(event) { let position = pointerPositions[event.pointerId]; if (position === undefined) { - position = new Z(); + position = new T(); pointerPositions[event.pointerId] = position; } position.set(event.pageX, event.pageY); @@ -21009,7 +22221,7 @@ function events2unitless(screen, event) { ]; } function Identity4x4() { - return new ze(); + return new D(); } function in_scene(scene, mouse_event) { const [x1, y1] = events2unitless(scene.screen, mouse_event); @@ -21020,10 +22232,10 @@ function attach_3d_camera(canvas, makie_camera, cam3d, light_dir, scene) { if (cam3d === undefined) { return; } - const [w, h] = makie_camera.resolution.value; - const camera = new yt(cam3d.fov.value, w / h, 0.01, 100.0); - const center = new A(...cam3d.lookat.value); - camera.up = new A(0, 0, 1); + const [w1, h] = makie_camera.resolution.value; + const camera = new vt(cam3d.fov.value, w1 / h, 0.01, 100.0); + const center = new w(...cam3d.lookat.value); + camera.up = new w(0, 0, 1); camera.position.set(...cam3d.eyeposition.value); camera.lookAt(center); const use_orbit_cam = ()=>!(Bonito.can_send_to_julia && Bonito.can_send_to_julia()); @@ -21122,19 +22334,19 @@ function relative_space() { } class MakieCamera { constructor(){ - this.view = new Pu(Identity4x4()); - this.projection = new Pu(Identity4x4()); - this.projectionview = new Pu(Identity4x4()); - this.pixel_space = new Pu(Identity4x4()); - this.pixel_space_inverse = new Pu(Identity4x4()); - this.projectionview_inverse = new Pu(Identity4x4()); - this.relative_space = new Pu(relative_space()); - this.relative_inverse = new Pu(relative_space().invert()); - this.clip_space = new Pu(Identity4x4()); - this.resolution = new Pu(new Z()); - this.eyeposition = new Pu(new A()); + this.view = new Wh(Identity4x4()); + this.projection = new Wh(Identity4x4()); + this.projectionview = new Wh(Identity4x4()); + this.pixel_space = new Wh(Identity4x4()); + this.pixel_space_inverse = new Wh(Identity4x4()); + this.projectionview_inverse = new Wh(Identity4x4()); + this.relative_space = new Wh(relative_space()); + this.relative_inverse = new Wh(relative_space().invert()); + this.clip_space = new Wh(Identity4x4()); + this.resolution = new Wh(new T()); + this.eyeposition = new Wh(new w()); this.preprojections = {}; - this.light_direction = new Pu(new A(-1, -1, -1).normalize()); + this.light_direction = new Wh(new w(-1, -1, -1).normalize()); } calculate_matrices() { const [w, h] = this.resolution.value; @@ -21158,8 +22370,8 @@ class MakieCamera { return; } update_light_dir(light_dir) { - const T = new He().setFromMatrix4(this.view.value).invert(); - const new_dir = new A().fromArray(light_dir); + const T = new Gt().setFromMatrix4(this.view.value).invert(); + const new_dir = new w().fromArray(light_dir); new_dir.applyMatrix3(T).normalize(); this.light_direction.value = new_dir; } @@ -21204,7 +22416,7 @@ class MakieCamera { return matrix_uniform; } else { const matrix = this.calculate_preprojection_matrix(space, markerspace); - const uniform = new Pu(matrix); + const uniform = new Wh(matrix); this.preprojections[key] = uniform; return uniform; } diff --git a/WGLMakie/src/wglmakie.js b/WGLMakie/src/wglmakie.js index 3f0526eaea8..6a44285aa9d 100644 --- a/WGLMakie/src/wglmakie.js +++ b/WGLMakie/src/wglmakie.js @@ -1,4 +1,4 @@ -import * as THREE from "./THREE.js"; +import * as THREE from "https://cdn.esm.sh/v66/three@0.173/es2021/three.js"; import { getWebGLErrorMessage } from "./WEBGL.js"; import { delete_scenes,