From d6821abea984ef1f8ccfeb5e4b09a883823653d6 Mon Sep 17 00:00:00 2001 From: Kevin Staunton-Lambert Date: Wed, 7 Dec 2022 15:29:10 +1100 Subject: [PATCH] [KJSL] Swap webvr ro webxr polyfill packages --- src/plugin.js | 10 +++++++--- vendor/three/VRButton.js | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 2289cfb1..db135359 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -1,5 +1,3 @@ -require('babel-polyfill'); - import 'babel-polyfill'; import {version as VERSION} from '../package.json'; import window from 'global/window'; @@ -709,6 +707,8 @@ void main() { // ShowEnterVRButton document.body.appendChild(VRButton.createButton(this.renderer)); + this.renderer.setAnimationLoop(this.render.bind(this)); + if (displays.length > 0) { this.log('Displays found', displays); this.vrDisplay = displays[0]; @@ -716,7 +716,7 @@ void main() { // Native WebVR Head Mounted Displays (HMDs) like the HTC Vive // also need the cardboard button to enter fully immersive mode // so, we want to add the button if we're not polyfilled. - if (!this.vrDisplay.isPolyfilled) { + if (1 || !this.vrDisplay.isPolyfilled) { this.log('Real HMD found using VRControls', this.vrDisplay); this.addCardboardButton_(); @@ -778,6 +778,10 @@ void main() { this.trigger('initialized'); } + render() { + this.renderer.render(this.scene, this.camera); + } + addCardboardButton_() { if (!this.player_.controlBar.getChild('CardboardButton')) { this.player_.controlBar.addChild('CardboardButton', {}); diff --git a/vendor/three/VRButton.js b/vendor/three/VRButton.js index c48bc5cc..43d631bd 100644 --- a/vendor/three/VRButton.js +++ b/vendor/three/VRButton.js @@ -47,7 +47,7 @@ class VRButton { button.onmouseleave = function () { - button.style.opacity = '0.5'; + button.style.opacity = '0.8'; }; @@ -62,7 +62,7 @@ class VRButton { // ('local' is always available for immersive sessions and doesn't need to // be requested separately.) - const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] }; + const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking' ] }; navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted ); } else { @@ -111,7 +111,7 @@ class VRButton { function stylizeElement( element ) { element.style.position = 'absolute'; - element.style.bottom = '20px'; + element.style.top = '20px'; element.style.padding = '12px 6px'; element.style.border = '1px solid #fff'; element.style.borderRadius = '4px'; @@ -119,7 +119,7 @@ class VRButton { element.style.color = '#fff'; element.style.font = 'normal 13px sans-serif'; element.style.textAlign = 'center'; - element.style.opacity = '0.5'; + element.style.opacity = '0.8'; element.style.outline = 'none'; element.style.zIndex = '999';