<!-- SOLID-PLAYTIME · part 157 -->
n=J.environment!==null&&_.envMap===null?F.environmentRotation:_.envMapRotation,Vt===void 0)_.addEventListener("dispose",ct),Vt=new Map,J.programs=Vt;let $t=Vt.get(wt);if($t!==void 0){if(J.currentProgram===$t&&J.lightsStateVersion===Mt)return ag(_,Pt),$t}else Pt.uniforms=B.getUniforms(_),_.onBeforeCompile(Pt,m),$t=B.acquireProgram(Pt,wt),Vt.set(wt,$t),J.uniforms=Pt.uniforms;let Ot=J.uniforms;if(!_.isShaderMaterial&&!_.isRawShaderMaterial||_.clipping===!0)Ot.clippingPlanes=Tt.uniform;if(ag(_,Pt),J.needsLights=l_(_),J.lightsStateVersion=Mt,J.needsLights)Ot.ambientLightColor.value=N.state.ambient,Ot.lightProbe.value=N.state.probe,Ot.directionalLights.value=N.state.directional,Ot.directionalLightShadows.value=N.state.directionalShadow,Ot.spotLights.value=N.state.spot,Ot.spotLightShadows.value=N.state.spotShadow,Ot.rectAreaLights.value=N.state.rectArea,Ot.ltc_1.value=N.state.rectAreaLTC1,Ot.ltc_2.value=N.state.rectAreaLTC2,Ot.pointLights.value=N.state.point,Ot.pointLightShadows.value=N.state.pointShadow,Ot.hemisphereLights.value=N.state.hemi,Ot.directionalShadowMap.value=N.state.directionalShadowMap,Ot.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Ot.spotShadowMap.value=N.state.spotShadowMap,Ot.spotLightMatrix.value=N.state.spotLightMatrix,Ot.spotLightMap.value=N.state.spotLightMap,Ot.pointShadowMap.value=N.state.pointShadowMap,Ot.pointShadowMatrix.value=N.state.pointShadowMatrix;return J.currentProgram=$t,J.uniformsList=null,$t}function sg(_){if(_.uniformsList===null){let F=_.currentProgram.getUniforms();_.uniformsList=Gc.seqWithValue(F.seq,_.uniforms)}return _.uniformsList}function ag(_,F){let G=Dt.get(_);G.outputColorSpace=F.outputColorSpace,G.batching=F.batching,G.batchingColor=F.batchingColor,G.instancing=F.instancing,G.instancingColor=F.instancingColor,G.instancingMorph=F.instancingMorph,G.skinning=F.skinning,G.morphTargets=F.morphTargets,G.morphNormals=F.morphNormals,G.morphColors=F.morphColors,G.morphTargetsCount=F.morphTargetsCount,G.numClippingPlanes=F.numClippingPlanes,G.numIntersection=F.numClipIntersection,G.vertexAlphas=F.vertexAlphas,G.vertexTangents=F.vertexTangents,G.toneMapping=F.toneMapping}function r_(_,F,G,J,N){if(F.isScene!==!0)F=Ht;It.resetTextureUnits();let ut=F.fog,Mt=J.isMeshStandardMaterial?F.environment:null,Pt=T===null?m.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:Pc,wt=(J.isMeshStandardMaterial?be:xe).get(J.envMap||Mt),Vt=J.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,$t=!!G.attributes.tangent&&(!!J.normalMap||J.anisotropy>0),Ot=!!G.morphAttributes.position,se=!!G.morphAttributes.normal,Re=!!G.morphAttributes.color,Qe=Ps;if(J.toneMapped){if(T===null||T.isXRRenderTarget===!0)Qe=m.toneMapping}let Oe=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,He=Oe!==void 0?Oe.length:0,zt=Dt.get(J),Je=U.state.lights;if(Et===!0){if(X===!0||_!==b){let In=_===b&&J.id===w;Tt.setState(J,_,In)}}let pe=!1;if(J.version===zt.__version){if(zt.needsLights&&zt.lightsStateVersion!==Je.state.version)pe=!0;else if(zt.outputColorSpace!==Pt)pe=!0;else if(N.isBatchedMesh&&zt.batching===!1)pe=!0;else if(!N.isBatchedMesh&&zt.batching===!0)pe=!0;else if(N.isBatchedMesh&&zt.batchingColor===!0&&N.colorTexture===null)pe=!0;else if(N.isBatchedMesh&&zt.batchingColor===!1&&N.colorTexture!==null)pe=!0;else if(N.isInstancedMesh&&zt.instancing===!1)pe=!0;else if(!N.isInstancedMesh&&zt.instancing===!0)pe=!0;else if(N.isSkinnedMesh&&zt.skinning===!1)pe=!0;else if(!N.isSkinnedMesh&&zt.skinning===!0)pe=!0;else if(N.isInstancedMesh&&zt.instancingColor===!0&&N.instanceColor===null)pe=!0;else if(N.isInstancedMesh&&zt.instancingColor===!1&&N.instanceColor!==null)pe=!0;else if(N.isInstancedMesh&&zt.instancingMorph===!0&&N.morphTexture===null)pe=!0;else if(N.isInstancedMesh&&zt.instancingMorph===!1&&N.morphTexture!==null)pe=!0;else if(zt.envMap!==wt)pe=!0;else if(J.fog===!0&&zt.fog!==ut)pe=!0;else if(zt.numClippingPlanes!==void 0&&(zt.numClippingPlanes!==Tt.numPlanes||zt.numIntersection!==Tt.numIntersection))pe=!0;else if(zt.vertexAlphas!==Vt)pe=!0;else if(zt.vertexTangents!==$t)pe=!0;else if(zt.morphTargets!==Ot)pe=!0;else if(zt.morphNormals!==se)pe=!0;else if(zt.morphColors!==Re)pe=!0;else if(zt.toneMapping!==Qe)pe=!0;else if(zt.morphTargetsCount!==He)pe=!0}else pe=!0,zt.__version=J.version;let Kn=zt.currentProgram;if(pe===!0)Kn=Yc(J,F,N);let br=!1,jn=!1,sl=!1,We=Kn.getUniforms(),di=zt.uniforms;if(St.useProgram(Kn.program))br=!0,jn=!0,sl=!0;if(J.id!==w)w=J.id,jn=!0;if(br||b!==_){if(St.buffers.depth.getReversed()&&_.reversedDepth!==!0)_._reversedDepth=!0,_.updateProjectionMatrix();We.setValue(D,"projectionMatrix",_.projectionMatrix),We.setValue(D,"viewMatrix",_.matrixWorldInverse);let zn=We.map.cameraPosition;if(zn!==void 0)zn.setValue(D,Y.setFromMatrixPosition(_.matrixWorld));if(Bt.logarithmicDepthBuffer)We.setValue(D,"logDepthBufFC",2/(Math.log(_.far+1)/Math.LN2));if(J.isMeshPhongMaterial||J.isMeshToonMateri