瀏覽代碼

WebVR: Support exclusive and immersive webxr sessions.

Mr.doob 7 年之前
父節點
當前提交
2941033a27
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      examples/js/vr/WebVR.js

+ 10 - 3
examples/js/vr/WebVR.js

@@ -78,7 +78,10 @@ var WEBVR = {
 
 
 				if ( currentSession === null ) {
 				if ( currentSession === null ) {
 
 
+					// TODO Remove exclusive
+
 					device.requestSession( { exclusive: true } ).then( onSessionStarted );
 					device.requestSession( { exclusive: true } ).then( onSessionStarted );
+					device.requestSession( { immersive: true } ).then( onSessionStarted );
 
 
 				} else {
 				} else {
 
 
@@ -137,11 +140,15 @@ var WEBVR = {
 
 
 			navigator.xr.requestDevice().then( function ( device ) {
 			navigator.xr.requestDevice().then( function ( device ) {
 
 
-				device.supportsSession( { exclusive: true } ).then( function () {
+				// TODO Remove exclusive
 
 
-					showEnterXR( device );
+				device.supportsSession( { exclusive: true } )
+					.then( function () { showEnterXR( device ); } )
+					.catch( showVRNotFound );
 
 
-				} ).catch( showVRNotFound );
+				device.supportsSession( { immersive: true } )
+					.then( function () { showEnterXR( device ); } )
+					.catch( showVRNotFound );
 
 
 			} ).catch( showVRNotFound );
 			} ).catch( showVRNotFound );