2
0
Mr.doob 6 жил өмнө
parent
commit
2d50e54fae

+ 1 - 0
build/three.js

@@ -22211,6 +22211,7 @@
 		function onSessionEnd() {
 
 			renderer.setFramebuffer( null );
+			renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830
 			animation.stop();
 
 		}

+ 6 - 6
build/three.min.js

@@ -148,12 +148,12 @@ r.fromArray(b.position),r.applyQuaternion(k),c.position.add(r));c.updateMatrixWo
 w.matrixWorld.getInverse(w.matrixWorldInverse);u.projectionMatrix.fromArray(f.leftProjectionMatrix);w.projectionMatrix.fromArray(f.rightProjectionMatrix);pf(z,u,w);a=e.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&u.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&w.bounds.fromArray(a.rightBounds));a:for(a=0;a<h.length;a++){b=h[a];b:{c=a;for(var d=navigator.getGamepads&&navigator.getGamepads(),q=0,t=0,n=d.length;q<n;q++){var x=d[q];if(x&&
 ("Daydream Controller"===x.id||"Gear VR Controller"===x.id||"Oculus Go Controller"===x.id||"OpenVR Gamepad"===x.id||x.id.startsWith("Oculus Touch")||x.id.startsWith("Spatial Controller"))){if(t===c){c=x;break b}t++}}c=void 0}if(void 0!==c&&void 0!==c.pose){if(null===c.pose)break a;d=c.pose;!1===d.hasPosition&&b.position.set(.2,-.6,-.05);null!==d.position&&b.position.fromArray(d.position);null!==d.orientation&&b.quaternion.fromArray(d.orientation);b.matrix.compose(b.position,b.quaternion,b.scale);
 b.matrix.premultiply(l);b.matrix.decompose(b.position,b.quaternion,b.scale);b.matrixWorldNeedsUpdate=!0;b.visible=!0;d="Daydream Controller"===c.id?0:1;y[a]!==c.buttons[d].pressed&&(y[a]=c.buttons[d].pressed,!0===y[a]?b.dispatchEvent({type:"selectstart"}):(b.dispatchEvent({type:"selectend"}),b.dispatchEvent({type:"select"})))}else b.visible=!1}return z};this.getStandingMatrix=function(){return l};this.isPresenting=b;var Q=new $d;this.setAnimationLoop=function(a){Q.setAnimationLoop(a)};this.submitFrame=
-function(){b()&&e.submitFrame()};this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",c)}}function $g(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);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,g=null,
-h=null,l=1,m=null,q="stage",p=null,k=[],t=[],r=new S;r.layers.enable(1);r.viewport=new ba;var u=new S;u.layers.enable(2);u.viewport=new ba;var n=new Ec([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 Sb,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=
-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);
-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);pf(n,r,u);return n}return a};this.isPresenting=b;var z=null,x=new $d;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),
-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=
-a};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new THREE.Matrix4};this.submitFrame=function(){}}function he(a){var b;function c(){la=new cg(O);za=new ag(O,la,a);za.isWebGL2||(la.get("WEBGL_depth_texture"),la.get("OES_texture_float"),la.get("OES_texture_half_float"),la.get("OES_texture_half_float_linear"),la.get("OES_standard_derivatives"),la.get("OES_element_index_uint"),la.get("ANGLE_instanced_arrays"));
+function(){b()&&e.submitFrame()};this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",c)}}function $g(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,g=null,h=null,l=1,m=null,q="stage",p=null,k=[],t=[],r=new S;r.layers.enable(1);r.viewport=new ba;var u=new S;u.layers.enable(2);u.viewport=new ba;var n=new Ec([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 Sb,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=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);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);pf(n,r,u);return n}return a};this.isPresenting=b;var z=null,x=new $d;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),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=a};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new THREE.Matrix4};this.submitFrame=function(){}}function he(a){var b;function c(){la=new cg(O);za=new ag(O,la,a);za.isWebGL2||(la.get("WEBGL_depth_texture"),la.get("OES_texture_float"),la.get("OES_texture_half_float"),la.get("OES_texture_half_float_linear"),la.get("OES_standard_derivatives"),la.get("OES_element_index_uint"),la.get("ANGLE_instanced_arrays"));
 la.get("OES_texture_float_linear");ja=new of(O,la,za);Z=new Yg(O,la,ja,za);Z.scissor(W.copy(aa).multiplyScalar(T));Z.viewport(V.copy(ea).multiplyScalar(T));ha=new fg(O);Da=new Qg;da=new Zg(O,la,Z,Da,za,ja,ha);ra=new Uf(O);ua=new dg(O,ra,ha);oa=new ig(ua,ha);xa=new hg(O);ma=new Pg(X,la,za);va=new Tg;qa=new Xg;na=new Zf(X,Z,oa,fa);Aa=new $f(O,la,ha,za);Ba=new eg(O,la,ha,za);ha.programs=ma.programs;X.context=O;X.capabilities=za;X.extensions=la;X.properties=Da;X.renderLists=va;X.state=Z;X.info=ha}function d(a){a.preventDefault();
 console.log("THREE.WebGLRenderer: Context Lost.");J=!0}function e(){console.log("THREE.WebGLRenderer: Context Restored.");J=!1;c()}function f(a){a=a.target;a.removeEventListener("dispose",f);g(a);Da.remove(a)}function g(a){var b=Da.get(a).program;a.program=void 0;void 0!==b&&ma.releaseProgram(b)}function h(a,b){a.render(function(a){X.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)C.pushLight(a),a.castShadow&&
 C.pushShadow(a);else if(a.isSprite){if(!a.frustumCulled||sa.intersectsSprite(a)){d&&ib.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Dc);var e=oa.update(a),f=a.material;D.push(a,e,f,c,ib.z,null)}}else if(a.isImmediateRenderObject)d&&ib.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Dc),D.push(a,null,a.material,c,ib.z,null);else if(a.isMesh||a.isLine||a.isPoints)if(a.isSkinnedMesh&&a.skeleton.update(),!a.frustumCulled||sa.intersectsObject(a))if(d&&ib.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Dc),

+ 1 - 0
build/three.module.js

@@ -22205,6 +22205,7 @@ function WebXRManager( renderer ) {
 	function onSessionEnd() {
 
 		renderer.setFramebuffer( null );
+		renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830
 		animation.stop();
 
 	}