Skip to content

Commit

Permalink
WebVR: Testing a more raw approach.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Sep 27, 2016
1 parent 6365315 commit 397fc18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
6 changes: 0 additions & 6 deletions examples/js/vr/WebVR.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ var WEBVR = {

},

getDisplays: function () {

return navigator.getVRDisplays();

},

getMessage: function () {

var message;
Expand Down
23 changes: 14 additions & 9 deletions examples/webvr_cubes.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,20 @@
controls = new THREE.VRControls( camera );
effect = new THREE.VREffect( renderer );

WEBVR.getDisplays()
.then( function( displays ) {
effect.setDisplay( displays[ 0 ] );
controls.setDisplay( displays[ 0 ] );
document.body.appendChild( WEBVR.getButton( effect ) );
} )
.catch( function() {
// no displays
} );
if ( navigator.getVRDisplays ) {

navigator.getVRDisplays()
.then( function ( displays ) {
effect.setVRDisplay( displays[ 0 ] );
controls.setVRDisplay( displays[ 0 ] );
} )
.catch( function () {
// no displays
} );

document.body.appendChild( WEBVR.getButton( effect ) );

}

renderer.domElement.addEventListener( 'mousedown', onMouseDown, false );
renderer.domElement.addEventListener( 'mouseup', onMouseUp, false );
Expand Down

0 comments on commit 397fc18

Please sign in to comment.