升空

闯满关的奖励——和作物娃娃一起,
回来看一眼我们的小地球 🌍

拖动 · 转着看地球  点灯牌 · 看每个山谷
这台设备的图形引擎没能启动,
换个浏览器再试试~
&(l=$,m(l.object)),W=u(P,q,G,X),W&&M(P,q,G,X)}else{let $=U.wireframe===!0;(l.geometry!==q.id||l.program!==G.id||l.wireframe!==$)&&(l.geometry=q.id,l.program=G.id,l.wireframe=$,W=!0)}X!==null&&e.update(X,i.ELEMENT_ARRAY_BUFFER),(W||h)&&(h=!1,H(P,U,G,q),X!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function f(){return n.isWebGL2?i.createVertexArray():r.createVertexArrayOES()}function m(P){return n.isWebGL2?i.bindVertexArray(P):r.bindVertexArrayOES(P)}function _(P){return n.isWebGL2?i.deleteVertexArray(P):r.deleteVertexArrayOES(P)}function g(P,U,G){let q=G.wireframe===!0,X=a[P.id];X===void 0&&(X={},a[P.id]=X);let W=X[U.id];W===void 0&&(W={},X[U.id]=W);let $=W[q];return $===void 0&&($=p(f()),W[q]=$),$}function p(P){let U=[],G=[],q=[];for(let X=0;X=0){let Y=X[ct],at=W[ct];if(at===void 0&&(ct==="instanceMatrix"&&P.instanceMatrix&&(at=P.instanceMatrix),ct==="instanceColor"&&P.instanceColor&&(at=P.instanceColor)),Y===void 0||Y.attribute!==at||at&&Y.data!==at.data)return!0;$++}return l.attributesNum!==$||l.index!==q}function M(P,U,G,q){let X={},W=U.attributes,$=0,j=G.getAttributes();for(let ct in j)if(j[ct].location>=0){let Y=W[ct];Y===void 0&&(ct==="instanceMatrix"&&P.instanceMatrix&&(Y=P.instanceMatrix),ct==="instanceColor"&&P.instanceColor&&(Y=P.instanceColor));let at={};at.attribute=Y,Y&&Y.data&&(at.data=Y.data),X[ct]=at,$++}l.attributes=X,l.attributesNum=$,l.index=q}function x(){let P=l.newAttributes;for(let U=0,G=P.length;U=0){let k=X[j];if(k===void 0&&(j==="instanceMatrix"&&P.instanceMatrix&&(k=P.instanceMatrix),j==="instanceColor"&&P.instanceColor&&(k=P.instanceColor)),k!==void 0){let Y=k.normalized,at=k.itemSize,gt=e.get(k);if(gt===void 0)continue;let mt=gt.buffer,Ct=gt.type,Lt=gt.bytesPerElement,St=n.isWebGL2===!0&&(Ct===i.INT||Ct===i.UNSIGNED_INT||k.gpuType===Yc);if(k.isInterleavedBufferAttribute){let kt=k.data,D=kt.stride,be=k.offset;if(kt.isInstancedInterleavedBuffer){for(let xt=0;xt0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&i.constructor.name==="WebGL2RenderingContext",a=e.precision!==void 0?e.precision:"highp",c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);let l=o||t.has("WEBGL_draw_buffers"),h=e.logarithmicDepthBuffer===!0,d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),f=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),g=i.getParameter(i.MAX_VERTEX_ATTRIBS),p=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),u=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),x=f>0,T=o||t.has("OES_texture_float"),C=x&&T,w=o?i.getParameter(i.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:p,maxVaryings:u,maxFragmentUniforms:M,vertexTextures:x,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:w}}function Of(i){let t=this,e=null,n=0,s=!1,r=!1,o=new un,a=new zt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){let m=d.length!==0||f||n!==0||s;return s=f,n=d.length,m},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,f){e=h(d,f,0)},this.setState=function(d,f,m){let _=d.clippingPlanes,g=d.clipIntersection,p=d.clipShadows,u=i.get(d);if(!s||_===null||_.length===0||r&&!p)r?h(null):l();else{let M=r?0:n,x=M*4,T=u.clippingState||null;c.value=T,T=h(_,f,x,m);for(let C=0;C!==x;++C)T[C]=e[C];u.clippingState=T,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=M}};function l(){c.value!==e&&(c.value=e,c.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,f,m,_){let g=d!==null?d.length:0,p=null;if(g!==0){if(p=c.value,_!==!0||p===null){let u=m+g*4,M=f.matrixWorldInverse;a.getNormalMatrix(M),(p===null||p.length0){let l=new xa(c.height/2);return l.fromEquirectangularTexture(i,o),t.set(o,l),o.addEventListener("dispose",s),e(l.texture,o.mapping)}else return null}}return o}function s(o){let a=o.target;a.removeEventListener("dispose",s);let c=t.get(a);c!==void 0&&(t.delete(a),c.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}var tr=class extends Qs{constructor(t=-1,e=1,n=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,this.far=o,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,n,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}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),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,o=n+t,a=s+e,c=s-e;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,o=r+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}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}},Mi=4,gc=[.125,.215,.35,.446,.526,.582],Xn=20,Qr=new tr,_c=new lt,jr=null,ta=0,ea=0,Gn=(1+Math.sqrt(5))/2,gi=1/Gn,xc=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,Gn,gi),new L(0,Gn,-gi),new L(gi,0,Gn),new L(-gi,0,Gn),new L(Gn,gi,0),new L(-Gn,gi,0)],er=class{constructor(t){this._renderer=t,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(t,e=0,n=.1,s=100){jr=this._renderer.getRenderTarget(),ta=this._renderer.getActiveCubeFace(),ea=this._renderer.getActiveMipmapLevel(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,s,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Mc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=yc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?x:0,x,x),h.setRenderTarget(s),g&&h.render(_,a),h.render(t,a)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=f,h.autoClear=d,t.background=p}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===wi||t.mapping===Ai;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Mc()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=yc());let r=s?this._cubemapMaterial:this._equirectMaterial,o=new Gt(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=t;let c=this._cubeSize;Ps(e,0,0,3*c,2*c),n.setRenderTarget(e),n.render(o,Qr)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let s=1;sXn&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Xn}`);let u=[],M=0;for(let A=0;Ax-Mi?s-x+Mi:0),w=4*(this._cubeSize-T);Ps(e,C,w,3*T,2*T),c.setRenderTarget(e),c.render(d,Qr)}};function Bf(i){let t=[],e=[],n=[],s=i,r=i-Mi+1+gc.length;for(let o=0;oi-Mi?c=gc[o-i+Mi-1]:o===0&&(c=0),n.push(c);let l=1/(a-2),h=-l,d=1+l,f=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,_=6,g=3,p=2,u=1,M=new Float32Array(g*_*m),x=new Float32Array(p*_*m),T=new Float32Array(u*_*m);for(let w=0;w2?0:-1,y=[A,H,0,A+2/3,H,0,A+2/3,H+1,0,A,H,0,A+2/3,H+1,0,A,H+1,0];M.set(y,g*_*w),x.set(f,p*_*w);let E=[w,w,w,w,w,w];T.set(E,u*_*w)}let C=new Pe;C.setAttribute("position",new _e(M,g)),C.setAttribute("uv",new _e(x,p)),C.setAttribute("faceIndex",new _e(T,u)),t.push(C),s>Mi&&s--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function vc(i,t,e){let n=new gn(i,t,e);return n.texture.mapping=pr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ps(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function zf(i,t,e){let n=new Float32Array(Xn),s=new L(0,1,0);return new We({name:"SphericalGaussianBlur",defines:{n:Xn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:$a(),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:Tn,depthTest:!1,depthWrite:!1})}function yc(){return new We({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:$a(),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:Tn,depthTest:!1,depthWrite:!1})}function Mc(){return new We({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:$a(),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:Tn,depthTest:!1,depthWrite:!1})}function $a(){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 Hf(i){let t=new WeakMap,e=null;function n(a){if(a&&a.isTexture){let c=a.mapping,l=c===oa||c===ca,h=c===wi||c===Ai;if(l||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=t.get(a);return e===null&&(e=new er(i)),d=l?e.fromEquirectangular(a,d):e.fromCubemap(a,d),t.set(a,d),d.texture}else{if(t.has(a))return t.get(a).texture;{let d=a.image;if(l&&d&&d.height>0||h&&d&&s(d)){e===null&&(e=new er(i));let f=l?e.fromEquirectangular(a):e.fromCubemap(a);return t.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function s(a){let c=0,l=6;for(let h=0;ht.maxTextureSize&&(E=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);let B=new Float32Array(y*E*4*_),V=new Zs(B,y,E,_);V.type=En,V.needsUpdate=!0;let tt=H*4;for(let U=0;U<_;U++){let G=C[U],q=w[U],X=A[U],W=y*E*4*U;for(let $=0;$0)return i;let s=t*e,r=Sc[s];if(r===void 0&&(r=new Float32Array(s),Sc[s]=r),t!==0){n.toArray(r,0);for(let o=1,a=0;o!==t;++o)a+=e,i[o].toArray(r,a)}return r}function ce(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e":" "} ${a}: ${e[o]}`)}return n.join(` `)}function zp(i){let t=Xt.getPrimaries(Xt.workingColorSpace),e=Xt.getPrimaries(i),n;switch(t===e?n="":t===Gs&&e===Vs?n="LinearDisplayP3ToLinearSRGB":t===Vs&&e===Gs&&(n="LinearSRGBToLinearDisplayP3"),i){case mn:case mr:return[n,"LinearTransferOETF"];case oe:case Ja:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Cc(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),s=i.getShaderInfoLog(t).trim();if(n&&s==="")return"";let r=/ERROR: 0:(\d+)/.exec(s);if(r){let o=parseInt(r[1]);return e.toUpperCase()+` `+s+` `+Bp(i.getShaderSource(t),o)}else return s}function Hp(i,t){let e=zp(t);return`vec4 ${i}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function kp(i,t){let e;switch(t){case sh:e="Linear";break;case rh:e="Reinhard";break;case ah:e="OptimizedCineon";break;case oh:e="ACESFilmic";break;case lh:e="AgX";break;case ch:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function Vp(i){return[i.extensionDerivatives||i.envMapCubeUVHeight||i.bumpMap||i.normalMapTangentSpace||i.clearcoatNormalMap||i.flatShading||i.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(i.extensionFragDepth||i.logarithmicDepthBuffer)&&i.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",i.extensionDrawBuffers&&i.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(i.extensionShaderTextureLOD||i.envMap||i.transmission)&&i.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Si).join(` `)}function Gp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(Si).join(` `)}function Wp(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` `)}function Xp(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function Sa(i){return i.replace(qp,Zp)}var Yp=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Zp(i,t){let e=Ut[t];if(e===void 0){let n=Yp.get(t);if(n!==void 0)e=Ut[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return Sa(e)}var Jp=/#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 Ic(i){return i.replace(Jp,$p)}function $p(i,t,e,n){let s="";for(let r=parseInt(t);r0&&(u+=` `),M=[m,"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Si).join(` `),M.length>0&&(M+=` `)):(u=[Uc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors&&e.isWebGL2?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+c:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.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(Si).join(` `),M=[m,Uc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+l:"",e.envMap?"#define "+h:"",e.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+c:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==wn?"#define TONE_MAPPING":"",e.toneMapping!==wn?Ut.tonemapping_pars_fragment:"",e.toneMapping!==wn?kp("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Ut.colorspace_pars_fragment,Hp("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` `].filter(Si).join(` `)),o=Sa(o),o=Pc(o,e),o=Lc(o,e),a=Sa(a),a=Pc(a,e),a=Lc(a,e),o=Ic(o),a=Ic(a),e.isWebGL2&&e.isRawShaderMaterial!==!0&&(x=`#version 300 es `,u=[_,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+u,M=["precision mediump sampler2DArray;","#define varying in",e.glslVersion===Qo?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Qo?"":"#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(` `)+` `+M);let T=x+u+o,C=x+M+a,w=Rc(s,s.VERTEX_SHADER,T),A=Rc(s,s.FRAGMENT_SHADER,C);s.attachShader(p,w),s.attachShader(p,A),e.index0AttributeName!==void 0?s.bindAttribLocation(p,0,e.index0AttributeName):e.morphTargets===!0&&s.bindAttribLocation(p,0,"position"),s.linkProgram(p);function H(V){if(i.debug.checkShaderErrors){let tt=s.getProgramInfoLog(p).trim(),P=s.getShaderInfoLog(w).trim(),U=s.getShaderInfoLog(A).trim(),G=!0,q=!0;if(s.getProgramParameter(p,s.LINK_STATUS)===!1)if(G=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,p,w,A);else{let X=Cc(s,w,"vertex"),W=Cc(s,A,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(p,s.VALIDATE_STATUS)+` Program Info Log: `+tt+` `+X+` `+W)}else tt!==""?console.warn("THREE.WebGLProgram: Program Info Log:",tt):(P===""||U==="")&&(q=!1);q&&(V.diagnostics={runnable:G,programLog:tt,vertexShader:{log:P,prefix:u},fragmentShader:{log:U,prefix:M}})}s.deleteShader(w),s.deleteShader(A),y=new Ti(s,p),E=Xp(s,p)}let y;this.getUniforms=function(){return y===void 0&&H(this),y};let E;this.getAttributes=function(){return E===void 0&&H(this),E};let B=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return B===!1&&(B=s.getProgramParameter(p,Op)),B},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(p),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Fp++,this.cacheKey=t,this.usedTimes=1,this.program=p,this.vertexShader=w,this.fragmentShader=A,this}var im=0,ba=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,n=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(t);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Ea(t),e.set(t,n)),n}},Ea=class{constructor(t){this.id=im++,this.code=t,this.usedTimes=0}};function sm(i,t,e,n,s,r,o){let a=new Ki,c=new ba,l=[],h=s.isWebGL2,d=s.logarithmicDepthBuffer,f=s.vertexTextures,m=s.precision,_={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(y){return y===0?"uv":`uv${y}`}function p(y,E,B,V,tt){let P=V.fog,U=tt.geometry,G=y.isMeshStandardMaterial?V.environment:null,q=(y.isMeshStandardMaterial?e:t).get(y.envMap||G),X=q&&q.mapping===pr?q.image.height:null,W=_[y.type];y.precision!==null&&(m=s.getMaxPrecision(y.precision),m!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",m,"instead."));let $=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,j=$!==void 0?$.length:0,ct=0;U.morphAttributes.position!==void 0&&(ct=1),U.morphAttributes.normal!==void 0&&(ct=2),U.morphAttributes.color!==void 0&&(ct=3);let k,Y,at,gt;if(W){let Ee=en[W];k=Ee.vertexShader,Y=Ee.fragmentShader}else k=y.vertexShader,Y=y.fragmentShader,c.update(y),at=c.getVertexShaderID(y),gt=c.getFragmentShaderID(y);let mt=i.getRenderTarget(),Ct=tt.isInstancedMesh===!0,Lt=tt.isBatchedMesh===!0,St=!!y.map,kt=!!y.matcap,D=!!q,be=!!y.aoMap,xt=!!y.lightMap,At=!!y.bumpMap,dt=!!y.normalMap,Qt=!!y.displacementMap,Dt=!!y.emissiveMap,b=!!y.metalnessMap,v=!!y.roughnessMap,O=y.anisotropy>0,K=y.clearcoat>0,J=y.iridescence>0,Q=y.sheen>0,ft=y.transmission>0,rt=O&&!!y.anisotropyMap,ht=K&&!!y.clearcoatMap,Mt=K&&!!y.clearcoatNormalMap,Nt=K&&!!y.clearcoatRoughnessMap,Z=J&&!!y.iridescenceMap,Wt=J&&!!y.iridescenceThicknessMap,Ht=Q&&!!y.sheenColorMap,wt=Q&&!!y.sheenRoughnessMap,_t=!!y.specularMap,ut=!!y.specularColorMap,It=!!y.specularIntensityMap,Vt=ft&&!!y.transmissionMap,te=ft&&!!y.thicknessMap,Ft=!!y.gradientMap,et=!!y.alphaMap,R=y.alphaTest>0,it=!!y.alphaHash,st=!!y.extensions,bt=!!U.attributes.uv1,vt=!!U.attributes.uv2,Yt=!!U.attributes.uv3,Zt=wn;return y.toneMapped&&(mt===null||mt.isXRRenderTarget===!0)&&(Zt=i.toneMapping),{isWebGL2:h,shaderID:W,shaderType:y.type,shaderName:y.name,vertexShader:k,fragmentShader:Y,defines:y.defines,customVertexShaderID:at,customFragmentShaderID:gt,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:m,batching:Lt,instancing:Ct,instancingColor:Ct&&tt.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:mt===null?i.outputColorSpace:mt.isXRRenderTarget===!0?mt.texture.colorSpace:mn,map:St,matcap:kt,envMap:D,envMapMode:D&&q.mapping,envMapCubeUVHeight:X,aoMap:be,lightMap:xt,bumpMap:At,normalMap:dt,displacementMap:f&&Qt,emissiveMap:Dt,normalMapObjectSpace:dt&&y.normalMapType===Mh,normalMapTangentSpace:dt&&y.normalMapType===Za,metalnessMap:b,roughnessMap:v,anisotropy:O,anisotropyMap:rt,clearcoat:K,clearcoatMap:ht,clearcoatNormalMap:Mt,clearcoatRoughnessMap:Nt,iridescence:J,iridescenceMap:Z,iridescenceThicknessMap:Wt,sheen:Q,sheenColorMap:Ht,sheenRoughnessMap:wt,specularMap:_t,specularColorMap:ut,specularIntensityMap:It,transmission:ft,transmissionMap:Vt,thicknessMap:te,gradientMap:Ft,opaque:y.transparent===!1&&y.blending===bi,alphaMap:et,alphaTest:R,alphaHash:it,combine:y.combine,mapUv:St&&g(y.map.channel),aoMapUv:be&&g(y.aoMap.channel),lightMapUv:xt&&g(y.lightMap.channel),bumpMapUv:At&&g(y.bumpMap.channel),normalMapUv:dt&&g(y.normalMap.channel),displacementMapUv:Qt&&g(y.displacementMap.channel),emissiveMapUv:Dt&&g(y.emissiveMap.channel),metalnessMapUv:b&&g(y.metalnessMap.channel),roughnessMapUv:v&&g(y.roughnessMap.channel),anisotropyMapUv:rt&&g(y.anisotropyMap.channel),clearcoatMapUv:ht&&g(y.clearcoatMap.channel),clearcoatNormalMapUv:Mt&&g(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Nt&&g(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Z&&g(y.iridescenceMap.channel),iridescenceThicknessMapUv:Wt&&g(y.iridescenceThicknessMap.channel),sheenColorMapUv:Ht&&g(y.sheenColorMap.channel),sheenRoughnessMapUv:wt&&g(y.sheenRoughnessMap.channel),specularMapUv:_t&&g(y.specularMap.channel),specularColorMapUv:ut&&g(y.specularColorMap.channel),specularIntensityMapUv:It&&g(y.specularIntensityMap.channel),transmissionMapUv:Vt&&g(y.transmissionMap.channel),thicknessMapUv:te&&g(y.thicknessMap.channel),alphaMapUv:et&&g(y.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(dt||O),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,vertexUv1s:bt,vertexUv2s:vt,vertexUv3s:Yt,pointsUvs:tt.isPoints===!0&&!!U.attributes.uv&&(St||et),fog:!!P,useFog:y.fog===!0,fogExp2:P&&P.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:tt.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:j,morphTextureStride:ct,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:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&B.length>0,shadowMapType:i.shadowMap.type,toneMapping:Zt,useLegacyLights:i._useLegacyLights,decodeVideoTexture:St&&y.map.isVideoTexture===!0&&Xt.getTransfer(y.map.colorSpace)===$t,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===dn,flipSided:y.side===ge,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:st&&y.extensions.derivatives===!0,extensionFragDepth:st&&y.extensions.fragDepth===!0,extensionDrawBuffers:st&&y.extensions.drawBuffers===!0,extensionShaderTextureLOD:st&&y.extensions.shaderTextureLOD===!0,extensionClipCullDistance:st&&y.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()}}function u(y){let E=[];if(y.shaderID?E.push(y.shaderID):(E.push(y.customVertexShaderID),E.push(y.customFragmentShaderID)),y.defines!==void 0)for(let B in y.defines)E.push(B),E.push(y.defines[B]);return y.isRawShaderMaterial===!1&&(M(E,y),x(E,y),E.push(i.outputColorSpace)),E.push(y.customProgramCacheKey),E.join()}function M(y,E){y.push(E.precision),y.push(E.outputColorSpace),y.push(E.envMapMode),y.push(E.envMapCubeUVHeight),y.push(E.mapUv),y.push(E.alphaMapUv),y.push(E.lightMapUv),y.push(E.aoMapUv),y.push(E.bumpMapUv),y.push(E.normalMapUv),y.push(E.displacementMapUv),y.push(E.emissiveMapUv),y.push(E.metalnessMapUv),y.push(E.roughnessMapUv),y.push(E.anisotropyMapUv),y.push(E.clearcoatMapUv),y.push(E.clearcoatNormalMapUv),y.push(E.clearcoatRoughnessMapUv),y.push(E.iridescenceMapUv),y.push(E.iridescenceThicknessMapUv),y.push(E.sheenColorMapUv),y.push(E.sheenRoughnessMapUv),y.push(E.specularMapUv),y.push(E.specularColorMapUv),y.push(E.specularIntensityMapUv),y.push(E.transmissionMapUv),y.push(E.thicknessMapUv),y.push(E.combine),y.push(E.fogExp2),y.push(E.sizeAttenuation),y.push(E.morphTargetsCount),y.push(E.morphAttributeCount),y.push(E.numDirLights),y.push(E.numPointLights),y.push(E.numSpotLights),y.push(E.numSpotLightMaps),y.push(E.numHemiLights),y.push(E.numRectAreaLights),y.push(E.numDirLightShadows),y.push(E.numPointLightShadows),y.push(E.numSpotLightShadows),y.push(E.numSpotLightShadowsWithMaps),y.push(E.numLightProbes),y.push(E.shadowMapType),y.push(E.toneMapping),y.push(E.numClippingPlanes),y.push(E.numClipIntersection),y.push(E.depthPacking)}function x(y,E){a.disableAll(),E.isWebGL2&&a.enable(0),E.supportsVertexTextures&&a.enable(1),E.instancing&&a.enable(2),E.instancingColor&&a.enable(3),E.matcap&&a.enable(4),E.envMap&&a.enable(5),E.normalMapObjectSpace&&a.enable(6),E.normalMapTangentSpace&&a.enable(7),E.clearcoat&&a.enable(8),E.iridescence&&a.enable(9),E.alphaTest&&a.enable(10),E.vertexColors&&a.enable(11),E.vertexAlphas&&a.enable(12),E.vertexUv1s&&a.enable(13),E.vertexUv2s&&a.enable(14),E.vertexUv3s&&a.enable(15),E.vertexTangents&&a.enable(16),E.anisotropy&&a.enable(17),E.alphaHash&&a.enable(18),E.batching&&a.enable(19),y.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.skinning&&a.enable(4),E.morphTargets&&a.enable(5),E.morphNormals&&a.enable(6),E.morphColors&&a.enable(7),E.premultipliedAlpha&&a.enable(8),E.shadowMapEnabled&&a.enable(9),E.useLegacyLights&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),E.decodeVideoTexture&&a.enable(19),y.push(a.mask)}function T(y){let E=_[y.type],B;if(E){let V=en[E];B=qh.clone(V.uniforms)}else B=y.uniforms;return B}function C(y,E){let B;for(let V=0,tt=l.length;V0?n.push(u):m.transparent===!0?s.push(u):e.push(u)}function c(d,f,m,_,g,p){let u=o(d,f,m,_,g,p);m.transmission>0?n.unshift(u):m.transparent===!0?s.unshift(u):e.unshift(u)}function l(d,f){e.length>1&&e.sort(d||am),n.length>1&&n.sort(f||Dc),s.length>1&&s.sort(f||Dc)}function h(){for(let d=t,f=i.length;d=r.length?(o=new Nc,r.push(o)):o=r[s],o}function e(){i=new WeakMap}return{get:t,dispose:e}}function cm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new L,color:new lt};break;case"SpotLight":e={position:new L,direction:new L,color:new lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new L,color:new lt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new L,skyColor:new lt,groundColor:new lt};break;case"RectAreaLight":e={color:new lt,position:new L,halfWidth:new L,halfHeight:new L};break}return i[t.id]=e,e}}}function lm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var hm=0;function um(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function dm(i,t){let e=new cm,n=lm(),s={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++)s.probe.push(new L);let r=new L,o=new ae,a=new ae;function c(h,d){let f=0,m=0,_=0;for(let V=0;V<9;V++)s.probe[V].set(0,0,0);let g=0,p=0,u=0,M=0,x=0,T=0,C=0,w=0,A=0,H=0,y=0;h.sort(um);let E=d===!0?Math.PI:1;for(let V=0,tt=h.length;V0&&(t.isWebGL2?i.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=nt.LTC_FLOAT_1,s.rectAreaLTC2=nt.LTC_FLOAT_2):(s.rectAreaLTC1=nt.LTC_HALF_1,s.rectAreaLTC2=nt.LTC_HALF_2):i.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=nt.LTC_FLOAT_1,s.rectAreaLTC2=nt.LTC_FLOAT_2):i.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=nt.LTC_HALF_1,s.rectAreaLTC2=nt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=m,s.ambient[2]=_;let B=s.hash;(B.directionalLength!==g||B.pointLength!==p||B.spotLength!==u||B.rectAreaLength!==M||B.hemiLength!==x||B.numDirectionalShadows!==T||B.numPointShadows!==C||B.numSpotShadows!==w||B.numSpotMaps!==A||B.numLightProbes!==y)&&(s.directional.length=g,s.spot.length=u,s.rectArea.length=M,s.point.length=p,s.hemi.length=x,s.directionalShadow.length=T,s.directionalShadowMap.length=T,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=w,s.spotShadowMap.length=w,s.directionalShadowMatrix.length=T,s.pointShadowMatrix.length=C,s.spotLightMatrix.length=w+A-H,s.spotLightMap.length=A,s.numSpotLightShadowsWithMaps=H,s.numLightProbes=y,B.directionalLength=g,B.pointLength=p,B.spotLength=u,B.rectAreaLength=M,B.hemiLength=x,B.numDirectionalShadows=T,B.numPointShadows=C,B.numSpotShadows=w,B.numSpotMaps=A,B.numLightProbes=y,s.version=hm++)}function l(h,d){let f=0,m=0,_=0,g=0,p=0,u=d.matrixWorldInverse;for(let M=0,x=h.length;M=a.length?(c=new Oc(i,t),a.push(c)):c=a[o],c}function s(){e=new WeakMap}return{get:n,dispose:s}}var Ta=class extends nn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=vh,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}},wa=class extends nn{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}},pm=`void main() { gl_Position = vec4( position, 1.0 ); }`,mm=`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 gm(i,t,e){let n=new Qi,s=new Tt,r=new Tt,o=new pe,a=new Ta({depthPacking:yh}),c=new wa,l={},h=e.maxTextureSize,d={[Cn]:ge,[ge]:Cn,[dn]:dn},f=new We({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Tt},radius:{value:4}},vertexShader:pm,fragmentShader:mm}),m=f.clone();m.defines.HORIZONTAL_PASS=1;let _=new Pe;_.setAttribute("position",new _e(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Gt(_,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Xc;let u=this.type;this.render=function(w,A,H){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||w.length===0)return;let y=i.getRenderTarget(),E=i.getActiveCubeFace(),B=i.getActiveMipmapLevel(),V=i.state;V.setBlending(Tn),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let tt=u!==hn&&this.type===hn,P=u===hn&&this.type!==hn;for(let U=0,G=w.length;Uh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/W.x),s.x=r.x*W.x,X.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/W.y),s.y=r.y*W.y,X.mapSize.y=r.y)),X.map===null||tt===!0||P===!0){let j=this.type!==hn?{minFilter:Re,magFilter:Re}:{};X.map!==null&&X.map.dispose(),X.map=new gn(s.x,s.y,j),X.map.texture.name=q.name+".shadowMap",X.camera.updateProjectionMatrix()}i.setRenderTarget(X.map),i.clear();let $=X.getViewportCount();for(let j=0;j<$;j++){let ct=X.getViewport(j);o.set(r.x*ct.x,r.y*ct.y,r.x*ct.z,r.y*ct.w),V.viewport(o),X.updateMatrices(q,j),n=X.getFrustum(),T(A,H,X.camera,q,this.type)}X.isPointLightShadow!==!0&&this.type===hn&&M(X,H),X.needsUpdate=!1}u=this.type,p.needsUpdate=!1,i.setRenderTarget(y,E,B)};function M(w,A){let H=t.update(g);f.defines.VSM_SAMPLES!==w.blurSamples&&(f.defines.VSM_SAMPLES=w.blurSamples,m.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new gn(s.x,s.y)),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(A,null,H,f,g,null),m.uniforms.shadow_pass.value=w.mapPass.texture,m.uniforms.resolution.value=w.mapSize,m.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(A,null,H,m,g,null)}function x(w,A,H,y){let E=null,B=H.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(B!==void 0)E=B;else if(E=H.isPointLight===!0?c:a,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){let V=E.uuid,tt=A.uuid,P=l[V];P===void 0&&(P={},l[V]=P);let U=P[tt];U===void 0&&(U=E.clone(),P[tt]=U,A.addEventListener("dispose",C)),E=U}if(E.visible=A.visible,E.wireframe=A.wireframe,y===hn?E.side=A.shadowSide!==null?A.shadowSide:A.side:E.side=A.shadowSide!==null?A.shadowSide:d[A.side],E.alphaMap=A.alphaMap,E.alphaTest=A.alphaTest,E.map=A.map,E.clipShadows=A.clipShadows,E.clippingPlanes=A.clippingPlanes,E.clipIntersection=A.clipIntersection,E.displacementMap=A.displacementMap,E.displacementScale=A.displacementScale,E.displacementBias=A.displacementBias,E.wireframeLinewidth=A.wireframeLinewidth,E.linewidth=A.linewidth,H.isPointLight===!0&&E.isMeshDistanceMaterial===!0){let V=i.properties.get(E);V.light=H}return E}function T(w,A,H,y,E){if(w.visible===!1)return;if(w.layers.test(A.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&E===hn)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,w.matrixWorld);let tt=t.update(w),P=w.material;if(Array.isArray(P)){let U=tt.groups;for(let G=0,q=U.length;G=1):$.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec($)[1]),X=W>=2);let j=null,ct={},k=i.getParameter(i.SCISSOR_BOX),Y=i.getParameter(i.VIEWPORT),at=new pe().fromArray(k),gt=new pe().fromArray(Y);function mt(R,it,st,bt){let vt=new Uint8Array(4),Yt=i.createTexture();i.bindTexture(R,Yt),i.texParameteri(R,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(R,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Zt=0;Zt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap,d,f=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(b,v){return m?new OffscreenCanvas(b,v):Xs("canvas")}function g(b,v,O,K){let J=1;if((b.width>K||b.height>K)&&(J=K/Math.max(b.width,b.height)),J<1||v===!0)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap){let Q=v?pa:Math.floor,ft=Q(J*b.width),rt=Q(J*b.height);d===void 0&&(d=_(ft,rt));let ht=O?_(ft,rt):d;return ht.width=ft,ht.height=rt,ht.getContext("2d").drawImage(b,0,0,ft,rt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+b.width+"x"+b.height+") to ("+ft+"x"+rt+")."),ht}else return"data"in b&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+b.width+"x"+b.height+")."),b;return b}function p(b){return jo(b.width)&&jo(b.height)}function u(b){return a?!1:b.wrapS!==Ze||b.wrapT!==Ze||b.minFilter!==Re&&b.minFilter!==ke}function M(b,v){return b.generateMipmaps&&v&&b.minFilter!==Re&&b.minFilter!==ke}function x(b){i.generateMipmap(b)}function T(b,v,O,K,J=!1){if(a===!1)return v;if(b!==null){if(i[b]!==void 0)return i[b];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let Q=v;if(v===i.RED&&(O===i.FLOAT&&(Q=i.R32F),O===i.HALF_FLOAT&&(Q=i.R16F),O===i.UNSIGNED_BYTE&&(Q=i.R8)),v===i.RED_INTEGER&&(O===i.UNSIGNED_BYTE&&(Q=i.R8UI),O===i.UNSIGNED_SHORT&&(Q=i.R16UI),O===i.UNSIGNED_INT&&(Q=i.R32UI),O===i.BYTE&&(Q=i.R8I),O===i.SHORT&&(Q=i.R16I),O===i.INT&&(Q=i.R32I)),v===i.RG&&(O===i.FLOAT&&(Q=i.RG32F),O===i.HALF_FLOAT&&(Q=i.RG16F),O===i.UNSIGNED_BYTE&&(Q=i.RG8)),v===i.RGBA){let ft=J?ks:Xt.getTransfer(K);O===i.FLOAT&&(Q=i.RGBA32F),O===i.HALF_FLOAT&&(Q=i.RGBA16F),O===i.UNSIGNED_BYTE&&(Q=ft===$t?i.SRGB8_ALPHA8:i.RGBA8),O===i.UNSIGNED_SHORT_4_4_4_4&&(Q=i.RGBA4),O===i.UNSIGNED_SHORT_5_5_5_1&&(Q=i.RGB5_A1)}return(Q===i.R16F||Q===i.R32F||Q===i.RG16F||Q===i.RG32F||Q===i.RGBA16F||Q===i.RGBA32F)&&t.get("EXT_color_buffer_float"),Q}function C(b,v,O){return M(b,O)===!0||b.isFramebufferTexture&&b.minFilter!==Re&&b.minFilter!==ke?Math.log2(Math.max(v.width,v.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?v.mipmaps.length:1}function w(b){return b===Re||b===So||b===wr?i.NEAREST:i.LINEAR}function A(b){let v=b.target;v.removeEventListener("dispose",A),y(v),v.isVideoTexture&&h.delete(v)}function H(b){let v=b.target;v.removeEventListener("dispose",H),B(v)}function y(b){let v=n.get(b);if(v.__webglInit===void 0)return;let O=b.source,K=f.get(O);if(K){let J=K[v.__cacheKey];J.usedTimes--,J.usedTimes===0&&E(b),Object.keys(K).length===0&&f.delete(O)}n.remove(b)}function E(b){let v=n.get(b);i.deleteTexture(v.__webglTexture);let O=b.source,K=f.get(O);delete K[v.__cacheKey],o.memory.textures--}function B(b){let v=b.texture,O=n.get(b),K=n.get(v);if(K.__webglTexture!==void 0&&(i.deleteTexture(K.__webglTexture),o.memory.textures--),b.depthTexture&&b.depthTexture.dispose(),b.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(O.__webglFramebuffer[J]))for(let Q=0;Q=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+s.maxTextures),V+=1,b}function U(b){let v=[];return v.push(b.wrapS),v.push(b.wrapT),v.push(b.wrapR||0),v.push(b.magFilter),v.push(b.minFilter),v.push(b.anisotropy),v.push(b.internalFormat),v.push(b.format),v.push(b.type),v.push(b.generateMipmaps),v.push(b.premultiplyAlpha),v.push(b.flipY),v.push(b.unpackAlignment),v.push(b.colorSpace),v.join()}function G(b,v){let O=n.get(b);if(b.isVideoTexture&&Qt(b),b.isRenderTargetTexture===!1&&b.version>0&&O.__version!==b.version){let K=b.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{at(O,b,v);return}}e.bindTexture(i.TEXTURE_2D,O.__webglTexture,i.TEXTURE0+v)}function q(b,v){let O=n.get(b);if(b.version>0&&O.__version!==b.version){at(O,b,v);return}e.bindTexture(i.TEXTURE_2D_ARRAY,O.__webglTexture,i.TEXTURE0+v)}function X(b,v){let O=n.get(b);if(b.version>0&&O.__version!==b.version){at(O,b,v);return}e.bindTexture(i.TEXTURE_3D,O.__webglTexture,i.TEXTURE0+v)}function W(b,v){let O=n.get(b);if(b.version>0&&O.__version!==b.version){gt(O,b,v);return}e.bindTexture(i.TEXTURE_CUBE_MAP,O.__webglTexture,i.TEXTURE0+v)}let $={[la]:i.REPEAT,[Ze]:i.CLAMP_TO_EDGE,[ha]:i.MIRRORED_REPEAT},j={[Re]:i.NEAREST,[So]:i.NEAREST_MIPMAP_NEAREST,[wr]:i.NEAREST_MIPMAP_LINEAR,[ke]:i.LINEAR,[hh]:i.LINEAR_MIPMAP_NEAREST,[Zi]:i.LINEAR_MIPMAP_LINEAR},ct={[Sh]:i.NEVER,[Rh]:i.ALWAYS,[bh]:i.LESS,[el]:i.LEQUAL,[Eh]:i.EQUAL,[Ah]:i.GEQUAL,[Th]:i.GREATER,[wh]:i.NOTEQUAL};function k(b,v,O){if(O?(i.texParameteri(b,i.TEXTURE_WRAP_S,$[v.wrapS]),i.texParameteri(b,i.TEXTURE_WRAP_T,$[v.wrapT]),(b===i.TEXTURE_3D||b===i.TEXTURE_2D_ARRAY)&&i.texParameteri(b,i.TEXTURE_WRAP_R,$[v.wrapR]),i.texParameteri(b,i.TEXTURE_MAG_FILTER,j[v.magFilter]),i.texParameteri(b,i.TEXTURE_MIN_FILTER,j[v.minFilter])):(i.texParameteri(b,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(b,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),(b===i.TEXTURE_3D||b===i.TEXTURE_2D_ARRAY)&&i.texParameteri(b,i.TEXTURE_WRAP_R,i.CLAMP_TO_EDGE),(v.wrapS!==Ze||v.wrapT!==Ze)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(b,i.TEXTURE_MAG_FILTER,w(v.magFilter)),i.texParameteri(b,i.TEXTURE_MIN_FILTER,w(v.minFilter)),v.minFilter!==Re&&v.minFilter!==ke&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),v.compareFunction&&(i.texParameteri(b,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(b,i.TEXTURE_COMPARE_FUNC,ct[v.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let K=t.get("EXT_texture_filter_anisotropic");if(v.magFilter===Re||v.minFilter!==wr&&v.minFilter!==Zi||v.type===En&&t.has("OES_texture_float_linear")===!1||a===!1&&v.type===Ji&&t.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||n.get(v).__currentAnisotropy)&&(i.texParameterf(b,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy)}}function Y(b,v){let O=!1;b.__webglInit===void 0&&(b.__webglInit=!0,v.addEventListener("dispose",A));let K=v.source,J=f.get(K);J===void 0&&(J={},f.set(K,J));let Q=U(v);if(Q!==b.__cacheKey){J[Q]===void 0&&(J[Q]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,O=!0),J[Q].usedTimes++;let ft=J[b.__cacheKey];ft!==void 0&&(J[b.__cacheKey].usedTimes--,ft.usedTimes===0&&E(v)),b.__cacheKey=Q,b.__webglTexture=J[Q].texture}return O}function at(b,v,O){let K=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(K=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(K=i.TEXTURE_3D);let J=Y(b,v),Q=v.source;e.bindTexture(K,b.__webglTexture,i.TEXTURE0+O);let ft=n.get(Q);if(Q.version!==ft.__version||J===!0){e.activeTexture(i.TEXTURE0+O);let rt=Xt.getPrimaries(Xt.workingColorSpace),ht=v.colorSpace===Ve?null:Xt.getPrimaries(v.colorSpace),Mt=v.colorSpace===Ve||rt===ht?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Mt);let Nt=u(v)&&p(v.image)===!1,Z=g(v.image,Nt,!1,s.maxTextureSize);Z=Dt(v,Z);let Wt=p(Z)||a,Ht=r.convert(v.format,v.colorSpace),wt=r.convert(v.type),_t=T(v.internalFormat,Ht,wt,v.colorSpace,v.isVideoTexture);k(K,v,Wt);let ut,It=v.mipmaps,Vt=a&&v.isVideoTexture!==!0&&_t!==jc,te=ft.__version===void 0||J===!0,Ft=C(v,Z,Wt);if(v.isDepthTexture)_t=i.DEPTH_COMPONENT,a?v.type===En?_t=i.DEPTH_COMPONENT32F:v.type===bn?_t=i.DEPTH_COMPONENT24:v.type===Yn?_t=i.DEPTH24_STENCIL8:_t=i.DEPTH_COMPONENT16:v.type===En&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===Zn&&_t===i.DEPTH_COMPONENT&&v.type!==Ya&&v.type!==bn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=bn,wt=r.convert(v.type)),v.format===Ri&&_t===i.DEPTH_COMPONENT&&(_t=i.DEPTH_STENCIL,v.type!==Yn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=Yn,wt=r.convert(v.type))),te&&(Vt?e.texStorage2D(i.TEXTURE_2D,1,_t,Z.width,Z.height):e.texImage2D(i.TEXTURE_2D,0,_t,Z.width,Z.height,0,Ht,wt,null));else if(v.isDataTexture)if(It.length>0&&Wt){Vt&&te&&e.texStorage2D(i.TEXTURE_2D,Ft,_t,It[0].width,It[0].height);for(let et=0,R=It.length;et>=1,R>>=1}}else if(It.length>0&&Wt){Vt&&te&&e.texStorage2D(i.TEXTURE_2D,Ft,_t,It[0].width,It[0].height);for(let et=0,R=It.length;et0&&te++,e.texStorage2D(i.TEXTURE_CUBE_MAP,te,ut,Z[0].width,Z[0].height));for(let et=0;et<6;et++)if(Nt){It?e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+et,0,0,0,Z[et].width,Z[et].height,wt,_t,Z[et].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+et,0,ut,Z[et].width,Z[et].height,0,wt,_t,Z[et].data);for(let R=0;R>Q),Z=Math.max(1,v.height>>Q);J===i.TEXTURE_3D||J===i.TEXTURE_2D_ARRAY?e.texImage3D(J,Q,ht,Nt,Z,v.depth,0,ft,rt,null):e.texImage2D(J,Q,ht,Nt,Z,0,ft,rt,null)}e.bindFramebuffer(i.FRAMEBUFFER,b),dt(v)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,K,J,n.get(O).__webglTexture,0,At(v)):(J===i.TEXTURE_2D||J>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,K,J,n.get(O).__webglTexture,Q),e.bindFramebuffer(i.FRAMEBUFFER,null)}function Ct(b,v,O){if(i.bindRenderbuffer(i.RENDERBUFFER,b),v.depthBuffer&&!v.stencilBuffer){let K=a===!0?i.DEPTH_COMPONENT24:i.DEPTH_COMPONENT16;if(O||dt(v)){let J=v.depthTexture;J&&J.isDepthTexture&&(J.type===En?K=i.DEPTH_COMPONENT32F:J.type===bn&&(K=i.DEPTH_COMPONENT24));let Q=At(v);dt(v)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Q,K,v.width,v.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,Q,K,v.width,v.height)}else i.renderbufferStorage(i.RENDERBUFFER,K,v.width,v.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,b)}else if(v.depthBuffer&&v.stencilBuffer){let K=At(v);O&&dt(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,K,i.DEPTH24_STENCIL8,v.width,v.height):dt(v)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,K,i.DEPTH24_STENCIL8,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,b)}else{let K=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let J=0;J0){O.__webglFramebuffer[rt]=[];for(let ht=0;ht0){O.__webglFramebuffer=[];for(let rt=0;rt0&&dt(b)===!1){let rt=Q?v:[v];O.__webglMultisampledFramebuffer=i.createFramebuffer(),O.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let ht=0;ht0)for(let ht=0;ht0)for(let ht=0;ht0&&dt(b)===!1){let v=b.isWebGLMultipleRenderTargets?b.texture:[b.texture],O=b.width,K=b.height,J=i.COLOR_BUFFER_BIT,Q=[],ft=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,rt=n.get(b),ht=b.isWebGLMultipleRenderTargets===!0;if(ht)for(let Mt=0;Mt0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Qt(b){let v=o.render.frame;h.get(b)!==v&&(h.set(b,v),b.update())}function Dt(b,v){let O=b.colorSpace,K=b.format,J=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||b.format===da||O!==mn&&O!==Ve&&(Xt.getTransfer(O)===$t?a===!1?t.has("EXT_sRGB")===!0&&K===Je?(b.format=da,b.minFilter=ke,b.generateMipmaps=!1):v=qs.sRGBToLinear(v):(K!==Je||J!==An)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),v}this.allocateTextureUnit=P,this.resetTextureUnits=tt,this.setTexture2D=G,this.setTexture2DArray=q,this.setTexture3D=X,this.setTextureCube=W,this.rebindTextures=kt,this.setupRenderTarget=D,this.updateRenderTargetMipmap=be,this.updateMultisampleRenderTarget=xt,this.setupDepthRenderbuffer=St,this.setupFrameBufferTexture=mt,this.useMultisampledRTT=dt}function vm(i,t,e){let n=e.isWebGL2;function s(r,o=Ve){let a,c=Xt.getTransfer(o);if(r===An)return i.UNSIGNED_BYTE;if(r===Zc)return i.UNSIGNED_SHORT_4_4_4_4;if(r===Jc)return i.UNSIGNED_SHORT_5_5_5_1;if(r===uh)return i.BYTE;if(r===dh)return i.SHORT;if(r===Ya)return i.UNSIGNED_SHORT;if(r===Yc)return i.INT;if(r===bn)return i.UNSIGNED_INT;if(r===En)return i.FLOAT;if(r===Ji)return n?i.HALF_FLOAT:(a=t.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===fh)return i.ALPHA;if(r===Je)return i.RGBA;if(r===ph)return i.LUMINANCE;if(r===mh)return i.LUMINANCE_ALPHA;if(r===Zn)return i.DEPTH_COMPONENT;if(r===Ri)return i.DEPTH_STENCIL;if(r===da)return a=t.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===gh)return i.RED;if(r===$c)return i.RED_INTEGER;if(r===_h)return i.RG;if(r===Kc)return i.RG_INTEGER;if(r===Qc)return i.RGBA_INTEGER;if(r===Ar||r===Rr||r===Cr||r===Pr)if(c===$t)if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Ar)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Rr)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Cr)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Pr)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Ar)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Rr)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Cr)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Pr)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===bo||r===Eo||r===To||r===wo)if(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===bo)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Eo)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===To)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===wo)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===jc)return a=t.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Ao||r===Ro)if(a=t.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Ao)return c===$t?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Ro)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Co||r===Po||r===Lo||r===Io||r===Uo||r===Do||r===No||r===Oo||r===Fo||r===Bo||r===zo||r===Ho||r===ko||r===Vo)if(a=t.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Co)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Po)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Lo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Io)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Uo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Do)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===No)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Oo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Fo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Bo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===zo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Ho)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===ko)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Vo)return c===$t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Lr||r===Go||r===Wo)if(a=t.get("EXT_texture_compression_bptc"),a!==null){if(r===Lr)return c===$t?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Go)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===Wo)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===xh||r===Xo||r===qo||r===Yo)if(a=t.get("EXT_texture_compression_rgtc"),a!==null){if(r===Lr)return a.COMPRESSED_RED_RGTC1_EXT;if(r===Xo)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===qo)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Yo)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Yn?n?i.UNSIGNED_INT_24_8:(a=t.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[r]!==void 0?i[r]:null}return{convert:s}}var Aa=class extends Ce{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},$e=class extends Me{constructor(){super(),this.isGroup=!0,this.type="Group"}},ym={type:"move"},Yi=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $e,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 $e,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $e,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),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}update(t,e,n){let s=null,r=null,o=null,a=this._targetRay,c=this._grip,l=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(l&&t.hand){o=!0;for(let g of t.hand.values()){let p=e.getJointPose(g,n),u=this._getHandJoint(l,g);p!==null&&(u.matrix.fromArray(p.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=p.radius),u.visible=p!==null}let h=l.joints["index-finger-tip"],d=l.joints["thumb-tip"],f=h.position.distanceTo(d.position),m=.02,_=.005;l.inputState.pinching&&f>m+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&f<=m-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(r=e.getPose(t.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));a!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ym)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new $e;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},Ra=class extends Pn{constructor(t,e){super();let n=this,s=null,r=1,o=null,a="local-floor",c=1,l=null,h=null,d=null,f=null,m=null,_=null,g=e.getContextAttributes(),p=null,u=null,M=[],x=[],T=new Tt,C=null,w=new Ce;w.layers.enable(1),w.viewport=new pe;let A=new Ce;A.layers.enable(2),A.viewport=new pe;let H=[w,A],y=new Aa;y.layers.enable(1),y.layers.enable(2);let E=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let Y=M[k];return Y===void 0&&(Y=new Yi,M[k]=Y),Y.getTargetRaySpace()},this.getControllerGrip=function(k){let Y=M[k];return Y===void 0&&(Y=new Yi,M[k]=Y),Y.getGripSpace()},this.getHand=function(k){let Y=M[k];return Y===void 0&&(Y=new Yi,M[k]=Y),Y.getHandSpace()};function V(k){let Y=x.indexOf(k.inputSource);if(Y===-1)return;let at=M[Y];at!==void 0&&(at.update(k.inputSource,k.frame,l||o),at.dispatchEvent({type:k.type,data:k.inputSource}))}function tt(){s.removeEventListener("select",V),s.removeEventListener("selectstart",V),s.removeEventListener("selectend",V),s.removeEventListener("squeeze",V),s.removeEventListener("squeezestart",V),s.removeEventListener("squeezeend",V),s.removeEventListener("end",tt),s.removeEventListener("inputsourceschange",P);for(let k=0;k=0&&(x[gt]=null,M[gt].disconnect(at))}for(let Y=0;Y=x.length){x.push(at),gt=Ct;break}else if(x[Ct]===null){x[Ct]=at,gt=Ct;break}if(gt===-1)break}let mt=M[gt];mt&&mt.connect(at)}}let U=new L,G=new L;function q(k,Y,at){U.setFromMatrixPosition(Y.matrixWorld),G.setFromMatrixPosition(at.matrixWorld);let gt=U.distanceTo(G),mt=Y.projectionMatrix.elements,Ct=at.projectionMatrix.elements,Lt=mt[14]/(mt[10]-1),St=mt[14]/(mt[10]+1),kt=(mt[9]+1)/mt[5],D=(mt[9]-1)/mt[5],be=(mt[8]-1)/mt[0],xt=(Ct[8]+1)/Ct[0],At=Lt*be,dt=Lt*xt,Qt=gt/(-be+xt),Dt=Qt*-be;Y.matrixWorld.decompose(k.position,k.quaternion,k.scale),k.translateX(Dt),k.translateZ(Qt),k.matrixWorld.compose(k.position,k.quaternion,k.scale),k.matrixWorldInverse.copy(k.matrixWorld).invert();let b=Lt+Qt,v=St+Qt,O=At-Dt,K=dt+(gt-Dt),J=kt*St/v*b,Q=D*St/v*b;k.projectionMatrix.makePerspective(O,K,J,Q,b,v),k.projectionMatrixInverse.copy(k.projectionMatrix).invert()}function X(k,Y){Y===null?k.matrixWorld.copy(k.matrix):k.matrixWorld.multiplyMatrices(Y.matrixWorld,k.matrix),k.matrixWorldInverse.copy(k.matrixWorld).invert()}this.updateCamera=function(k){if(s===null)return;y.near=A.near=w.near=k.near,y.far=A.far=w.far=k.far,(E!==y.near||B!==y.far)&&(s.updateRenderState({depthNear:y.near,depthFar:y.far}),E=y.near,B=y.far);let Y=k.parent,at=y.cameras;X(y,Y);for(let gt=0;gt&$(k,Y),Y.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Y}),_=null}let ct=new rl;ct.setAnimationLoop(j),this.setAnimationLoop=function(k){$=k},this.dispose=function(){}}};function Mm(i,t){function e(p,u){p.matrixAutoUpdate===!0&&p.updateMatrix(),u.value.copy(p.matrix)}function n(p,u){u.color.getRGB(p.fogColor.value,sl(i)),u.isFog?(p.fogNear.value=u.near,p.fogFar.value=u.far):u.isFogExp2&&(p.fogDensity.value=u.density)}function s(p,u,M,x,T){u.isMeshBasicMaterial||u.isMeshLambertMaterial?r(p,u):u.isMeshToonMaterial?(r(p,u),d(p,u)):u.isMeshPhongMaterial?(r(p,u),h(p,u)):u.isMeshStandardMaterial?(r(p,u),f(p,u),u.isMeshPhysicalMaterial&&m(p,u,T)):u.isMeshMatcapMaterial?(r(p,u),_(p,u)):u.isMeshDepthMaterial?r(p,u):u.isMeshDistanceMaterial?(r(p,u),g(p,u)):u.isMeshNormalMaterial?r(p,u):u.isLineBasicMaterial?(o(p,u),u.isLineDashedMaterial&&a(p,u)):u.isPointsMaterial?c(p,u,M,x):u.isSpriteMaterial?l(p,u):u.isShadowMaterial?(p.color.value.copy(u.color),p.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function r(p,u){p.opacity.value=u.opacity,u.color&&p.diffuse.value.copy(u.color),u.emissive&&p.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(p.map.value=u.map,e(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,e(u.alphaMap,p.alphaMapTransform)),u.bumpMap&&(p.bumpMap.value=u.bumpMap,e(u.bumpMap,p.bumpMapTransform),p.bumpScale.value=u.bumpScale,u.side===ge&&(p.bumpScale.value*=-1)),u.normalMap&&(p.normalMap.value=u.normalMap,e(u.normalMap,p.normalMapTransform),p.normalScale.value.copy(u.normalScale),u.side===ge&&p.normalScale.value.negate()),u.displacementMap&&(p.displacementMap.value=u.displacementMap,e(u.displacementMap,p.displacementMapTransform),p.displacementScale.value=u.displacementScale,p.displacementBias.value=u.displacementBias),u.emissiveMap&&(p.emissiveMap.value=u.emissiveMap,e(u.emissiveMap,p.emissiveMapTransform)),u.specularMap&&(p.specularMap.value=u.specularMap,e(u.specularMap,p.specularMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest);let M=t.get(u).envMap;if(M&&(p.envMap.value=M,p.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=u.reflectivity,p.ior.value=u.ior,p.refractionRatio.value=u.refractionRatio),u.lightMap){p.lightMap.value=u.lightMap;let x=i._useLegacyLights===!0?Math.PI:1;p.lightMapIntensity.value=u.lightMapIntensity*x,e(u.lightMap,p.lightMapTransform)}u.aoMap&&(p.aoMap.value=u.aoMap,p.aoMapIntensity.value=u.aoMapIntensity,e(u.aoMap,p.aoMapTransform))}function o(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,u.map&&(p.map.value=u.map,e(u.map,p.mapTransform))}function a(p,u){p.dashSize.value=u.dashSize,p.totalSize.value=u.dashSize+u.gapSize,p.scale.value=u.scale}function c(p,u,M,x){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.size.value=u.size*M,p.scale.value=x*.5,u.map&&(p.map.value=u.map,e(u.map,p.uvTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,e(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function l(p,u){p.diffuse.value.copy(u.color),p.opacity.value=u.opacity,p.rotation.value=u.rotation,u.map&&(p.map.value=u.map,e(u.map,p.mapTransform)),u.alphaMap&&(p.alphaMap.value=u.alphaMap,e(u.alphaMap,p.alphaMapTransform)),u.alphaTest>0&&(p.alphaTest.value=u.alphaTest)}function h(p,u){p.specular.value.copy(u.specular),p.shininess.value=Math.max(u.shininess,1e-4)}function d(p,u){u.gradientMap&&(p.gradientMap.value=u.gradientMap)}function f(p,u){p.metalness.value=u.metalness,u.metalnessMap&&(p.metalnessMap.value=u.metalnessMap,e(u.metalnessMap,p.metalnessMapTransform)),p.roughness.value=u.roughness,u.roughnessMap&&(p.roughnessMap.value=u.roughnessMap,e(u.roughnessMap,p.roughnessMapTransform)),t.get(u).envMap&&(p.envMapIntensity.value=u.envMapIntensity)}function m(p,u,M){p.ior.value=u.ior,u.sheen>0&&(p.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),p.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(p.sheenColorMap.value=u.sheenColorMap,e(u.sheenColorMap,p.sheenColorMapTransform)),u.sheenRoughnessMap&&(p.sheenRoughnessMap.value=u.sheenRoughnessMap,e(u.sheenRoughnessMap,p.sheenRoughnessMapTransform))),u.clearcoat>0&&(p.clearcoat.value=u.clearcoat,p.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(p.clearcoatMap.value=u.clearcoatMap,e(u.clearcoatMap,p.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,e(u.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(p.clearcoatNormalMap.value=u.clearcoatNormalMap,e(u.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===ge&&p.clearcoatNormalScale.value.negate())),u.iridescence>0&&(p.iridescence.value=u.iridescence,p.iridescenceIOR.value=u.iridescenceIOR,p.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(p.iridescenceMap.value=u.iridescenceMap,e(u.iridescenceMap,p.iridescenceMapTransform)),u.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=u.iridescenceThicknessMap,e(u.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),u.transmission>0&&(p.transmission.value=u.transmission,p.transmissionSamplerMap.value=M.texture,p.transmissionSamplerSize.value.set(M.width,M.height),u.transmissionMap&&(p.transmissionMap.value=u.transmissionMap,e(u.transmissionMap,p.transmissionMapTransform)),p.thickness.value=u.thickness,u.thicknessMap&&(p.thicknessMap.value=u.thicknessMap,e(u.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=u.attenuationDistance,p.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(p.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(p.anisotropyMap.value=u.anisotropyMap,e(u.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=u.specularIntensity,p.specularColor.value.copy(u.specularColor),u.specularColorMap&&(p.specularColorMap.value=u.specularColorMap,e(u.specularColorMap,p.specularColorMapTransform)),u.specularIntensityMap&&(p.specularIntensityMap.value=u.specularIntensityMap,e(u.specularIntensityMap,p.specularIntensityMapTransform))}function _(p,u){u.matcap&&(p.matcap.value=u.matcap)}function g(p,u){let M=t.get(u).light;p.referencePosition.value.setFromMatrixPosition(M.matrixWorld),p.nearDistance.value=M.shadow.camera.near,p.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function Sm(i,t,e,n){let s={},r={},o=[],a=e.isWebGL2?i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(M,x){let T=x.program;n.uniformBlockBinding(M,T)}function l(M,x){let T=s[M.id];T===void 0&&(_(M),T=h(M),s[M.id]=T,M.addEventListener("dispose",p));let C=x.program;n.updateUBOMapping(M,C);let w=t.render.frame;r[M.id]!==w&&(f(M),r[M.id]=w)}function h(M){let x=d();M.__bindingPointIndex=x;let T=i.createBuffer(),C=M.__size,w=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,C,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,T),T}function d(){for(let M=0;M0&&(T+=C-w),M.__size=T,M.__cache={},this}function g(M){let x={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(x.boundary=4,x.storage=4):M.isVector2?(x.boundary=8,x.storage=8):M.isVector3||M.isColor?(x.boundary=16,x.storage=12):M.isVector4?(x.boundary=16,x.storage=16):M.isMatrix3?(x.boundary=48,x.storage=48):M.isMatrix4?(x.boundary=64,x.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),x}function p(M){let x=M.target;x.removeEventListener("dispose",p);let T=o.indexOf(x.__bindingPointIndex);o.splice(T,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function u(){for(let M in s)i.deleteBuffer(s[M]);o=[],s={},r={}}return{bind:c,update:l,dispose:u}}var ji=class{constructor(t={}){let{canvas:e=Ph(),context:n=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=t;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=o;let m=new Uint32Array(4),_=new Int32Array(4),g=null,p=null,u=[],M=[];this.domElement=e,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=oe,this._useLegacyLights=!1,this.toneMapping=wn,this.toneMappingExposure=1;let x=this,T=!1,C=0,w=0,A=null,H=-1,y=null,E=new pe,B=new pe,V=null,tt=new lt(0),P=0,U=e.width,G=e.height,q=1,X=null,W=null,$=new pe(0,0,U,G),j=new pe(0,0,U,G),ct=!1,k=new Qi,Y=!1,at=!1,gt=null,mt=new ae,Ct=new Tt,Lt=new L,St={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function kt(){return A===null?q:1}let D=n;function be(S,I){for(let F=0;F{function ot(){if(z.forEach(function(pt){Dt.get(pt).currentProgram.isReady()&&z.delete(pt)}),z.size===0){N(S);return}setTimeout(ot,10)}xt.get("KHR_parallel_shader_compile")!==null?ot():setTimeout(ot,10)})};let Zt=null;function ue(S){Zt&&Zt(S)}function Ee(){Te.stop()}function Jt(){Te.start()}let Te=new rl;Te.setAnimationLoop(ue),typeof self<"u"&&Te.setContext(self),this.setAnimationLoop=function(S){Zt=S,Ft.setAnimationLoop(S),S===null?Te.stop():Te.start()},Ft.addEventListener("sessionstart",Ee),Ft.addEventListener("sessionend",Jt),this.render=function(S,I){if(I!==void 0&&I.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),Ft.enabled===!0&&Ft.isPresenting===!0&&(Ft.cameraAutoUpdate===!0&&Ft.updateCamera(I),I=Ft.getCamera()),S.isScene===!0&&S.onBeforeRender(x,S,I,A),p=Mt.get(S,M.length),p.init(),M.push(p),mt.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),k.setFromProjectionMatrix(mt),at=this.localClippingEnabled,Y=Nt.init(this.clippingPlanes,at),g=ht.get(S,u.length),g.init(),u.push(g),tn(S,I,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(X,W),this.info.render.frame++,Y===!0&&Nt.beginShadows();let F=p.state.shadowsArray;if(Z.render(F,S,I),Y===!0&&Nt.endShadows(),this.info.autoReset===!0&&this.info.reset(),Wt.render(g,S),p.setupLights(x._useLegacyLights),I.isArrayCamera){let z=I.cameras;for(let N=0,ot=z.length;N0?p=M[M.length-1]:p=null,u.pop(),u.length>0?g=u[u.length-1]:g=null};function tn(S,I,F,z){if(S.visible===!1)return;if(S.layers.test(I.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(I);else if(S.isLight)p.pushLight(S),S.castShadow&&p.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||k.intersectsSprite(S)){z&&Lt.setFromMatrixPosition(S.matrixWorld).applyMatrix4(mt);let pt=Q.update(S),yt=S.material;yt.visible&&g.push(S,pt,yt,F,Lt.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||k.intersectsObject(S))){let pt=Q.update(S),yt=S.material;if(z&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),Lt.copy(S.boundingSphere.center)):(pt.boundingSphere===null&&pt.computeBoundingSphere(),Lt.copy(pt.boundingSphere.center)),Lt.applyMatrix4(S.matrixWorld).applyMatrix4(mt)),Array.isArray(yt)){let Et=pt.groups;for(let Ot=0,Rt=Et.length;Ot0&&Tl(N,ot,I,F),z&&dt.viewport(E.copy(z)),N.length>0&&os(N,I,F),ot.length>0&&os(ot,I,F),pt.length>0&&os(pt,I,F),dt.buffers.depth.setTest(!0),dt.buffers.depth.setMask(!0),dt.buffers.color.setMask(!0),dt.setPolygonOffset(!1)}function Tl(S,I,F,z){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;let ot=At.isWebGL2;gt===null&&(gt=new gn(1,1,{generateMipmaps:!0,type:xt.has("EXT_color_buffer_half_float")?Ji:An,minFilter:Zi,samples:ot?4:0})),x.getDrawingBufferSize(Ct),ot?gt.setSize(Ct.x,Ct.y):gt.setSize(pa(Ct.x),pa(Ct.y));let pt=x.getRenderTarget();x.setRenderTarget(gt),x.getClearColor(tt),P=x.getClearAlpha(),P<1&&x.setClearColor(16777215,.5),x.clear();let yt=x.toneMapping;x.toneMapping=wn,os(S,F,z),b.updateMultisampleRenderTarget(gt),b.updateRenderTargetMipmap(gt);let Et=!1;for(let Ot=0,Rt=I.length;Ot0),Pt=!!F.morphAttributes.position,ne=!!F.morphAttributes.normal,Ne=!!F.morphAttributes.color,de=wn;z.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(de=x.toneMapping);let sn=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,jt=sn!==void 0?sn.length:0,Bt=Dt.get(z),Sr=p.state.lights;if(Y===!0&&(at===!0||S!==y)){let ze=S===y&&z.id===H;Nt.setState(z,S,ze)}let ee=!1;z.version===Bt.__version?(Bt.needsLights&&Bt.lightsStateVersion!==Sr.state.version||Bt.outputColorSpace!==yt||N.isBatchedMesh&&Bt.batching===!1||!N.isBatchedMesh&&Bt.batching===!0||N.isInstancedMesh&&Bt.instancing===!1||!N.isInstancedMesh&&Bt.instancing===!0||N.isSkinnedMesh&&Bt.skinning===!1||!N.isSkinnedMesh&&Bt.skinning===!0||N.isInstancedMesh&&Bt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Bt.instancingColor===!1&&N.instanceColor!==null||Bt.envMap!==Et||z.fog===!0&&Bt.fog!==ot||Bt.numClippingPlanes!==void 0&&(Bt.numClippingPlanes!==Nt.numPlanes||Bt.numIntersection!==Nt.numIntersection)||Bt.vertexAlphas!==Ot||Bt.vertexTangents!==Rt||Bt.morphTargets!==Pt||Bt.morphNormals!==ne||Bt.morphColors!==Ne||Bt.toneMapping!==de||At.isWebGL2===!0&&Bt.morphTargetsCount!==jt)&&(ee=!0):(ee=!0,Bt.__version=z.version);let Fn=Bt.currentProgram;ee===!0&&(Fn=cs(z,I,N));let mo=!1,Bi=!1,br=!1,xe=Fn.getUniforms(),Bn=Bt.uniforms;if(dt.useProgram(Fn.program)&&(mo=!0,Bi=!0,br=!0),z.id!==H&&(H=z.id,Bi=!0),mo||y!==S){xe.setValue(D,"projectionMatrix",S.projectionMatrix),xe.setValue(D,"viewMatrix",S.matrixWorldInverse);let ze=xe.map.cameraPosition;ze!==void 0&&ze.setValue(D,Lt.setFromMatrixPosition(S.matrixWorld)),At.logarithmicDepthBuffer&&xe.setValue(D,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&xe.setValue(D,"isOrthographic",S.isOrthographicCamera===!0),y!==S&&(y=S,Bi=!0,br=!0)}if(N.isSkinnedMesh){xe.setOptional(D,N,"bindMatrix"),xe.setOptional(D,N,"bindMatrixInverse");let ze=N.skeleton;ze&&(At.floatVertexTextures?(ze.boneTexture===null&&ze.computeBoneTexture(),xe.setValue(D,"boneTexture",ze.boneTexture,b)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}N.isBatchedMesh&&(xe.setOptional(D,N,"batchingTexture"),xe.setValue(D,"batchingTexture",N._matricesTexture,b));let Er=F.morphAttributes;if((Er.position!==void 0||Er.normal!==void 0||Er.color!==void 0&&At.isWebGL2===!0)&&Ht.update(N,F,Fn),(Bi||Bt.receiveShadow!==N.receiveShadow)&&(Bt.receiveShadow=N.receiveShadow,xe.setValue(D,"receiveShadow",N.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(Bn.envMap.value=Et,Bn.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Bi&&(xe.setValue(D,"toneMappingExposure",x.toneMappingExposure),Bt.needsLights&&Al(Bn,br),ot&&z.fog===!0&&rt.refreshFogUniforms(Bn,ot),rt.refreshMaterialUniforms(Bn,z,q,G,gt),Ti.upload(D,fo(Bt),Bn,b)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(Ti.upload(D,fo(Bt),Bn,b),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&xe.setValue(D,"center",N.center),xe.setValue(D,"modelViewMatrix",N.modelViewMatrix),xe.setValue(D,"normalMatrix",N.normalMatrix),xe.setValue(D,"modelMatrix",N.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){let ze=z.uniformsGroups;for(let Tr=0,Cl=ze.length;Tr0&&b.useMultisampledRTT(S)===!1?N=Dt.get(S).__webglMultisampledFramebuffer:Array.isArray(Rt)?N=Rt[F]:N=Rt,E.copy(S.viewport),B.copy(S.scissor),V=S.scissorTest}else E.copy($).multiplyScalar(q).floor(),B.copy(j).multiplyScalar(q).floor(),V=ct;if(dt.bindFramebuffer(D.FRAMEBUFFER,N)&&At.drawBuffers&&z&&dt.drawBuffers(S,N),dt.viewport(E),dt.scissor(B),dt.setScissorTest(V),ot){let Et=Dt.get(S.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+I,Et.__webglTexture,F)}else if(pt){let Et=Dt.get(S.texture),Ot=I||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,Et.__webglTexture,F||0,Ot)}H=-1},this.readRenderTargetPixels=function(S,I,F,z,N,ot,pt){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let yt=Dt.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&pt!==void 0&&(yt=yt[pt]),yt){dt.bindFramebuffer(D.FRAMEBUFFER,yt);try{let Et=S.texture,Ot=Et.format,Rt=Et.type;if(Ot!==Je&&ut.convert(Ot)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pt=Rt===Ji&&(xt.has("EXT_color_buffer_half_float")||At.isWebGL2&&xt.has("EXT_color_buffer_float"));if(Rt!==An&&ut.convert(Rt)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Rt===En&&(At.isWebGL2||xt.has("OES_texture_float")||xt.has("WEBGL_color_buffer_float")))&&!Pt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=S.width-z&&F>=0&&F<=S.height-N&&D.readPixels(I,F,z,N,ut.convert(Ot),ut.convert(Rt),ot)}finally{let Et=A!==null?Dt.get(A).__webglFramebuffer:null;dt.bindFramebuffer(D.FRAMEBUFFER,Et)}}},this.copyFramebufferToTexture=function(S,I,F=0){let z=Math.pow(2,-F),N=Math.floor(I.image.width*z),ot=Math.floor(I.image.height*z);b.setTexture2D(I,0),D.copyTexSubImage2D(D.TEXTURE_2D,F,0,0,S.x,S.y,N,ot),dt.unbindTexture()},this.copyTextureToTexture=function(S,I,F,z=0){let N=I.image.width,ot=I.image.height,pt=ut.convert(F.format),yt=ut.convert(F.type);b.setTexture2D(F,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,F.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,F.unpackAlignment),I.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,z,S.x,S.y,N,ot,pt,yt,I.image.data):I.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,z,S.x,S.y,I.mipmaps[0].width,I.mipmaps[0].height,pt,I.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,z,S.x,S.y,pt,yt,I.image),z===0&&F.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),dt.unbindTexture()},this.copyTextureToTexture3D=function(S,I,F,z,N=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let ot=S.max.x-S.min.x+1,pt=S.max.y-S.min.y+1,yt=S.max.z-S.min.z+1,Et=ut.convert(z.format),Ot=ut.convert(z.type),Rt;if(z.isData3DTexture)b.setTexture3D(z,0),Rt=D.TEXTURE_3D;else if(z.isDataArrayTexture||z.isCompressedArrayTexture)b.setTexture2DArray(z,0),Rt=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,z.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,z.unpackAlignment);let Pt=D.getParameter(D.UNPACK_ROW_LENGTH),ne=D.getParameter(D.UNPACK_IMAGE_HEIGHT),Ne=D.getParameter(D.UNPACK_SKIP_PIXELS),de=D.getParameter(D.UNPACK_SKIP_ROWS),sn=D.getParameter(D.UNPACK_SKIP_IMAGES),jt=F.isCompressedTexture?F.mipmaps[N]:F.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,jt.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,jt.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,S.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,S.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,S.min.z),F.isDataTexture||F.isData3DTexture?D.texSubImage3D(Rt,N,I.x,I.y,I.z,ot,pt,yt,Et,Ot,jt.data):F.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(Rt,N,I.x,I.y,I.z,ot,pt,yt,Et,jt.data)):D.texSubImage3D(Rt,N,I.x,I.y,I.z,ot,pt,yt,Et,Ot,jt),D.pixelStorei(D.UNPACK_ROW_LENGTH,Pt),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,ne),D.pixelStorei(D.UNPACK_SKIP_PIXELS,Ne),D.pixelStorei(D.UNPACK_SKIP_ROWS,de),D.pixelStorei(D.UNPACK_SKIP_IMAGES,sn),N===0&&z.generateMipmaps&&D.generateMipmap(Rt),dt.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?b.setTextureCube(S,0):S.isData3DTexture?b.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?b.setTexture2DArray(S,0):b.setTexture2D(S,0),dt.unbindTexture()},this.resetState=function(){C=0,w=0,A=null,dt.reset(),It.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return pn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Ja?"display-p3":"srgb",e.unpackColorSpace=Xt.workingColorSpace===mr?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===oe?Jn:tl}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===Jn?oe: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(t){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=t}},Ca=class extends ji{};Ca.prototype.isWebGL1Renderer=!0;var ir=class extends Me{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(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,t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}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}},Pa=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=ua,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Rn()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:c,point:Gi.clone(),uv:qn.getInterpolation(Gi,Ls,Xi,Is,Fc,ia,Bc,new Tt),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 Us(i,t,e,n,s,r){yi.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(Wi.x=r*yi.x-s*yi.y,Wi.y=s*yi.x+r*yi.y):Wi.copy(yi),i.copy(t),i.x+=Wi.x,i.y+=Wi.y,i.applyMatrix4(ul)}var es=class extends nn{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new lt(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}},zc=new ae,La=new $i,Ds=new Ci,Ns=new L,rr=class extends Me{constructor(t=new Pe,e=new es){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 n=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ds.copy(n.boundingSphere),Ds.applyMatrix4(s),Ds.radius+=r,t.ray.intersectsSphere(Ds)===!1)return;zc.copy(s).invert(),La.copy(t.ray).applyMatrix4(zc);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,d=n.attributes.position;if(l!==null){let f=Math.max(0,o.start),m=Math.min(l.count,o.start+o.count);for(let _=f,g=m;_0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:t,face:null,object:o})}}var ar=class extends Ge{constructor(t,e,n,s,r,o,a,c,l){super(t,e,n,s,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}};var or=class i extends Pe{constructor(t=1,e=1,n=1,s=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};let l=this;s=Math.floor(s),r=Math.floor(r);let h=[],d=[],f=[],m=[],_=0,g=[],p=n/2,u=0;M(),o===!1&&(t>0&&x(!0),e>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new ie(d,3)),this.setAttribute("normal",new ie(f,3)),this.setAttribute("uv",new ie(m,2));function M(){let T=new L,C=new L,w=0,A=(e-t)/n;for(let H=0;H<=r;H++){let y=[],E=H/r,B=E*(e-t)+t;for(let V=0;V<=s;V++){let tt=V/s,P=tt*c+a,U=Math.sin(P),G=Math.cos(P);C.x=B*U,C.y=-E*n+p,C.z=B*G,d.push(C.x,C.y,C.z),T.set(U,A,G).normalize(),f.push(T.x,T.y,T.z),m.push(tt,1-E),y.push(_++)}g.push(y)}for(let H=0;H.9&&A<.1&&(x<.2&&(o[M+0]+=1),T<.2&&(o[M+2]+=1),C<.2&&(o[M+4]+=1))}}function f(M){r.push(M.x,M.y,M.z)}function m(M,x){let T=M*3;x.x=t[T+0],x.y=t[T+1],x.z=t[T+2]}function _(){let M=new L,x=new L,T=new L,C=new L,w=new Tt,A=new Tt,H=new Tt;for(let y=0,E=0;y0)&&m.push(x,T,w),(u!==n-1||c=r)){let a=e[1];t=r)break t}o=n,n=0;break e}break n}for(;n>>1;te;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}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 n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let a=0;a!==r;a++){let c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),t=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),t=!1;break}o=c}if(s!==void 0&&bm(s))for(let a=0,c=s.length;a!==c;++a){let l=s[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Ir,r=t.length-1,o=1;for(let a=1;a0){t[o]=t[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)e[c+l]=e[a+l];++o}return o!==t.length?(this.times=t.slice(0,o),this.values=e.slice(0,o*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};Ke.prototype.TimeBufferType=Float32Array;Ke.prototype.ValueBufferType=Float32Array;Ke.prototype.DefaultInterpolation=Hs;var Qn=class extends Ke{};Qn.prototype.ValueTypeName="bool";Qn.prototype.ValueBufferType=Array;Qn.prototype.DefaultInterpolation=zs;Qn.prototype.InterpolantFactoryMethodLinear=void 0;Qn.prototype.InterpolantFactoryMethodSmooth=void 0;var Oa=class extends Ke{};Oa.prototype.ValueTypeName="color";var Fa=class extends Ke{};Fa.prototype.ValueTypeName="number";var Ba=class extends Di{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-e)/(s-e),l=t*a;for(let h=l+a;l!==h;l+=4)Ln.slerpFlat(r,0,o,l-a,o,l,c);return r}},is=class extends Ke{InterpolantFactoryMethodLinear(t){return new Ba(this.times,this.values,this.getValueSize(),t)}};is.prototype.ValueTypeName="quaternion";is.prototype.DefaultInterpolation=Hs;is.prototype.InterpolantFactoryMethodSmooth=void 0;var jn=class extends Ke{};jn.prototype.ValueTypeName="string";jn.prototype.ValueBufferType=Array;jn.prototype.DefaultInterpolation=zs;jn.prototype.InterpolantFactoryMethodLinear=void 0;jn.prototype.InterpolantFactoryMethodSmooth=void 0;var za=class extends Ke{};za.prototype.ValueTypeName="vector";var Ha=class{constructor(t,e,n){let s=this,r=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,d){return l.push(h,d),this},this.removeHandler=function(h){let d=l.indexOf(h);return d!==-1&&l.splice(d,2),this},this.getHandler=function(h){for(let d=0,f=l.length;d"u"?Date:performance).now()}var Ka="\\[\\]\\.:\\/",Tm=new RegExp("["+Ka+"]","g"),Qa="[^"+Ka+"]",wm="[^"+Ka.replace("\\.","")+"]",Am=/((?:WC+[\/:])*)/.source.replace("WC",Qa),Rm=/(WCOD+)?/.source.replace("WCOD",wm),Cm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qa),Pm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qa),Lm=new RegExp("^"+Am+Rm+Cm+Pm+"$"),Im=["material","materials","bones","map"],Wa=class{constructor(t,e,n){let s=n||Kt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Kt=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Tm,"")}static parseTrackName(t){let e=Lm.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);Im.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let o=0;o{se.aspect=window.innerWidth/window.innerHeight,se.updateProjectionMatrix(),Nn.setSize(window.innerWidth,window.innerHeight)});var oo=(i,t,e)=>Math.min(Math.max(i,t),e),Se=(i,t,e)=>i+(t-i)*e,me=(i,t,e)=>{let n=oo((e-i)/(t-i),0,1);return n*n*(3-2*n)},Dm=i=>i<.5?2*i*i:1-Math.pow(-2*i+2,2)/2;function Fi(i,t,e){let n=document.createElement("canvas");n.width=i,n.height=t,e(n.getContext("2d"),i,t);let s=new ar(n);return s.colorSpace=oe,s}function yr(i){let t=new Uint8Array(512),e=i,n=()=>(e=e*16807%2147483647)/2147483647,s=[...Array(256).keys()];for(let l=255;l>0;l--){let h=Math.floor(n()*(l+1));[s[l],s[h]]=[s[h],s[l]]}for(let l=0;l<512;l++)t[l]=s[l&255];let r=l=>l*l*(3-2*l),o=(l,h,d)=>{let f=l&1?h:-h,m=l&2?d:-d;return f+m};function a(l,h){let d=Math.floor(l)&255,f=Math.floor(h)&255;l-=Math.floor(l),h-=Math.floor(h);let m=r(l),_=r(h),g=t[d]+f,p=t[d+1]+f;return Se(Se(o(t[g],l,h),o(t[p],l-1,h),m),Se(o(t[g+1],l,h-1),o(t[p+1],l-1,h-1),m),_)}function c(l,h,d=5){let f=0,m=.5,_=1;for(let g=0;g0.0 ? mix(mid,top,smoothstep(0.0,0.55,h)) : mix(mid,bot,smoothstep(0.0,-0.35,h)); gl_FragColor=vec4(c,1.0); }`}),Om=new Gt(new De(1500,24,16),vr);Be.add(Om);var ti=new $e;Be.add(ti);{let e=new Ii(420,420,90,90);e.rotateX(-Math.PI/2);let n=e.attributes.position,s=yr(7),r=new Float32Array(n.count*3),o=new lt(9420650),a=new lt(7252047),c=new lt(12163688);for(let g=0;g9&&T.lerp(c,me(9,16,M)*.7),r[g*3]=T.r,r[g*3+1]=T.g,r[g*3+2]=T.b}e.setAttribute("color",new _e(r,3)),e.computeVertexNormals();let l=new Gt(e,new Le({vertexColors:!0,roughness:1,metalness:0,transparent:!0}));l.name="terrain",ti.add(l);let h=(g,p)=>{let u=(s.fbm(g*.05+3,p*.05+3,4)-.45)*14,M=Math.hypot(g,p);return u+=me(60,150,M)*16,u*=1-me(6,14,M)*.9,u},d=new cr(1,0),f=new Le({color:5147706,roughness:1,transparent:!0,flatShading:!0}),m=yr(31);for(let g=0;g<90;g++){let p=m.noise(g*.7,g*1.3)*Math.PI*2,u=14+Math.abs(m.noise(g*2.1,g*.5))*120,M=new Gt(d,f),x=.6+g%5*.35;M.scale.set(x,x*.8,x);let T=Math.cos(p)*u,C=Math.sin(p)*u;M.position.set(T,h(T,C)+x*.4,C),ti.add(M)}let _=new Le({color:8019002,roughness:1,transparent:!0});for(let g=0;g<6;g++){let p=new Gt(new Kn(16,.5,1.4),_);p.position.set(-14+g*5.6,h(-14+g*5.6,9)+.25,9),ti.add(p)}}var he=new $e;{let i=new Le({color:14262622,roughness:.8,transparent:!0}),t=new Gt(new De(1,32,24),i);t.scale.set(1,1.12,.95),t.position.y=1.1,he.add(t),he.userData.body=i;let e=new Le({color:16777215,roughness:.3,transparent:!0}),n=new Le({color:2759696,roughness:.3,transparent:!0});[-.34,.34].forEach(d=>{let f=new Gt(new De(.17,16,12),e);f.position.set(d,1.42,.82),he.add(f);let m=new Gt(new De(.09,12,10),n);m.position.set(d+.02,1.42,.95),he.add(m)});let s=new Le({color:15769728,roughness:1,transparent:!0});[-.55,.55].forEach(d=>{let f=new Gt(new De(.12,10,8),s);f.scale.set(1,.55,.4),f.position.set(d,1.18,.78),he.add(f)});let r=new Gt(new ns(.2,.05,8,20,Math.PI),n);r.position.set(0,1.26,.93),r.rotation.set(0,0,Math.PI),he.add(r);let o=new Le({color:5147706,roughness:1,transparent:!0}),a=new Gt(new or(.045,.06,.5,8),o);a.position.set(0,2.32,0),a.rotation.z=.12,he.add(a);let c=new De(.22,12,8);[-1,1].forEach(d=>{let f=new Gt(c,o);f.scale.set(1.5,.5,.8),f.position.set(d*.3,2.5,0),f.rotation.z=d*-.5,he.add(f)});let l=new Gt(new De(1.55,32,24),new lr({color:13625599,transparent:!0,opacity:.16,shininess:90,specular:16777215,depthWrite:!1}));l.position.y=1.25,he.add(l);let h=new Gt(new ns(1.5,.07,10,40),new Le({color:15263982,roughness:.4,metalness:.6,transparent:!0}));h.rotation.x=Math.PI/2,h.position.y=.35,he.add(h)}Be.add(he);var dl=new L(0,.4,2.2),Fm=Fi(256,256,(i,t,e)=>{i.clearRect(0,0,t,e);for(let n=0;n<26;n++){let s=40+Math.random()*(t-80),r=60+Math.random()*(e-120),o=24+Math.random()*46,a=i.createRadialGradient(s,r,0,s,r,o);a.addColorStop(0,"rgba(255,255,255,0.85)"),a.addColorStop(1,"rgba(255,255,255,0)"),i.fillStyle=a,i.beginPath(),i.arc(s,r,o,0,Math.PI*2),i.fill()}}),no=[];for(let i=0;i<10;i++){let t=new Gt(new Ii(60,60),new Pi({map:Fm,transparent:!0,opacity:.85,depthWrite:!1})),e=i/10*Math.PI*2;t.position.set(Math.cos(e)*(10+i%3*12),26+i*13,Math.sin(e)*(10+i%3*12)),t.rotation.y=Math.random()*Math.PI,Be.add(t),no.push(t)}var On=new $e;On.visible=!1;Be.add(On);var Bm=yr(1234),io=Fi(1024,512,(i,t,e)=>{let n=i.createImageData(t,e);for(let s=0;s.068){let u=(d-.068)/.14;m=Se(58,118,u),_=Se(128,152,u),g=Se(56,84,u),d>.26&&(m=158,_=140,g=100)}else{let u=me(-.06,.068,d);m=Se(10,32,u),_=Se(52,108,u),g=Se(110,176,u)}f>0&&(m=Se(m,240,f),_=Se(_,246,f),g=Se(g,250,f));let p=(s*t+o)*4;n.data[p]=m,n.data[p+1]=_,n.data[p+2]=g,n.data[p+3]=255}}i.putImageData(n,0,0)}),so=new Le({map:io,roughness:.9,metalness:0,transparent:!0,opacity:0}),co=new Gt(new De(Oi,96,64),so);co.rotation.z=.1;On.add(co);var zm=yr(777),Hm=Fi(1024,512,(i,t,e)=>{let n=i.createImageData(t,e);for(let s=0;s{let n=i.createRadialGradient(t/2,e/2,0,t/2,e/2,t/2);n.addColorStop(0,"rgba(255,250,230,1)"),n.addColorStop(.18,"rgba(255,224,150,0.9)"),n.addColorStop(.5,"rgba(255,180,90,0.25)"),n.addColorStop(1,"rgba(255,160,60,0)"),i.fillStyle=n,i.fillRect(0,0,t,e)}),Un=new ts(new Ui({map:Vm,transparent:!0,depthWrite:!1,opacity:.9}));Un.scale.set(260,260,1);Be.add(Un);var ro=new Pe;{let t=new Float32Array(7800),e=new Float32Array(2600*3);for(let n=0;n<2600;n++){let s=new L().randomDirection().multiplyScalar(900+Math.random()*1600);t[n*3]=s.x,t[n*3+1]=s.y,t[n*3+2]=s.z;let r=.75+Math.random()*.25,o=Math.random();e[n*3]=r,e[n*3+1]=r*(o>.8?.9:1),e[n*3+2]=r*(o<.25?.92:1)}ro.setAttribute("position",new _e(t,3)),ro.setAttribute("color",new _e(e,3))}var Gm=Fi(32,32,(i,t,e)=>{let n=i.createRadialGradient(t/2,e/2,0,t/2,e/2,t/2);n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.8)"),n.addColorStop(1,"rgba(255,255,255,0)"),i.fillStyle=n,i.fillRect(0,0,t,e)}),Ml=new es({size:5.2,map:Gm,vertexColors:!0,transparent:!0,opacity:0,sizeAttenuation:!1,depthWrite:!1}),Wm=new rr(ro,Ml);Be.add(Wm);var Sl=new Le({color:13619158,roughness:1,transparent:!0,opacity:0}),lo=new Gt(new De(7,32,24),Sl);lo.position.set(320,90,-260);Be.add(lo);var Xm=Fi(128,128,(i,t,e)=>{let n=i.createRadialGradient(t/2,e/2,0,t/2,e/2,t/2);n.addColorStop(0,"rgba(255,240,180,1)"),n.addColorStop(.3,"rgba(255,210,90,0.85)"),n.addColorStop(.6,"rgba(255,170,60,0.25)"),n.addColorStop(1,"rgba(255,160,50,0)"),i.fillStyle=n,i.fillRect(0,0,t,e)}),Mr=[],bl=new $e;On.add(bl);ml.forEach((i,t)=>{let e=i.lat*Math.PI/180,n=i.lon*Math.PI/180,s=new L(Oi*Math.cos(e)*Math.cos(n),Oi*Math.sin(e),-Oi*Math.cos(e)*Math.sin(n)),r=new ts(new Ui({map:Xm,transparent:!0,depthWrite:!1,opacity:0}));r.position.copy(s).multiplyScalar(1.015),r.scale.set(8,8,1),r.userData={valley:i,base:8,idx:t},bl.add(r),Mr.push(r)});var Ie={start:document.getElementById("start"),launch:document.getElementById("launch"),spacebar:document.getElementById("spacebar"),photo:document.getElementById("photo"),card:document.getElementById("card"),cardTitle:document.getElementById("cardTitle"),cardLine:document.getElementById("cardLine"),toast:document.getElementById("toast")};Ie.launch.addEventListener("click",()=>{Dn==="valley"&&(Dn="rising",rs=0,Ie.start.classList.add("hide"),Ie.launch.classList.add("hide"))});var to=!1;Ie.photo.addEventListener("click",()=>{if(!to){to=!0;try{qm(),Ie.toast.textContent="\u5168\u5BB6\u798F\u5DF2\u4FDD\u5B58\u5230\u76F8\u518C/\u4E0B\u8F7D \u{1F4F8}"}catch{Ie.toast.textContent="\u8FD9\u5F20\u6CA1\u5B58\u4E0A\uFF0C\u518D\u70B9\u4E00\u6B21\u8BD5\u8BD5"}Ie.toast.classList.add("show"),setTimeout(()=>Ie.toast.classList.remove("show"),2600),setTimeout(()=>{to=!1},800)}});function qm(){Nn.render(Be,se);let i=Nn.domElement,t=1080,e=1620,n=document.createElement("canvas");n.width=t,n.height=e;let s=n.getContext("2d"),r=s.createLinearGradient(0,0,0,e);r.addColorStop(0,"#05060f"),r.addColorStop(1,"#101a33"),s.fillStyle=r,s.fillRect(0,0,t,e);for(let f=0;f<140;f++)s.fillStyle=`rgba(255,255,255,${.2+Math.random()*.6})`,s.fillRect(Math.random()*t,Math.random()*e*.7,1.6,1.6);let o=Math.max(t/i.width,e*.62/i.height),a=i.width*o,c=i.height*o;s.drawImage(i,(t-a)/2,90,a,c),s.fillStyle="rgba(255,255,255,0.96)",s.textAlign="center",s.font='700 64px "PingFang SC","Microsoft YaHei",sans-serif',s.fillText("\u5347\u7A7A\u7EAA\u5FF5",t/2,e*.72),s.font='400 30px "PingFang SC","Microsoft YaHei",sans-serif',s.fillStyle="rgba(255,255,255,0.75)",s.fillText("\u548C\u4F5C\u7269\u5A03\u5A03\u4E00\u8D77\uFF0C\u770B\u89C1\u4E86\u6574\u4E2A\u5730\u7403",t/2,e*.72+58);let l=new Date;s.fillText(`${l.getFullYear()} \u5E74 ${l.getMonth()+1} \u6708 ${l.getDate()} \u65E5`,t/2,e*.72+104),s.font='400 24px "PingFang SC","Microsoft YaHei",sans-serif',s.fillStyle="rgba(255,214,120,0.9)";let h=ml.map(f=>f.name).join(" \xB7 ");s.fillText(h.slice(0,19),t/2,e*.72+170),s.fillText(h.slice(20),t/2,e*.72+208),s.font='400 22px "PingFang SC","Microsoft YaHei",sans-serif',s.fillStyle="rgba(255,255,255,0.45)",s.fillText("\u73A9\u8FC7\u7684\u65F6\u95F4\uFF0C\u957F\u6210\u4E86\u89C1\u8BC6 \xB7 songhuo.cn",t/2,e-70);let d=document.createElement("a");d.download=`\u5347\u7A7A\u7EAA\u5FF5-${l.getFullYear()}${String(l.getMonth()+1).padStart(2,"0")}${String(l.getDate()).padStart(2,"0")}.png`,d.href=n.toDataURL("image/png"),d.click()}var Qe=null,je={theta:Math.PI*.5+0,phi:Math.PI/2-35*Math.PI/180*0+35*Math.PI/180};function Ym(i){return{theta:Math.atan2(i.x,i.z),phi:Math.acos(oo(i.y/i.length(),-1,1))}}{let i=33*Math.PI/180,t=108*Math.PI/180,e=new L(Math.cos(i)*Math.cos(t),Math.sin(i),-Math.cos(i)*Math.sin(t)),n=Ym(e);je.theta=n.theta,je.phi=n.phi}function fl(){return new L(ja*Math.sin(je.phi)*Math.sin(je.theta),ja*Math.cos(je.phi),ja*Math.sin(je.phi)*Math.cos(je.theta))}ao.addEventListener("pointerdown",i=>{Qe={x:i.clientX,y:i.clientY,moved:!1}});ao.addEventListener("pointermove",i=>{if(!Qe||Dn!=="space")return;let t=i.clientX-Qe.x,e=i.clientY-Qe.y;Math.abs(t)+Math.abs(e)>4&&(Qe.moved=!0),je.theta-=t*.005,je.phi=oo(je.phi-e*.005,.25,Math.PI-.25),Qe.x=i.clientX,Qe.y=i.clientY});window.addEventListener("pointerup",i=>{Qe&&!Qe.moved&&Dn==="space"&&Zm(i),Qe=null});var pl=new fr,eo=new Tt;function Zm(i){eo.x=i.clientX/window.innerWidth*2-1,eo.y=-(i.clientY/window.innerHeight)*2+1,pl.setFromCamera(eo,se);let t=pl.intersectObjects(Mr);if(t.length){let e=t[0].object.userData.valley;Ie.cardTitle.textContent=e.name,Ie.cardLine.textContent=e.line,Ie.card.classList.add("show"),clearTimeout(Ie.card._t),Ie.card._t=setTimeout(()=>Ie.card.classList.remove("show"),3400)}}var Jm=new dr,_r=new L,$m=new L,xr=new L,Km=new L(0,0,0),Qm=new L(0,1,0),jm=new L(0,2.7,9.6),tg=new L(0,1.7,2.2),In=[{t:0,top:new lt(8308976),mid:new lt(16767392),bot:new lt(16751196)},{t:.3,top:new lt(4890600),mid:new lt(12574965),bot:new lt(16765088)},{t:.55,top:new lt(1325690),mid:new lt(2775720),bot:new lt(4876976)},{t:.8,top:new lt(197906),mid:new lt(528936),bot:new lt(661552)},{t:1,top:new lt(131592),mid:new lt(198159),bot:new lt(264208)}],eg=new lt,ng=new lt,ig=new lt;function sg(i){let t=In[0],e=In[In.length-1];for(let s=0;s=In[s].t&&i<=In[s+1].t){t=In[s],e=In[s+1];break}let n=(i-t.t)/Math.max(e.t-t.t,1e-6);vr.uniforms.top.value.copy(eg.lerpColors(t.top,e.top,n)),vr.uniforms.mid.value.copy(ng.lerpColors(t.mid,e.mid,n)),vr.uniforms.bot.value.copy(ig.lerpColors(t.bot,e.bot,n))}var _n=0;function El(){requestAnimationFrame(El);let i=Math.min(Jm.getDelta(),.05);if(_n+=i,Dn==="valley")se.position.set(Math.sin(_n*.12)*.5,2.7+Math.sin(_n*.5)*.06,9.6),se.lookAt(0,1.7,2.2),he.position.copy(dl),he.position.y+=Math.sin(_n*1.6)*.04,he.rotation.y=Math.sin(_n*.4)*.15,Un.position.set(-430,70,320),Un.material.opacity=.85;else if(Dn==="rising"){rs=Math.min(rs+i/Nm,1);let t=rs,e=Dm(t);_r.copy(fl()),se.position.lerpVectors(jm,_r,e),se.position.y+=Math.sin(e*Math.PI)*26,se.lookAt($m.lerpVectors(tg,Km,me(.25,.6,t))),sg(t),Ml.opacity=me(.35,.75,t),no.forEach(a=>{a.material.opacity=.85*(1-me(.5,.75,t)),a.lookAt(se.position)});let n=me(.5,.78,t);ti.traverse(a=>{a.material&&(a.material.opacity=1-n)}),ti.position.y=-n*60;let s=me(.6,.88,t);On.visible=s>.01,so.opacity=s,xl.opacity=s*.85,yl.uniforms.k.value=s,Sl.opacity=s*.95,Mr.forEach(a=>{a.material.opacity=s});let r=me(.04,.28,t);xr.set(2.6,-1.35,-3.4).applyQuaternion(se.quaternion).add(se.position),he.position.lerpVectors(dl,xr,r),he.rotation.y=Se(he.rotation.y,.2,r);let o=Se(70,150,me(.35,.85,t));Un.position.set(-430+170*me(.35,.85,t),o,320),Un.material.opacity=Se(.85,1,t)*(1-me(.88,1,t)),Un.scale.setScalar(Se(260,420,t)),as.position.copy(gl).multiplyScalar(100).lerp(new L(-60,30,80),me(.5,.9,t)),t>=1&&(Dn="space",ti.visible=!1,no.forEach(a=>a.visible=!1),Ie.spacebar.classList.add("show"))}else Qe||(je.theta+=i*.012),se.position.copy(fl()),se.lookAt(0,0,0),_r.copy(se.position).normalize().applyAxisAngle(Qm,.32),as.position.copy(_r).multiplyScalar(100),Un.material.opacity=0,xr.set(2.6,-1.35+Math.sin(_n*1.1)*.12,-3.4).applyQuaternion(se.quaternion).add(se.position),he.position.copy(xr),he.lookAt(se.position),co.rotation.y+=i*.02,vl.rotation.y+=i*.028,Mr.forEach((t,e)=>{let n=1+Math.sin(_n*2+e)*.12;t.scale.set(8*n,8*n,1)}),lo.position.set(Math.cos(_n*.05)*330,90,Math.sin(_n*.05)*330);window.__dbg={phase:Dn,t:rs},window.__dbg3d={earthOpacity:so.opacity,earthVisible:On.visible,cam:se.position.toArray().map(t=>+t.toFixed(1)),sun:as.position.toArray().map(t=>+t.toFixed(1)),tex:io.image?io.image.width:null,tris:Nn.info.render.triangles},Nn.render(Be,se)}El();})(); /*! Bundled license information: three/three.module.js: (** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT *) */