| 153 | x.id||"Oculus Go Controller"===x.id||"OpenVR Gamepad"===x.id||x.id.startsWith("Oculus Touch")||x.id.startsWith("Spatial Controller"))){if(n===d){d=x;break b}n++}}d=void 0}if(void 0!==d&&void 0!==d.pose){if(null===d.pose)break a;q=d.pose;!1===q.hasPosition&&c.position.set(.2,-.6,-.05);null!==q.position&&c.position.fromArray(q.position);null!==q.orientation&&c.quaternion.fromArray(q.orientation);c.matrix.compose(c.position,c.quaternion,c.scale);c.matrix.premultiply(l);c.matrix.decompose(c.position, |
| 154 | c.quaternion,c.scale);c.matrixWorldNeedsUpdate=!0;c.visible=!0;q="Daydream Controller"===d.id?0:1;F[a]!==d.buttons[q].pressed&&(F[a]=d.buttons[q].pressed,!0===F[a]?c.dispatchEvent({type:"selectstart"}):(c.dispatchEvent({type:"selectend"}),c.dispatchEvent({type:"select"})))}else c.visible=!1}return z};this.getStandingMatrix=function(){return l};this.isPresenting=b;var G=new de;this.setAnimationLoop=function(a){G.setAnimationLoop(a);b()&&G.start()};this.submitFrame=function(){b()&&e.submitFrame()}; |
| 155 | this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",c)}}function gh(a){function b(){return null!==h&&null!==m}function c(a){var b=k[t.indexOf(a.inputSource)];b&&b.dispatchEvent({type:a.type})}function d(){a.setFramebuffer(null);a.setRenderTarget(a.getRenderTarget());x.stop()}function e(a,b){null===b?a.matrixWorld.copy(a.matrix):a.matrixWorld.multiplyMatrices(b.matrixWorld,a.matrix);a.matrixWorldInverse.getInverse(a.matrixWorld)}var f=a.context, |
| 156 | g=null,h=null,l=1,m=null,q="stage",p=null,k=[],t=[],r=new ca;r.layers.enable(1);r.viewport=new W;var u=new ca;u.layers.enable(2);u.viewport=new W;var n=new Jc([r,u]);n.layers.enable(1);n.layers.enable(2);this.enabled=!1;this.getController=function(a){var b=k[a];void 0===b&&(b=new Xb,b.matrixAutoUpdate=!1,b.visible=!1,k[a]=b);return b};this.getDevice=function(){return g};this.setDevice=function(a){void 0!==a&&(g=a);a instanceof XRDevice&&f.setCompatibleXRDevice(a)};this.setFramebufferScaleFactor=function(a){l= |
| 157 | a};this.setFrameOfReferenceType=function(a){q=a};this.setSession=function(b){h=b;null!==h&&(h.addEventListener("select",c),h.addEventListener("selectstart",c),h.addEventListener("selectend",c),h.addEventListener("end",d),h.baseLayer=new XRWebGLLayer(h,f,{framebufferScaleFactor:l}),h.requestFrameOfReference(q).then(function(b){m=b;a.setFramebuffer(h.baseLayer.framebuffer);x.setContext(h);x.start()}),t=h.getInputSources(),h.addEventListener("inputsourceschange",function(){t=h.getInputSources();console.log(t); |
| 158 | for(var a=0;a<k.length;a++)k[a].userData.inputSource=t[a]}))};this.getCamera=function(a){if(b()){var c=a.parent,d=n.cameras;e(n,c);for(var f=0;f<d.length;f++)e(d[f],c);a.matrixWorld.copy(n.matrixWorld);a=a.children;f=0;for(c=a.length;f<c;f++)a[f].updateMatrixWorld(!0);uf(n,r,u);return n}return a};this.isPresenting=b;var z=null,x=new de;x.setAnimationLoop(function(a,b){p=b.getDevicePose(m);if(null!==p)for(var c=h.baseLayer,d=b.views,e=0;e<d.length;e++){var f=d[e],g=c.getViewport(f),l=p.getViewMatrix(f), |
| 159 | q=n.cameras[e];q.matrix.fromArray(l).getInverse(q.matrix);q.projectionMatrix.fromArray(f.projectionMatrix);q.viewport.set(g.x,g.y,g.width,g.height);0===e&&n.matrix.copy(q.matrix)}for(e=0;e<k.length;e++){c=k[e];if(d=t[e])if(d=b.getInputPose(d,m),null!==d){"targetRay"in d?c.matrix.elements=d.targetRay.transformMatrix:"pointerMatrix"in d&&(c.matrix.elements=d.pointerMatrix);c.matrix.decompose(c.position,c.rotation,c.scale);c.visible=!0;continue}c.visible=!1}z&&z(a)});this.setAnimationLoop=function(a){z= |
| 160 | a};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new P};this.submitFrame=function(){}}function je(a){var b;function c(){ja=new hg(N);Aa=new fg(N,ja,a);Aa.isWebGL2||(ja.get("WEBGL_depth_texture"),ja.get("OES_texture_float"),ja.get("OES_texture_half_float"),ja.get("OES_texture_half_float_linear"),ja.get("OES_standard_derivatives"),ja.get("OES_element_index_uint"),ja.get("ANGLE_instanced_arrays"));ja.get("OES_texture_float_linear"); |
| 161 | ea=new tf(N,ja,Aa);aa=new eh(N,ja,ea,Aa);aa.scissor(Y.copy(Z).multiplyScalar(X));aa.viewport(U.copy(L).multiplyScalar(X));mb=new kg(N);Ba=new Xg;ba=new fh(N,ja,aa,Ba,Aa,ea,mb);qa=new Zf(N);sa=new ig(N,qa,mb);ka=new ng(sa,mb);va=new mg(N);da=new Wg(A,ja,Aa,ba);ra=new $g;oa=new dh;ia=new dg(A,aa,ka,ua);xa=new eg(N,ja,mb,Aa);ya=new jg(N,ja,mb,Aa);mb.programs=da.programs;A.context=N;A.capabilities=Aa;A.extensions=ja;A.properties=Ba;A.renderLists=ra;A.state=aa;A.info=mb}function d(a){a.preventDefault(); |
| 162 | console.log("THREE.WebGLRenderer: Context Lost.");M=!0}function e(){console.log("THREE.WebGLRenderer: Context Restored.");M=!1;c()}function f(a){a=a.target;a.removeEventListener("dispose",f);g(a);Ba.remove(a)}function g(a){var b=Ba.get(a).program;a.program=void 0;void 0!==b&&da.releaseProgram(b)}function h(a,b){a.render(function(a){A.renderBufferImmediate(a,b)})}function l(a,b,c,d){if(!1!==a.visible){if(a.layers.test(b.layers))if(a.isGroup)c=a.renderOrder;else if(a.isLight)B.pushLight(a),a.castShadow&& |
| 163 | B.pushShadow(a);else if(a.isSprite){if(!a.frustumCulled||ma.intersectsSprite(a)){d&&lb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Ic);var e=ka.update(a),f=a.material;f.visible&&D.push(a,e,f,c,lb.z,null)}}else if(a.isImmediateRenderObject)d&&lb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Ic),D.push(a,null,a.material,c,lb.z,null);else if(a.isMesh||a.isLine||a.isPoints)if(a.isSkinnedMesh&&a.skeleton.update(),!a.frustumCulled||ma.intersectsObject(a))if(d&&lb.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Ic), |