WebVR 1.1 spec compatibility

This commit is contained in:
Imanol Fernandez 2017-05-26 14:22:02 +02:00
parent 296a215e54
commit fe4ee6de2e
16 changed files with 112 additions and 55 deletions

View file

@ -179,10 +179,10 @@ found in the LICENSE file.
}
}
if (navigator.vr) {
if (navigator.getVRDisplays) {
frameData = new VRFrameData();
navigator.vr.getDisplays().then(function (displays) {
navigator.getVRDisplays().then(function (displays) {
if (displays.length > 0) {
vrDisplay = displays[0];
@ -203,7 +203,7 @@ found in the LICENSE file.
// The UA may kick us out of VR present mode for any reason, so to
// ensure we always know when we begin/end presenting we need to
// listen for vrdisplaypresentchange events.
vrDisplay.addEventListener('presentchange', onVRPresentChange, false);
window.addEventListener('vrdisplaypresentchange', onVRPresentChange, false);
// These events fire when the user agent has had some indication that
// it would be appropariate to enter or exit VR presentation mode, such
@ -211,8 +211,8 @@ found in the LICENSE file.
// You can inspect the `reason` property of the event to learn why the
// event was fired, but in this case we're going to always trust the
// event and enter or exit VR presentation mode when asked.
//vrDisplay.addEventListener('activate', onVRRequestPresent, false);
//vrDisplay.addEventListener('deactivate', onVRExitPresent, false);
window.addEventListener('vrdisplayactivate', onVRRequestPresent, false);
window.addEventListener('vrdisplaydeactivate', onVRExitPresent, false);
} else {
VRSamplesUtil.addInfo("WebVR supported, but no VRDisplays found.", 3000);
}