Skip to content

Commit

Permalink
Updated webvr_daydream example.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 15, 2017
1 parent e5d7a89 commit 9ad1789
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions examples/webvr_daydream.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

<script src="js/vr/DaydreamController.js"></script>
<script src="js/vr/WebVR.js"></script>
<script src="js/vr/WebVRCamera.js"></script>

<script>

Expand All @@ -41,14 +40,13 @@

var container;
var camera, scene, ray, raycaster, renderer;
var gamepad, vrdisplay;
var gamepad;

var room;

var INTERSECTED;

init();
animate();

function init() {

Expand Down Expand Up @@ -119,18 +117,15 @@
renderer.sortObjects = false;
container.appendChild( renderer.domElement );

//

WEBVR.getVRDisplay( function ( display ) {

if ( display !== undefined ) {
renderer.vr.enabled = true;
renderer.animate( update );

vrdisplay = display;
camera = new THREE.WebVRCamera( display, renderer );
//

}
WEBVR.getVRDisplay( function ( device ) {

document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
renderer.vr.setDevice( device );
document.body.appendChild( WEBVR.getButton( device, renderer.domElement ) );

} );

Expand Down Expand Up @@ -169,13 +164,11 @@

//

function animate() {
function update() {

gamepad.update();
render();

( vrdisplay ? vrdisplay : window ).requestAnimationFrame( animate );

}

function render() {
Expand Down

0 comments on commit 9ad1789

Please sign in to comment.