N-vh?a-N+vh:0),T=4*(this._cubeSize-k);eg(n,A,T,3*k,2*k),c.setRenderTarget(n),c.render(h,sy)}};function Jve(t){const e=[],n=[],r=[];let a=t;const s=t-vh+1+N8.length;for(let o=0;ot-vh?c=N8[o-t+vh-1]:o===0&&(c=0),n.push(c);const u=1/(l-2),d=-u,h=1+u,f=[d,d,h,d,h,h,d,d,h,h,d,h],p=6,x=6,v=3,g=2,y=1,_=new Float32Array(v*x*p),N=new Float32Array(g*x*p),k=new Float32Array(y*x*p);for(let T=0;T2?0:-1,P=[C,j,0,C+2/3,j,0,C+2/3,j+1,0,C,j,0,C+2/3,j+1,0,C,j+1,0];_.set(P,v*x*T),N.set(f,g*x*T);const E=[T,T,T,T,T,T];k.set(E,y*x*T)}const A=new wl;A.setAttribute("position",new Ds(_,v)),A.setAttribute("uv",new Ds(N,g)),A.setAttribute("faceIndex",new Ds(k,y)),r.push(new Sl(A,null)),a>vh&&a--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function A8(t,e,n){const r=new Lf(t,e,n);return r.texture.mapping=tk,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function eg(t,e,n,r,a){t.viewport.set(e,n,r,a),t.scissor.set(e,n,r,a)}function e0e(t,e,n){return new ad({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Qve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:rk(),fragmentShader:`
precision highp float;
precision highp int;
@@ -3895,14 +3895,14 @@ void main() {
`)+`
`+g,y=["#define varying in",n.glslVersion===XB?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===XB?"":"#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(`
`)+`
-`+y);const N=_+g+o,k=_+y+l,A=O8(a,a.VERTEX_SHADER,N),T=O8(a,a.FRAGMENT_SHADER,k);a.attachShader(v,A),a.attachShader(v,T),n.index0AttributeName!==void 0?a.bindAttribLocation(v,0,n.index0AttributeName):n.morphTargets===!0&&a.bindAttribLocation(v,0,"position"),a.linkProgram(v);function C(U){if(t.debug.checkShaderErrors){const O=a.getProgramInfoLog(v)||"",B=a.getShaderInfoLog(A)||"",D=a.getShaderInfoLog(T)||"",$=O.trim(),G=B.trim(),z=D.trim();let W=!0,X=!0;if(a.getProgramParameter(v,a.LINK_STATUS)===!1)if(W=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(a,v,A,T);else{const re=z8(a,A,"vertex"),H=z8(a,T,"fragment");Ua("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(v,a.VALIDATE_STATUS)+`
+`+y);const N=_+g+o,k=_+y+l,A=O8(a,a.VERTEX_SHADER,N),T=O8(a,a.FRAGMENT_SHADER,k);a.attachShader(v,A),a.attachShader(v,T),n.index0AttributeName!==void 0?a.bindAttribLocation(v,0,n.index0AttributeName):n.morphTargets===!0&&a.bindAttribLocation(v,0,"position"),a.linkProgram(v);function C(U){if(t.debug.checkShaderErrors){const O=a.getProgramInfoLog(v)||"",B=a.getShaderInfoLog(A)||"",D=a.getShaderInfoLog(T)||"",$=O.trim(),G=B.trim(),z=D.trim();let W=!0,X=!0;if(a.getProgramParameter(v,a.LINK_STATUS)===!1)if(W=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(a,v,A,T);else{const ae=z8(a,A,"vertex"),H=z8(a,T,"fragment");Ua("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(v,a.VALIDATE_STATUS)+`
Material Name: `+U.name+`
Material Type: `+U.type+`
Program Info Log: `+$+`
-`+re+`
-`+H)}else $!==""?vn("WebGLProgram: Program Info Log:",$):(G===""||z==="")&&(X=!1);X&&(U.diagnostics={runnable:W,programLog:$,vertexShader:{log:G,prefix:g},fragmentShader:{log:z,prefix:y}})}a.deleteShader(A),a.deleteShader(T),j=new X_(a,v),P=lwe(a,v)}let j;this.getUniforms=function(){return j===void 0&&C(this),j};let P;this.getAttributes=function(){return P===void 0&&C(this),P};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=a.getProgramParameter(v,J0e)),E},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=ewe++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=A,this.fragmentShader=T,this}let vwe=0,wwe=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,a=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(a)===!1&&(o.add(a),a.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new Swe(e),n.set(e,r)),r}},Swe=class{constructor(e){this.id=vwe++,this.code=e,this.usedTimes=0}};function _we(t,e,n,r,a,s,o){const l=new XX,c=new wwe,u=new Set,d=[],h=a.logarithmicDepthBuffer,f=a.vertexTextures;let p=a.precision;const x={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 v(P){return u.add(P),P===0?"uv":`uv${P}`}function g(P,E,U,O,B){const D=O.fog,$=B.geometry,G=P.isMeshStandardMaterial?O.environment:null,z=(P.isMeshStandardMaterial?n:e).get(P.envMap||G),W=z&&z.mapping===tk?z.image.height:null,X=x[P.type];P.precision!==null&&(p=a.getMaxPrecision(P.precision),p!==P.precision&&vn("WebGLProgram.getParameters:",P.precision,"not supported, using",p,"instead."));const re=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,H=re!==void 0?re.length:0;let K=0;$.morphAttributes.position!==void 0&&(K=1),$.morphAttributes.normal!==void 0&&(K=2),$.morphAttributes.color!==void 0&&(K=3);let ee,Z,ve,le;if(X){const Dt=wc[X];ee=Dt.vertexShader,Z=Dt.fragmentShader}else ee=P.vertexShader,Z=P.fragmentShader,c.update(P),ve=c.getVertexShaderID(P),le=c.getFragmentShaderID(P);const J=t.getRenderTarget(),je=t.state.buffers.depth.getReversed(),ue=B.isInstancedMesh===!0,se=B.isBatchedMesh===!0,_e=!!P.map,ae=!!P.matcap,Ue=!!z,V=!!P.aoMap,Y=!!P.lightMap,he=!!P.bumpMap,Q=!!P.normalMap,ie=!!P.displacementMap,ce=!!P.emissiveMap,Le=!!P.metalnessMap,Ne=!!P.roughnessMap,ge=P.anisotropy>0,L=P.clearcoat>0,R=P.dispersion>0,q=P.iridescence>0,oe=P.sheen>0,pe=P.transmission>0,fe=ge&&!!P.anisotropyMap,Fe=L&&!!P.clearcoatMap,ze=L&&!!P.clearcoatNormalMap,He=L&&!!P.clearcoatRoughnessMap,Ie=q&&!!P.iridescenceMap,me=q&&!!P.iridescenceThicknessMap,be=oe&&!!P.sheenColorMap,Ce=oe&&!!P.sheenRoughnessMap,xe=!!P.specularMap,we=!!P.specularColorMap,Ge=!!P.specularIntensityMap,Pe=pe&&!!P.transmissionMap,Je=pe&&!!P.thicknessMap,De=!!P.gradientMap,Ke=!!P.alphaMap,ke=P.alphaTest>0,Re=!!P.alphaHash,Ve=!!P.extensions;let ht=Dh;P.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(ht=t.toneMapping);const At={shaderID:X,shaderType:P.type,shaderName:P.name,vertexShader:ee,fragmentShader:Z,defines:P.defines,customVertexShaderID:ve,customFragmentShaderID:le,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:p,batching:se,batchingColor:se&&B._colorsTexture!==null,instancing:ue,instancingColor:ue&&B.instanceColor!==null,instancingMorph:ue&&B.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:J===null?t.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:gb,alphaToCoverage:!!P.alphaToCoverage,map:_e,matcap:ae,envMap:Ue,envMapMode:Ue&&z.mapping,envMapCubeUVHeight:W,aoMap:V,lightMap:Y,bumpMap:he,normalMap:Q,displacementMap:f&&ie,emissiveMap:ce,normalMapObjectSpace:Q&&P.normalMapType===lbe,normalMapTangentSpace:Q&&P.normalMapType===UX,metalnessMap:Le,roughnessMap:Ne,anisotropy:ge,anisotropyMap:fe,clearcoat:L,clearcoatMap:Fe,clearcoatNormalMap:ze,clearcoatRoughnessMap:He,dispersion:R,iridescence:q,iridescenceMap:Ie,iridescenceThicknessMap:me,sheen:oe,sheenColorMap:be,sheenRoughnessMap:Ce,specularMap:xe,specularColorMap:we,specularIntensityMap:Ge,transmission:pe,transmissionMap:Pe,thicknessMap:Je,gradientMap:De,opaque:P.transparent===!1&&P.blending===Yg&&P.alphaToCoverage===!1,alphaMap:Ke,alphaTest:ke,alphaHash:Re,combine:P.combine,mapUv:_e&&v(P.map.channel),aoMapUv:V&&v(P.aoMap.channel),lightMapUv:Y&&v(P.lightMap.channel),bumpMapUv:he&&v(P.bumpMap.channel),normalMapUv:Q&&v(P.normalMap.channel),displacementMapUv:ie&&v(P.displacementMap.channel),emissiveMapUv:ce&&v(P.emissiveMap.channel),metalnessMapUv:Le&&v(P.metalnessMap.channel),roughnessMapUv:Ne&&v(P.roughnessMap.channel),anisotropyMapUv:fe&&v(P.anisotropyMap.channel),clearcoatMapUv:Fe&&v(P.clearcoatMap.channel),clearcoatNormalMapUv:ze&&v(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:He&&v(P.clearcoatRoughnessMap.channel),iridescenceMapUv:Ie&&v(P.iridescenceMap.channel),iridescenceThicknessMapUv:me&&v(P.iridescenceThicknessMap.channel),sheenColorMapUv:be&&v(P.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&v(P.sheenRoughnessMap.channel),specularMapUv:xe&&v(P.specularMap.channel),specularColorMapUv:we&&v(P.specularColorMap.channel),specularIntensityMapUv:Ge&&v(P.specularIntensityMap.channel),transmissionMapUv:Pe&&v(P.transmissionMap.channel),thicknessMapUv:Je&&v(P.thicknessMap.channel),alphaMapUv:Ke&&v(P.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(Q||ge),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!$.attributes.uv&&(_e||Ke),fog:!!D,useFog:P.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:P.flatShading===!0&&P.wireframe===!1,sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:je,skinning:B.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:K,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:P.dithering,shadowMapEnabled:t.shadowMap.enabled&&U.length>0,shadowMapType:t.shadowMap.type,toneMapping:ht,decodeVideoTexture:_e&&P.map.isVideoTexture===!0&&cr.getTransfer(P.map.colorSpace)===Dr,decodeVideoTextureEmissive:ce&&P.emissiveMap.isVideoTexture===!0&&cr.getTransfer(P.emissiveMap.colorSpace)===Dr,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===_c,flipSided:P.side===to,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionClipCullDistance:Ve&&P.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ve&&P.extensions.multiDraw===!0||se)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()};return At.vertexUv1s=u.has(1),At.vertexUv2s=u.has(2),At.vertexUv3s=u.has(3),u.clear(),At}function y(P){const E=[];if(P.shaderID?E.push(P.shaderID):(E.push(P.customVertexShaderID),E.push(P.customFragmentShaderID)),P.defines!==void 0)for(const U in P.defines)E.push(U),E.push(P.defines[U]);return P.isRawShaderMaterial===!1&&(_(E,P),N(E,P),E.push(t.outputColorSpace)),E.push(P.customProgramCacheKey),E.join()}function _(P,E){P.push(E.precision),P.push(E.outputColorSpace),P.push(E.envMapMode),P.push(E.envMapCubeUVHeight),P.push(E.mapUv),P.push(E.alphaMapUv),P.push(E.lightMapUv),P.push(E.aoMapUv),P.push(E.bumpMapUv),P.push(E.normalMapUv),P.push(E.displacementMapUv),P.push(E.emissiveMapUv),P.push(E.metalnessMapUv),P.push(E.roughnessMapUv),P.push(E.anisotropyMapUv),P.push(E.clearcoatMapUv),P.push(E.clearcoatNormalMapUv),P.push(E.clearcoatRoughnessMapUv),P.push(E.iridescenceMapUv),P.push(E.iridescenceThicknessMapUv),P.push(E.sheenColorMapUv),P.push(E.sheenRoughnessMapUv),P.push(E.specularMapUv),P.push(E.specularColorMapUv),P.push(E.specularIntensityMapUv),P.push(E.transmissionMapUv),P.push(E.thicknessMapUv),P.push(E.combine),P.push(E.fogExp2),P.push(E.sizeAttenuation),P.push(E.morphTargetsCount),P.push(E.morphAttributeCount),P.push(E.numDirLights),P.push(E.numPointLights),P.push(E.numSpotLights),P.push(E.numSpotLightMaps),P.push(E.numHemiLights),P.push(E.numRectAreaLights),P.push(E.numDirLightShadows),P.push(E.numPointLightShadows),P.push(E.numSpotLightShadows),P.push(E.numSpotLightShadowsWithMaps),P.push(E.numLightProbes),P.push(E.shadowMapType),P.push(E.toneMapping),P.push(E.numClippingPlanes),P.push(E.numClipIntersection),P.push(E.depthPacking)}function N(P,E){l.disableAll(),E.supportsVertexTextures&&l.enable(0),E.instancing&&l.enable(1),E.instancingColor&&l.enable(2),E.instancingMorph&&l.enable(3),E.matcap&&l.enable(4),E.envMap&&l.enable(5),E.normalMapObjectSpace&&l.enable(6),E.normalMapTangentSpace&&l.enable(7),E.clearcoat&&l.enable(8),E.iridescence&&l.enable(9),E.alphaTest&&l.enable(10),E.vertexColors&&l.enable(11),E.vertexAlphas&&l.enable(12),E.vertexUv1s&&l.enable(13),E.vertexUv2s&&l.enable(14),E.vertexUv3s&&l.enable(15),E.vertexTangents&&l.enable(16),E.anisotropy&&l.enable(17),E.alphaHash&&l.enable(18),E.batching&&l.enable(19),E.dispersion&&l.enable(20),E.batchingColor&&l.enable(21),E.gradientMap&&l.enable(22),P.push(l.mask),l.disableAll(),E.fog&&l.enable(0),E.useFog&&l.enable(1),E.flatShading&&l.enable(2),E.logarithmicDepthBuffer&&l.enable(3),E.reversedDepthBuffer&&l.enable(4),E.skinning&&l.enable(5),E.morphTargets&&l.enable(6),E.morphNormals&&l.enable(7),E.morphColors&&l.enable(8),E.premultipliedAlpha&&l.enable(9),E.shadowMapEnabled&&l.enable(10),E.doubleSided&&l.enable(11),E.flipSided&&l.enable(12),E.useDepthPacking&&l.enable(13),E.dithering&&l.enable(14),E.transmission&&l.enable(15),E.sheen&&l.enable(16),E.opaque&&l.enable(17),E.pointsUvs&&l.enable(18),E.decodeVideoTexture&&l.enable(19),E.decodeVideoTextureEmissive&&l.enable(20),E.alphaToCoverage&&l.enable(21),P.push(l.mask)}function k(P){const E=x[P.type];let U;if(E){const O=wc[E];U=Ibe.clone(O.uniforms)}else U=P.uniforms;return U}function A(P,E){let U;for(let O=0,B=d.length;O0?r.push(y):p.transparent===!0?a.push(y):n.push(y)}function c(h,f,p,x,v,g){const y=o(h,f,p,x,v,g);p.transmission>0?r.unshift(y):p.transparent===!0?a.unshift(y):n.unshift(y)}function u(h,f){n.length>1&&n.sort(h||Cwe),r.length>1&&r.sort(f||V8),a.length>1&&a.sort(f||V8)}function d(){for(let h=e,f=t.length;h=s.length?(o=new q8,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Awe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new ft,color:new $n};break;case"SpotLight":n={position:new ft,direction:new ft,color:new $n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ft,color:new $n,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ft,skyColor:new $n,groundColor:new $n};break;case"RectAreaLight":n={color:new $n,position:new ft,halfWidth:new ft,halfHeight:new ft};break}return t[e.id]=n,n}}}function Mwe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Twe=0;function Pwe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ewe(t){const e=new Awe,n=Mwe(),r={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 u=0;u<9;u++)r.probe.push(new ft);const a=new ft,s=new ni,o=new ni;function l(u){let d=0,h=0,f=0;for(let P=0;P<9;P++)r.probe[P].set(0,0,0);let p=0,x=0,v=0,g=0,y=0,_=0,N=0,k=0,A=0,T=0,C=0;u.sort(Pwe);for(let P=0,E=u.length;P0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Bt.LTC_FLOAT_1,r.rectAreaLTC2=Bt.LTC_FLOAT_2):(r.rectAreaLTC1=Bt.LTC_HALF_1,r.rectAreaLTC2=Bt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=h,r.ambient[2]=f;const j=r.hash;(j.directionalLength!==p||j.pointLength!==x||j.spotLength!==v||j.rectAreaLength!==g||j.hemiLength!==y||j.numDirectionalShadows!==_||j.numPointShadows!==N||j.numSpotShadows!==k||j.numSpotMaps!==A||j.numLightProbes!==C)&&(r.directional.length=p,r.spot.length=v,r.rectArea.length=g,r.point.length=x,r.hemi.length=y,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=N,r.pointShadowMap.length=N,r.spotShadow.length=k,r.spotShadowMap.length=k,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=N,r.spotLightMatrix.length=k+A-T,r.spotLightMap.length=A,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=C,j.directionalLength=p,j.pointLength=x,j.spotLength=v,j.rectAreaLength=g,j.hemiLength=y,j.numDirectionalShadows=_,j.numPointShadows=N,j.numSpotShadows=k,j.numSpotMaps=A,j.numLightProbes=C,r.version=Twe++)}function c(u,d){let h=0,f=0,p=0,x=0,v=0;const g=d.matrixWorldInverse;for(let y=0,_=u.length;y<_;y++){const N=u[y];if(N.isDirectionalLight){const k=r.directional[h];k.direction.setFromMatrixPosition(N.matrixWorld),a.setFromMatrixPosition(N.target.matrixWorld),k.direction.sub(a),k.direction.transformDirection(g),h++}else if(N.isSpotLight){const k=r.spot[p];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),k.direction.setFromMatrixPosition(N.matrixWorld),a.setFromMatrixPosition(N.target.matrixWorld),k.direction.sub(a),k.direction.transformDirection(g),p++}else if(N.isRectAreaLight){const k=r.rectArea[x];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),o.identity(),s.copy(N.matrixWorld),s.premultiply(g),o.extractRotation(s),k.halfWidth.set(N.width*.5,0,0),k.halfHeight.set(0,N.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),x++}else if(N.isPointLight){const k=r.point[f];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),f++}else if(N.isHemisphereLight){const k=r.hemi[v];k.direction.setFromMatrixPosition(N.matrixWorld),k.direction.transformDirection(g),v++}}}return{setup:l,setupView:c,state:r}}function G8(t){const e=new Ewe(t),n=[],r=[];function a(d){u.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function l(){e.setup(n)}function c(d){e.setupView(n,d)}const u={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:u,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function jwe(t){let e=new WeakMap;function n(a,s=0){const o=e.get(a);let l;return o===void 0?(l=new G8(t),e.set(a,[l])):s>=o.length?(l=new G8(t),o.push(l)):l=o[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}const Dwe=`void main() {
+`+ae+`
+`+H)}else $!==""?vn("WebGLProgram: Program Info Log:",$):(G===""||z==="")&&(X=!1);X&&(U.diagnostics={runnable:W,programLog:$,vertexShader:{log:G,prefix:g},fragmentShader:{log:z,prefix:y}})}a.deleteShader(A),a.deleteShader(T),j=new X_(a,v),P=lwe(a,v)}let j;this.getUniforms=function(){return j===void 0&&C(this),j};let P;this.getAttributes=function(){return P===void 0&&C(this),P};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=a.getProgramParameter(v,J0e)),E},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=ewe++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=A,this.fragmentShader=T,this}let vwe=0,wwe=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,a=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(a)===!1&&(o.add(a),a.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new Swe(e),n.set(e,r)),r}},Swe=class{constructor(e){this.id=vwe++,this.code=e,this.usedTimes=0}};function _we(t,e,n,r,a,s,o){const l=new XX,c=new wwe,u=new Set,d=[],h=a.logarithmicDepthBuffer,f=a.vertexTextures;let p=a.precision;const x={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 v(P){return u.add(P),P===0?"uv":`uv${P}`}function g(P,E,U,O,B){const D=O.fog,$=B.geometry,G=P.isMeshStandardMaterial?O.environment:null,z=(P.isMeshStandardMaterial?n:e).get(P.envMap||G),W=z&&z.mapping===tk?z.image.height:null,X=x[P.type];P.precision!==null&&(p=a.getMaxPrecision(P.precision),p!==P.precision&&vn("WebGLProgram.getParameters:",P.precision,"not supported, using",p,"instead."));const ae=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,H=ae!==void 0?ae.length:0;let K=0;$.morphAttributes.position!==void 0&&(K=1),$.morphAttributes.normal!==void 0&&(K=2),$.morphAttributes.color!==void 0&&(K=3);let ee,Z,ve,ce;if(X){const Dt=wc[X];ee=Dt.vertexShader,Z=Dt.fragmentShader}else ee=P.vertexShader,Z=P.fragmentShader,c.update(P),ve=c.getVertexShaderID(P),ce=c.getFragmentShaderID(P);const J=t.getRenderTarget(),je=t.state.buffers.depth.getReversed(),he=B.isInstancedMesh===!0,oe=B.isBatchedMesh===!0,_e=!!P.map,se=!!P.matcap,ze=!!z,V=!!P.aoMap,Y=!!P.lightMap,me=!!P.bumpMap,Q=!!P.normalMap,ie=!!P.displacementMap,ue=!!P.emissiveMap,Oe=!!P.metalnessMap,Ce=!!P.roughnessMap,ge=P.anisotropy>0,L=P.clearcoat>0,R=P.dispersion>0,q=P.iridescence>0,le=P.sheen>0,fe=P.transmission>0,te=ge&&!!P.anisotropyMap,Ue=L&&!!P.clearcoatMap,Ie=L&&!!P.clearcoatNormalMap,$e=L&&!!P.clearcoatRoughnessMap,Fe=q&&!!P.iridescenceMap,pe=q&&!!P.iridescenceThicknessMap,xe=le&&!!P.sheenColorMap,Ne=le&&!!P.sheenRoughnessMap,be=!!P.specularMap,we=!!P.specularColorMap,Ge=!!P.specularIntensityMap,ke=fe&&!!P.transmissionMap,tt=fe&&!!P.thicknessMap,De=!!P.gradientMap,Ke=!!P.alphaMap,Ae=P.alphaTest>0,Re=!!P.alphaHash,Ve=!!P.extensions;let ht=Dh;P.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(ht=t.toneMapping);const At={shaderID:X,shaderType:P.type,shaderName:P.name,vertexShader:ee,fragmentShader:Z,defines:P.defines,customVertexShaderID:ve,customFragmentShaderID:ce,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:p,batching:oe,batchingColor:oe&&B._colorsTexture!==null,instancing:he,instancingColor:he&&B.instanceColor!==null,instancingMorph:he&&B.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:J===null?t.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:gb,alphaToCoverage:!!P.alphaToCoverage,map:_e,matcap:se,envMap:ze,envMapMode:ze&&z.mapping,envMapCubeUVHeight:W,aoMap:V,lightMap:Y,bumpMap:me,normalMap:Q,displacementMap:f&&ie,emissiveMap:ue,normalMapObjectSpace:Q&&P.normalMapType===lbe,normalMapTangentSpace:Q&&P.normalMapType===UX,metalnessMap:Oe,roughnessMap:Ce,anisotropy:ge,anisotropyMap:te,clearcoat:L,clearcoatMap:Ue,clearcoatNormalMap:Ie,clearcoatRoughnessMap:$e,dispersion:R,iridescence:q,iridescenceMap:Fe,iridescenceThicknessMap:pe,sheen:le,sheenColorMap:xe,sheenRoughnessMap:Ne,specularMap:be,specularColorMap:we,specularIntensityMap:Ge,transmission:fe,transmissionMap:ke,thicknessMap:tt,gradientMap:De,opaque:P.transparent===!1&&P.blending===Yg&&P.alphaToCoverage===!1,alphaMap:Ke,alphaTest:Ae,alphaHash:Re,combine:P.combine,mapUv:_e&&v(P.map.channel),aoMapUv:V&&v(P.aoMap.channel),lightMapUv:Y&&v(P.lightMap.channel),bumpMapUv:me&&v(P.bumpMap.channel),normalMapUv:Q&&v(P.normalMap.channel),displacementMapUv:ie&&v(P.displacementMap.channel),emissiveMapUv:ue&&v(P.emissiveMap.channel),metalnessMapUv:Oe&&v(P.metalnessMap.channel),roughnessMapUv:Ce&&v(P.roughnessMap.channel),anisotropyMapUv:te&&v(P.anisotropyMap.channel),clearcoatMapUv:Ue&&v(P.clearcoatMap.channel),clearcoatNormalMapUv:Ie&&v(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$e&&v(P.clearcoatRoughnessMap.channel),iridescenceMapUv:Fe&&v(P.iridescenceMap.channel),iridescenceThicknessMapUv:pe&&v(P.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&v(P.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&v(P.sheenRoughnessMap.channel),specularMapUv:be&&v(P.specularMap.channel),specularColorMapUv:we&&v(P.specularColorMap.channel),specularIntensityMapUv:Ge&&v(P.specularIntensityMap.channel),transmissionMapUv:ke&&v(P.transmissionMap.channel),thicknessMapUv:tt&&v(P.thicknessMap.channel),alphaMapUv:Ke&&v(P.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(Q||ge),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!$.attributes.uv&&(_e||Ke),fog:!!D,useFog:P.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:P.flatShading===!0&&P.wireframe===!1,sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:je,skinning:B.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:K,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:P.dithering,shadowMapEnabled:t.shadowMap.enabled&&U.length>0,shadowMapType:t.shadowMap.type,toneMapping:ht,decodeVideoTexture:_e&&P.map.isVideoTexture===!0&&cr.getTransfer(P.map.colorSpace)===Dr,decodeVideoTextureEmissive:ue&&P.emissiveMap.isVideoTexture===!0&&cr.getTransfer(P.emissiveMap.colorSpace)===Dr,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===_c,flipSided:P.side===to,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionClipCullDistance:Ve&&P.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ve&&P.extensions.multiDraw===!0||oe)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()};return At.vertexUv1s=u.has(1),At.vertexUv2s=u.has(2),At.vertexUv3s=u.has(3),u.clear(),At}function y(P){const E=[];if(P.shaderID?E.push(P.shaderID):(E.push(P.customVertexShaderID),E.push(P.customFragmentShaderID)),P.defines!==void 0)for(const U in P.defines)E.push(U),E.push(P.defines[U]);return P.isRawShaderMaterial===!1&&(_(E,P),N(E,P),E.push(t.outputColorSpace)),E.push(P.customProgramCacheKey),E.join()}function _(P,E){P.push(E.precision),P.push(E.outputColorSpace),P.push(E.envMapMode),P.push(E.envMapCubeUVHeight),P.push(E.mapUv),P.push(E.alphaMapUv),P.push(E.lightMapUv),P.push(E.aoMapUv),P.push(E.bumpMapUv),P.push(E.normalMapUv),P.push(E.displacementMapUv),P.push(E.emissiveMapUv),P.push(E.metalnessMapUv),P.push(E.roughnessMapUv),P.push(E.anisotropyMapUv),P.push(E.clearcoatMapUv),P.push(E.clearcoatNormalMapUv),P.push(E.clearcoatRoughnessMapUv),P.push(E.iridescenceMapUv),P.push(E.iridescenceThicknessMapUv),P.push(E.sheenColorMapUv),P.push(E.sheenRoughnessMapUv),P.push(E.specularMapUv),P.push(E.specularColorMapUv),P.push(E.specularIntensityMapUv),P.push(E.transmissionMapUv),P.push(E.thicknessMapUv),P.push(E.combine),P.push(E.fogExp2),P.push(E.sizeAttenuation),P.push(E.morphTargetsCount),P.push(E.morphAttributeCount),P.push(E.numDirLights),P.push(E.numPointLights),P.push(E.numSpotLights),P.push(E.numSpotLightMaps),P.push(E.numHemiLights),P.push(E.numRectAreaLights),P.push(E.numDirLightShadows),P.push(E.numPointLightShadows),P.push(E.numSpotLightShadows),P.push(E.numSpotLightShadowsWithMaps),P.push(E.numLightProbes),P.push(E.shadowMapType),P.push(E.toneMapping),P.push(E.numClippingPlanes),P.push(E.numClipIntersection),P.push(E.depthPacking)}function N(P,E){l.disableAll(),E.supportsVertexTextures&&l.enable(0),E.instancing&&l.enable(1),E.instancingColor&&l.enable(2),E.instancingMorph&&l.enable(3),E.matcap&&l.enable(4),E.envMap&&l.enable(5),E.normalMapObjectSpace&&l.enable(6),E.normalMapTangentSpace&&l.enable(7),E.clearcoat&&l.enable(8),E.iridescence&&l.enable(9),E.alphaTest&&l.enable(10),E.vertexColors&&l.enable(11),E.vertexAlphas&&l.enable(12),E.vertexUv1s&&l.enable(13),E.vertexUv2s&&l.enable(14),E.vertexUv3s&&l.enable(15),E.vertexTangents&&l.enable(16),E.anisotropy&&l.enable(17),E.alphaHash&&l.enable(18),E.batching&&l.enable(19),E.dispersion&&l.enable(20),E.batchingColor&&l.enable(21),E.gradientMap&&l.enable(22),P.push(l.mask),l.disableAll(),E.fog&&l.enable(0),E.useFog&&l.enable(1),E.flatShading&&l.enable(2),E.logarithmicDepthBuffer&&l.enable(3),E.reversedDepthBuffer&&l.enable(4),E.skinning&&l.enable(5),E.morphTargets&&l.enable(6),E.morphNormals&&l.enable(7),E.morphColors&&l.enable(8),E.premultipliedAlpha&&l.enable(9),E.shadowMapEnabled&&l.enable(10),E.doubleSided&&l.enable(11),E.flipSided&&l.enable(12),E.useDepthPacking&&l.enable(13),E.dithering&&l.enable(14),E.transmission&&l.enable(15),E.sheen&&l.enable(16),E.opaque&&l.enable(17),E.pointsUvs&&l.enable(18),E.decodeVideoTexture&&l.enable(19),E.decodeVideoTextureEmissive&&l.enable(20),E.alphaToCoverage&&l.enable(21),P.push(l.mask)}function k(P){const E=x[P.type];let U;if(E){const O=wc[E];U=Ibe.clone(O.uniforms)}else U=P.uniforms;return U}function A(P,E){let U;for(let O=0,B=d.length;O0?r.push(y):p.transparent===!0?a.push(y):n.push(y)}function c(h,f,p,x,v,g){const y=o(h,f,p,x,v,g);p.transmission>0?r.unshift(y):p.transparent===!0?a.unshift(y):n.unshift(y)}function u(h,f){n.length>1&&n.sort(h||Cwe),r.length>1&&r.sort(f||V8),a.length>1&&a.sort(f||V8)}function d(){for(let h=e,f=t.length;h=s.length?(o=new q8,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Awe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new ft,color:new $n};break;case"SpotLight":n={position:new ft,direction:new ft,color:new $n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ft,color:new $n,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ft,skyColor:new $n,groundColor:new $n};break;case"RectAreaLight":n={color:new $n,position:new ft,halfWidth:new ft,halfHeight:new ft};break}return t[e.id]=n,n}}}function Mwe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Un,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Twe=0;function Pwe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ewe(t){const e=new Awe,n=Mwe(),r={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 u=0;u<9;u++)r.probe.push(new ft);const a=new ft,s=new ni,o=new ni;function l(u){let d=0,h=0,f=0;for(let P=0;P<9;P++)r.probe[P].set(0,0,0);let p=0,x=0,v=0,g=0,y=0,_=0,N=0,k=0,A=0,T=0,C=0;u.sort(Pwe);for(let P=0,E=u.length;P0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Bt.LTC_FLOAT_1,r.rectAreaLTC2=Bt.LTC_FLOAT_2):(r.rectAreaLTC1=Bt.LTC_HALF_1,r.rectAreaLTC2=Bt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=h,r.ambient[2]=f;const j=r.hash;(j.directionalLength!==p||j.pointLength!==x||j.spotLength!==v||j.rectAreaLength!==g||j.hemiLength!==y||j.numDirectionalShadows!==_||j.numPointShadows!==N||j.numSpotShadows!==k||j.numSpotMaps!==A||j.numLightProbes!==C)&&(r.directional.length=p,r.spot.length=v,r.rectArea.length=g,r.point.length=x,r.hemi.length=y,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=N,r.pointShadowMap.length=N,r.spotShadow.length=k,r.spotShadowMap.length=k,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=N,r.spotLightMatrix.length=k+A-T,r.spotLightMap.length=A,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=C,j.directionalLength=p,j.pointLength=x,j.spotLength=v,j.rectAreaLength=g,j.hemiLength=y,j.numDirectionalShadows=_,j.numPointShadows=N,j.numSpotShadows=k,j.numSpotMaps=A,j.numLightProbes=C,r.version=Twe++)}function c(u,d){let h=0,f=0,p=0,x=0,v=0;const g=d.matrixWorldInverse;for(let y=0,_=u.length;y<_;y++){const N=u[y];if(N.isDirectionalLight){const k=r.directional[h];k.direction.setFromMatrixPosition(N.matrixWorld),a.setFromMatrixPosition(N.target.matrixWorld),k.direction.sub(a),k.direction.transformDirection(g),h++}else if(N.isSpotLight){const k=r.spot[p];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),k.direction.setFromMatrixPosition(N.matrixWorld),a.setFromMatrixPosition(N.target.matrixWorld),k.direction.sub(a),k.direction.transformDirection(g),p++}else if(N.isRectAreaLight){const k=r.rectArea[x];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),o.identity(),s.copy(N.matrixWorld),s.premultiply(g),o.extractRotation(s),k.halfWidth.set(N.width*.5,0,0),k.halfHeight.set(0,N.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),x++}else if(N.isPointLight){const k=r.point[f];k.position.setFromMatrixPosition(N.matrixWorld),k.position.applyMatrix4(g),f++}else if(N.isHemisphereLight){const k=r.hemi[v];k.direction.setFromMatrixPosition(N.matrixWorld),k.direction.transformDirection(g),v++}}}return{setup:l,setupView:c,state:r}}function G8(t){const e=new Ewe(t),n=[],r=[];function a(d){u.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function l(){e.setup(n)}function c(d){e.setupView(n,d)}const u={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:u,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function jwe(t){let e=new WeakMap;function n(a,s=0){const o=e.get(a);let l;return o===void 0?(l=new G8(t),e.set(a,[l])):s>=o.length?(l=new G8(t),o.push(l)):l=o[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}const Dwe=`void main() {
gl_Position = vec4( position, 1.0 );
}`,Rwe=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
@@ -3930,7 +3930,7 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
-}`;function Fwe(t,e,n){let r=new GF;const a=new Un,s=new Un,o=new Za,l=new Qbe({depthPacking:obe}),c=new Zbe,u={},d=n.maxTextureSize,h={[qh]:to,[to]:qh,[_c]:_c},f=new ad({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Un},radius:{value:4}},vertexShader:Dwe,fragmentShader:Rwe}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const x=new wl;x.setAttribute("position",new Ds(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Sl(x,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=EX;let y=this.type;this.render=function(T,C,j){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const P=t.getRenderTarget(),E=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),O=t.state;O.setBlending(Vu),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const B=y!==Mu&&this.type===Mu,D=y===Mu&&this.type!==Mu;for(let $=0,G=T.length;$d||a.y>d)&&(a.x>d&&(s.x=Math.floor(d/X.x),a.x=s.x*X.x,W.mapSize.x=s.x),a.y>d&&(s.y=Math.floor(d/X.y),a.y=s.y*X.y,W.mapSize.y=s.y)),W.map===null||B===!0||D===!0){const H=this.type!==Mu?{minFilter:Eo,magFilter:Eo}:{};W.map!==null&&W.map.dispose(),W.map=new Lf(a.x,a.y,H),W.map.texture.name=z.name+".shadowMap",W.camera.updateProjectionMatrix()}t.setRenderTarget(W.map),t.clear();const re=W.getViewportCount();for(let H=0;H0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const O=E.uuid,B=C.uuid;let D=u[O];D===void 0&&(D={},u[O]=D);let $=D[B];$===void 0&&($=E.clone(),D[B]=$,C.addEventListener("dispose",A)),E=$}if(E.visible=C.visible,E.wireframe=C.wireframe,P===Mu?E.side=C.shadowSide!==null?C.shadowSide:C.side:E.side=C.shadowSide!==null?C.shadowSide:h[C.side],E.alphaMap=C.alphaMap,E.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,E.map=C.map,E.clipShadows=C.clipShadows,E.clippingPlanes=C.clippingPlanes,E.clipIntersection=C.clipIntersection,E.displacementMap=C.displacementMap,E.displacementScale=C.displacementScale,E.displacementBias=C.displacementBias,E.wireframeLinewidth=C.wireframeLinewidth,E.linewidth=C.linewidth,j.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const O=t.properties.get(E);O.light=j}return E}function k(T,C,j,P,E){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&E===Mu)&&(!T.frustumCulled||r.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,T.matrixWorld);const B=e.update(T),D=T.material;if(Array.isArray(D)){const $=B.groups;for(let G=0,z=$.length;G=1):W.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),G=z>=2);let X=null,re={};const H=t.getParameter(t.SCISSOR_BOX),K=t.getParameter(t.VIEWPORT),ee=new Za().fromArray(H),Z=new Za().fromArray(K);function ve(Pe,Je,De,Ke){const ke=new Uint8Array(4),Re=t.createTexture();t.bindTexture(Pe,Re),t.texParameteri(Pe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Pe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ve=0;Ve"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new Un,d=new WeakMap;let h;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(L,R){return p?new OffscreenCanvas(L,R):A1("canvas")}function v(L,R,q){let oe=1;const pe=ge(L);if((pe.width>q||pe.height>q)&&(oe=q/Math.max(pe.width,pe.height)),oe<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const fe=Math.floor(oe*pe.width),Fe=Math.floor(oe*pe.height);h===void 0&&(h=x(fe,Fe));const ze=R?x(fe,Fe):h;return ze.width=fe,ze.height=Fe,ze.getContext("2d").drawImage(L,0,0,fe,Fe),vn("WebGLRenderer: Texture has been resized from ("+pe.width+"x"+pe.height+") to ("+fe+"x"+Fe+")."),ze}else return"data"in L&&vn("WebGLRenderer: Image in DataTexture is too big ("+pe.width+"x"+pe.height+")."),L;return L}function g(L){return L.generateMipmaps}function y(L){t.generateMipmap(L)}function _(L){return L.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?t.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function N(L,R,q,oe,pe=!1){if(L!==null){if(t[L]!==void 0)return t[L];vn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let fe=R;if(R===t.RED&&(q===t.FLOAT&&(fe=t.R32F),q===t.HALF_FLOAT&&(fe=t.R16F),q===t.UNSIGNED_BYTE&&(fe=t.R8)),R===t.RED_INTEGER&&(q===t.UNSIGNED_BYTE&&(fe=t.R8UI),q===t.UNSIGNED_SHORT&&(fe=t.R16UI),q===t.UNSIGNED_INT&&(fe=t.R32UI),q===t.BYTE&&(fe=t.R8I),q===t.SHORT&&(fe=t.R16I),q===t.INT&&(fe=t.R32I)),R===t.RG&&(q===t.FLOAT&&(fe=t.RG32F),q===t.HALF_FLOAT&&(fe=t.RG16F),q===t.UNSIGNED_BYTE&&(fe=t.RG8)),R===t.RG_INTEGER&&(q===t.UNSIGNED_BYTE&&(fe=t.RG8UI),q===t.UNSIGNED_SHORT&&(fe=t.RG16UI),q===t.UNSIGNED_INT&&(fe=t.RG32UI),q===t.BYTE&&(fe=t.RG8I),q===t.SHORT&&(fe=t.RG16I),q===t.INT&&(fe=t.RG32I)),R===t.RGB_INTEGER&&(q===t.UNSIGNED_BYTE&&(fe=t.RGB8UI),q===t.UNSIGNED_SHORT&&(fe=t.RGB16UI),q===t.UNSIGNED_INT&&(fe=t.RGB32UI),q===t.BYTE&&(fe=t.RGB8I),q===t.SHORT&&(fe=t.RGB16I),q===t.INT&&(fe=t.RGB32I)),R===t.RGBA_INTEGER&&(q===t.UNSIGNED_BYTE&&(fe=t.RGBA8UI),q===t.UNSIGNED_SHORT&&(fe=t.RGBA16UI),q===t.UNSIGNED_INT&&(fe=t.RGBA32UI),q===t.BYTE&&(fe=t.RGBA8I),q===t.SHORT&&(fe=t.RGBA16I),q===t.INT&&(fe=t.RGBA32I)),R===t.RGB&&(q===t.UNSIGNED_INT_5_9_9_9_REV&&(fe=t.RGB9_E5),q===t.UNSIGNED_INT_10F_11F_11F_REV&&(fe=t.R11F_G11F_B10F)),R===t.RGBA){const Fe=pe?C1:cr.getTransfer(oe);q===t.FLOAT&&(fe=t.RGBA32F),q===t.HALF_FLOAT&&(fe=t.RGBA16F),q===t.UNSIGNED_BYTE&&(fe=Fe===Dr?t.SRGB8_ALPHA8:t.RGBA8),q===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),q===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)}return(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function k(L,R){let q;return L?R===null||R===Rf||R===vv?q=t.DEPTH24_STENCIL8:R===Iu?q=t.DEPTH32F_STENCIL8:R===yv&&(q=t.DEPTH24_STENCIL8,vn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===Rf||R===vv?q=t.DEPTH_COMPONENT24:R===Iu?q=t.DEPTH_COMPONENT32F:R===yv&&(q=t.DEPTH_COMPONENT16),q}function A(L,R){return g(L)===!0||L.isFramebufferTexture&&L.minFilter!==Eo&&L.minFilter!==hl?Math.log2(Math.max(R.width,R.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?R.mipmaps.length:1}function T(L){const R=L.target;R.removeEventListener("dispose",T),j(R),R.isVideoTexture&&d.delete(R)}function C(L){const R=L.target;R.removeEventListener("dispose",C),E(R)}function j(L){const R=r.get(L);if(R.__webglInit===void 0)return;const q=L.source,oe=f.get(q);if(oe){const pe=oe[R.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&P(L),Object.keys(oe).length===0&&f.delete(q)}r.remove(L)}function P(L){const R=r.get(L);t.deleteTexture(R.__webglTexture);const q=L.source,oe=f.get(q);delete oe[R.__cacheKey],o.memory.textures--}function E(L){const R=r.get(L);if(L.depthTexture&&(L.depthTexture.dispose(),r.remove(L.depthTexture)),L.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++){if(Array.isArray(R.__webglFramebuffer[oe]))for(let pe=0;pe=a.maxTextures&&vn("WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+a.maxTextures),U+=1,L}function D(L){const R=[];return R.push(L.wrapS),R.push(L.wrapT),R.push(L.wrapR||0),R.push(L.magFilter),R.push(L.minFilter),R.push(L.anisotropy),R.push(L.internalFormat),R.push(L.format),R.push(L.type),R.push(L.generateMipmaps),R.push(L.premultiplyAlpha),R.push(L.flipY),R.push(L.unpackAlignment),R.push(L.colorSpace),R.join()}function $(L,R){const q=r.get(L);if(L.isVideoTexture&&Le(L),L.isRenderTargetTexture===!1&&L.isExternalTexture!==!0&&L.version>0&&q.__version!==L.version){const oe=L.image;if(oe===null)vn("WebGLRenderer: Texture marked for update but no image data found.");else if(oe.complete===!1)vn("WebGLRenderer: Texture marked for update but image is incomplete");else{le(q,L,R);return}}else L.isExternalTexture&&(q.__webglTexture=L.sourceTexture?L.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,q.__webglTexture,t.TEXTURE0+R)}function G(L,R){const q=r.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&q.__version!==L.version){le(q,L,R);return}else L.isExternalTexture&&(q.__webglTexture=L.sourceTexture?L.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,q.__webglTexture,t.TEXTURE0+R)}function z(L,R){const q=r.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&q.__version!==L.version){le(q,L,R);return}n.bindTexture(t.TEXTURE_3D,q.__webglTexture,t.TEXTURE0+R)}function W(L,R){const q=r.get(L);if(L.version>0&&q.__version!==L.version){J(q,L,R);return}n.bindTexture(t.TEXTURE_CUBE_MAP,q.__webglTexture,t.TEXTURE0+R)}const X={[S3]:t.REPEAT,[Ou]:t.CLAMP_TO_EDGE,[_3]:t.MIRRORED_REPEAT},re={[Eo]:t.NEAREST,[ibe]:t.NEAREST_MIPMAP_NEAREST,[rS]:t.NEAREST_MIPMAP_LINEAR,[hl]:t.LINEAR,[BT]:t.LINEAR_MIPMAP_NEAREST,[ef]:t.LINEAR_MIPMAP_LINEAR},H={[cbe]:t.NEVER,[pbe]:t.ALWAYS,[ube]:t.LESS,[BX]:t.LEQUAL,[dbe]:t.EQUAL,[fbe]:t.GEQUAL,[hbe]:t.GREATER,[mbe]:t.NOTEQUAL};function K(L,R){if(R.type===Iu&&e.has("OES_texture_float_linear")===!1&&(R.magFilter===hl||R.magFilter===BT||R.magFilter===rS||R.magFilter===ef||R.minFilter===hl||R.minFilter===BT||R.minFilter===rS||R.minFilter===ef)&&vn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(L,t.TEXTURE_WRAP_S,X[R.wrapS]),t.texParameteri(L,t.TEXTURE_WRAP_T,X[R.wrapT]),(L===t.TEXTURE_3D||L===t.TEXTURE_2D_ARRAY)&&t.texParameteri(L,t.TEXTURE_WRAP_R,X[R.wrapR]),t.texParameteri(L,t.TEXTURE_MAG_FILTER,re[R.magFilter]),t.texParameteri(L,t.TEXTURE_MIN_FILTER,re[R.minFilter]),R.compareFunction&&(t.texParameteri(L,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(L,t.TEXTURE_COMPARE_FUNC,H[R.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===Eo||R.minFilter!==rS&&R.minFilter!==ef||R.type===Iu&&e.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||r.get(R).__currentAnisotropy){const q=e.get("EXT_texture_filter_anisotropic");t.texParameterf(L,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,a.getMaxAnisotropy())),r.get(R).__currentAnisotropy=R.anisotropy}}}function ee(L,R){let q=!1;L.__webglInit===void 0&&(L.__webglInit=!0,R.addEventListener("dispose",T));const oe=R.source;let pe=f.get(oe);pe===void 0&&(pe={},f.set(oe,pe));const fe=D(R);if(fe!==L.__cacheKey){pe[fe]===void 0&&(pe[fe]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,q=!0),pe[fe].usedTimes++;const Fe=pe[L.__cacheKey];Fe!==void 0&&(pe[L.__cacheKey].usedTimes--,Fe.usedTimes===0&&P(R)),L.__cacheKey=fe,L.__webglTexture=pe[fe].texture}return q}function Z(L,R,q){return Math.floor(Math.floor(L/q)/R)}function ve(L,R,q,oe){const fe=L.updateRanges;if(fe.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,R.width,R.height,q,oe,R.data);else{fe.sort((me,be)=>me.start-be.start);let Fe=0;for(let me=1;me0){Pe&&Je&&n.texStorage2D(t.TEXTURE_2D,Ke,xe,Ge[0].width,Ge[0].height);for(let ke=0,Re=Ge.length;ke0){const Ve=_8(we.width,we.height,R.format,R.type);for(const ht of R.layerUpdates){const At=we.data.subarray(ht*Ve/we.data.BYTES_PER_ELEMENT,(ht+1)*Ve/we.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ke,0,0,ht,we.width,we.height,1,be,At)}R.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ke,0,0,0,we.width,we.height,me.depth,be,we.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ke,xe,we.width,we.height,me.depth,0,we.data,0,0);else vn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Pe?De&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,ke,0,0,0,we.width,we.height,me.depth,be,Ce,we.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ke,xe,we.width,we.height,me.depth,0,be,Ce,we.data)}else{Pe&&Je&&n.texStorage2D(t.TEXTURE_2D,Ke,xe,Ge[0].width,Ge[0].height);for(let ke=0,Re=Ge.length;ke0){const ke=_8(me.width,me.height,R.format,R.type);for(const Re of R.layerUpdates){const Ve=me.data.subarray(Re*ke/me.data.BYTES_PER_ELEMENT,(Re+1)*ke/me.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Re,me.width,me.height,1,be,Ce,Ve)}R.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,me.width,me.height,me.depth,be,Ce,me.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,xe,me.width,me.height,me.depth,0,be,Ce,me.data);else if(R.isData3DTexture)Pe?(Je&&n.texStorage3D(t.TEXTURE_3D,Ke,xe,me.width,me.height,me.depth),De&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,me.width,me.height,me.depth,be,Ce,me.data)):n.texImage3D(t.TEXTURE_3D,0,xe,me.width,me.height,me.depth,0,be,Ce,me.data);else if(R.isFramebufferTexture){if(Je)if(Pe)n.texStorage2D(t.TEXTURE_2D,Ke,xe,me.width,me.height);else{let ke=me.width,Re=me.height;for(let Ve=0;Ve>=1,Re>>=1}}else if(Ge.length>0){if(Pe&&Je){const ke=ge(Ge[0]);n.texStorage2D(t.TEXTURE_2D,Ke,xe,ke.width,ke.height)}for(let ke=0,Re=Ge.length;ke0&&Ke++;const Re=ge(be[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ke,Ge,Re.width,Re.height)}for(let Re=0;Re<6;Re++)if(me){Pe?De&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,0,0,be[Re].width,be[Re].height,xe,we,be[Re].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,Ge,be[Re].width,be[Re].height,0,xe,we,be[Re].data);for(let Ve=0;Ve>fe),Ce=Math.max(1,R.height>>fe);pe===t.TEXTURE_3D||pe===t.TEXTURE_2D_ARRAY?n.texImage3D(pe,fe,He,be,Ce,R.depth,0,Fe,ze,null):n.texImage2D(pe,fe,He,be,Ce,0,Fe,ze,null)}n.bindFramebuffer(t.FRAMEBUFFER,L),ce(R)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,oe,pe,me.__webglTexture,0,ie(R)):(pe===t.TEXTURE_2D||pe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,oe,pe,me.__webglTexture,fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function ue(L,R,q){if(t.bindRenderbuffer(t.RENDERBUFFER,L),R.depthBuffer){const oe=R.depthTexture,pe=oe&&oe.isDepthTexture?oe.type:null,fe=k(R.stencilBuffer,pe),Fe=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ze=ie(R);ce(R)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ze,fe,R.width,R.height):q?t.renderbufferStorageMultisample(t.RENDERBUFFER,ze,fe,R.width,R.height):t.renderbufferStorage(t.RENDERBUFFER,fe,R.width,R.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Fe,t.RENDERBUFFER,L)}else{const oe=R.textures;for(let pe=0;pe{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,oe.removeEventListener("dispose",pe)};oe.addEventListener("dispose",pe),R.__depthDisposeCallback=pe}R.__boundDepthTexture=oe}if(L.depthTexture&&!R.__autoAllocateDepthBuffer){if(q)throw new Error("target.depthTexture not supported in Cube render targets");const oe=L.texture.mipmaps;oe&&oe.length>0?se(R.__webglFramebuffer[0],L):se(R.__webglFramebuffer,L)}else if(q){R.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)if(n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[oe]),R.__webglDepthbuffer[oe]===void 0)R.__webglDepthbuffer[oe]=t.createRenderbuffer(),ue(R.__webglDepthbuffer[oe],L,!1);else{const pe=L.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=R.__webglDepthbuffer[oe];t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,pe,t.RENDERBUFFER,fe)}}else{const oe=L.texture.mipmaps;if(oe&&oe.length>0?n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=t.createRenderbuffer(),ue(R.__webglDepthbuffer,L,!1);else{const pe=L.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=R.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,pe,t.RENDERBUFFER,fe)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function ae(L,R,q){const oe=r.get(L);R!==void 0&&je(oe.__webglFramebuffer,L,L.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),q!==void 0&&_e(L)}function Ue(L){const R=L.texture,q=r.get(L),oe=r.get(R);L.addEventListener("dispose",C);const pe=L.textures,fe=L.isWebGLCubeRenderTarget===!0,Fe=pe.length>1;if(Fe||(oe.__webglTexture===void 0&&(oe.__webglTexture=t.createTexture()),oe.__version=R.version,o.memory.textures++),fe){q.__webglFramebuffer=[];for(let ze=0;ze<6;ze++)if(R.mipmaps&&R.mipmaps.length>0){q.__webglFramebuffer[ze]=[];for(let He=0;He0){q.__webglFramebuffer=[];for(let ze=0;ze0&&ce(L)===!1){q.__webglMultisampledFramebuffer=t.createFramebuffer(),q.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let ze=0;ze0)for(let He=0;He0)for(let He=0;He0){if(ce(L)===!1){const R=L.textures,q=L.width,oe=L.height;let pe=t.COLOR_BUFFER_BIT;const fe=L.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Fe=r.get(L),ze=R.length>1;if(ze)for(let Ie=0;Ie0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer);for(let Ie=0;Ie0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function Le(L){const R=o.render.frame;d.get(L)!==R&&(d.set(L,R),L.update())}function Ne(L,R){const q=L.colorSpace,oe=L.format,pe=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||q!==gb&&q!==fh&&(cr.getTransfer(q)===Dr?(oe!==Gl||pe!==Lc)&&vn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ua("WebGLTextures: Unsupported texture color space:",q)),R}function ge(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(u.width=L.naturalWidth||L.width,u.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(u.width=L.displayWidth,u.height=L.displayHeight):(u.width=L.width,u.height=L.height),u}this.allocateTextureUnit=B,this.resetTextureUnits=O,this.setTexture2D=$,this.setTexture2DArray=G,this.setTexture3D=z,this.setTextureCube=W,this.rebindTextures=ae,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=V,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=_e,this.setupFrameBufferTexture=je,this.useMultisampledRTT=ce}function zwe(t,e){function n(r,a=fh){let s;const o=cr.getTransfer(a);if(r===Lc)return t.UNSIGNED_BYTE;if(r===LF)return t.UNSIGNED_SHORT_4_4_4_4;if(r===OF)return t.UNSIGNED_SHORT_5_5_5_1;if(r===FX)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===LX)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===DX)return t.BYTE;if(r===RX)return t.SHORT;if(r===yv)return t.UNSIGNED_SHORT;if(r===FF)return t.INT;if(r===Rf)return t.UNSIGNED_INT;if(r===Iu)return t.FLOAT;if(r===qb)return t.HALF_FLOAT;if(r===OX)return t.ALPHA;if(r===IX)return t.RGB;if(r===Gl)return t.RGBA;if(r===wv)return t.DEPTH_COMPONENT;if(r===Sv)return t.DEPTH_STENCIL;if(r===zX)return t.RED;if(r===IF)return t.RED_INTEGER;if(r===zF)return t.RG;if(r===UF)return t.RG_INTEGER;if(r===BF)return t.RGBA_INTEGER;if(r===H_||r===$_||r===V_||r===q_)if(o===Dr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===H_)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===$_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===V_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===q_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===H_)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===$_)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===V_)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===q_)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===N3||r===C3||r===k3||r===A3)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===N3)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===C3)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===k3)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===A3)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===M3||r===T3||r===P3)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===M3||r===T3)return o===Dr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===P3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===E3||r===j3||r===D3||r===R3||r===F3||r===L3||r===O3||r===I3||r===z3||r===U3||r===B3||r===H3||r===$3||r===V3)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===E3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===j3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===D3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===R3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===F3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===L3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===O3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===I3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===z3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===U3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===B3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===H3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===$3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===V3)return o===Dr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===q3||r===G3||r===W3)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===q3)return o===Dr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===G3)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===W3)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===K3||r===X3||r===Y3||r===Q3)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===K3)return s.COMPRESSED_RED_RGTC1_EXT;if(r===X3)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Y3)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Q3)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===vv?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const Uwe=`
+}`;function Fwe(t,e,n){let r=new GF;const a=new Un,s=new Un,o=new Za,l=new Qbe({depthPacking:obe}),c=new Zbe,u={},d=n.maxTextureSize,h={[qh]:to,[to]:qh,[_c]:_c},f=new ad({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Un},radius:{value:4}},vertexShader:Dwe,fragmentShader:Rwe}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const x=new wl;x.setAttribute("position",new Ds(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Sl(x,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=EX;let y=this.type;this.render=function(T,C,j){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const P=t.getRenderTarget(),E=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),O=t.state;O.setBlending(Vu),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const B=y!==Mu&&this.type===Mu,D=y===Mu&&this.type!==Mu;for(let $=0,G=T.length;$