<!-- SOLID CITY · part 3375 -->
===null&&M&&(f=new XRWebGLBinding(s,t)),f},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function($){if(s=$,s!==null){if(A=e.getRenderTarget(),s.addEventListener("select",q),s.addEventListener("selectstart",q),s.addEventListener("selectend",q),s.addEventListener("squeeze",q),s.addEventListener("squeezestart",q),s.addEventListener("squeezeend",q),s.addEventListener("end",X),s.addEventListener("inputsourceschange",ie),b.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(C),M&&"createProjectionLayer"in XRWebGLBinding.prototype){let ve=null,Ve=null,be=null;b.depth&&(be=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ve=b.stencil?Xi:ri,Ve=b.stencil?sr:Jn);let Ge={colorFormat:t.RGBA8,depthFormat:be,scaleFactor:r};f=this.getBinding(),u=f.createProjectionLayer(Ge),s.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),v=new xn(u.textureWidth,u.textureHeight,{format:Fn,type:yn,depthTexture:new Fi(u.textureWidth,u.textureHeight,Ve,void 0,void 0,void 0,void 0,void 0,void 0,ve),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1,storeMultisampledDepthBuffer:u.ignoreDepthValues===!1,storeMultisampledStencilBuffer:u.ignoreDepthValues===!1})}else{let ve={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(s,t,ve),s.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new xn(d.framebufferWidth,d.framebufferHeight,{format:Fn,type:yn,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await s.requestReferenceSpace(o),ot.setContext(s),ot.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function ie($){for(let ee=0;ee<$.removed.length;ee++){let ve=$.removed[ee],Ve=E.indexOf(ve);Ve>=0&&(E[Ve]=null,T[Ve].disconnect(ve))}for(let ee=0;ee<$.added.length;ee++){let ve=$.added[ee],Ve=E.indexOf(ve);if(Ve===-1){for(let Ge=0;Ge<T.length;Ge++)if(Ge>=E.length){E.push(ve),Ve=Ge;break}else if(E[Ge]===null){E[Ge]=ve,Ve=Ge;break}if(Ve===-1)break}let be=T[Ve];be&&be.connect(ve)}}let Y=new P,j=new P;function ne($,ee,ve){Y.setFromMatrixPosition(ee.matrixWorld),j.setFromMatrixPosition(ve.matrixWorld);let Ve=Y.distanceTo(j),be=ee.projectionMatrix.elements,Ge=ve.projectionMatrix.elements,xt=be[14]/(be[10]-1),te=be[14]/(be[10]+1),re=(be[9]+1)/be[5],ae=(be[9]-1)/be[5],oe=(be[8]-1)/be[0],ue=(Ge[8]+1)/Ge[0],ze=xt*oe,Fe=xt*ue,We=Ve/(-oe+ue),qe=We*-oe;if(ee.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(qe),$.translateZ(We),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),be[10]===-1)$.projectionMatrix.copy(ee.projectionMatrix),$.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{let L=xt+We,pt=te+We,nt=ze-qe,R=Fe+(Ve-qe),_=re*te/pt*L,B=ae*te/pt*L;$.projectionMatrix.makePerspective(nt,R,_,B,L,pt),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function Pe($,ee){ee===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(ee.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(s===null)return;let ee=$.near,ve=$.far;m.texture!==null&&(m.depthNear>0&&(ee=m.depthNear),m.depthFar>0&&(ve=m.depthFar)),V.near=D.near=I.near=ee,V.far=D.far=I.far=ve,(N!==V.near||z!==V.far)&&(s.updateRenderState({depthNear:V.near,depthFar:V.far}),N=V.near,z=V.far),V.layers.mask=$.layers.mask|6,I.layers.mask=V.layers.mask&-5,D.layers.mask=V.layers.mask&-3;let Ve=$.parent,be=V.cameras;Pe(V,Ve);for(let Ge=0;Ge<be.length;Ge++)Pe(be[Ge],Ve);be.length===2?ne(V,I,D):V.projectionMatrix.copy(I.projectionMatrix),w===null&&$.isPerspectiveCamera&&(w={camera:$,fov:$.fov,zoom:$.zoom}),we($,V,Ve)};function we($,ee,ve){ve===null?$.matrix.copy(ee.matrixWorld):($.matrix.copy(ve.matrixWorld),$.matrix.invert(),$.matrix.multiply(ee.matrixWorld)),$.matrix.decompose($.position,$.quaternion,$.scale),$.updateMatrixWorld(!0),$.projectionMatrix.copy(ee.projectionMatrix),$.projectionMatrixInverse.copy(ee.projectionMatrixInverse),$.isPerspectiveCamera&&($.fov=Mo*2*Math.atan(1/$.projectionMatrix.elements[5]),$.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(u===null&&d===null))return l},this.setFoveation=function($){l=$,u!==null&&(u.fixedFoveation=$),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=$)},this.hasDepthSensing=function(){return m