Skip to content

Commit 397fc18

Browse files
committed
WebVR: Testing a more raw approach.
1 parent 6365315 commit 397fc18

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

examples/js/vr/WebVR.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ var WEBVR = {
1818

1919
},
2020

21-
getDisplays: function () {
22-
23-
return navigator.getVRDisplays();
24-
25-
},
26-
2721
getMessage: function () {
2822

2923
var message;

examples/webvr_cubes.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,20 @@
130130
controls = new THREE.VRControls( camera );
131131
effect = new THREE.VREffect( renderer );
132132

133-
WEBVR.getDisplays()
134-
.then( function( displays ) {
135-
effect.setDisplay( displays[ 0 ] );
136-
controls.setDisplay( displays[ 0 ] );
137-
document.body.appendChild( WEBVR.getButton( effect ) );
138-
} )
139-
.catch( function() {
140-
// no displays
141-
} );
133+
if ( navigator.getVRDisplays ) {
134+
135+
navigator.getVRDisplays()
136+
.then( function ( displays ) {
137+
effect.setVRDisplay( displays[ 0 ] );
138+
controls.setVRDisplay( displays[ 0 ] );
139+
} )
140+
.catch( function () {
141+
// no displays
142+
} );
143+
144+
document.body.appendChild( WEBVR.getButton( effect ) );
145+
146+
}
142147

143148
renderer.domElement.addEventListener( 'mousedown', onMouseDown, false );
144149
renderer.domElement.addEventListener( 'mouseup', onMouseUp, false );

0 commit comments

Comments
 (0)