enterVR(useAR, useOfferSession) {
    var self = this;
    var vrManager = self.renderer.xr;
    var xrInit;

    // Don't enter VR if already in VR.
    if (useOfferSession && (!navigator.xr || !navigator.xr.offerSession)) {
      return Promise.resolve('OfferSession is not supported.');
    }
    if (self.usedOfferSession && useOfferSession) {
      return Promise.resolve('OfferSession was already called.');
    }
    if (this.is('vr-mode')) {
      return Promise.resolve('Already in VR.');
    }

    // Has VR.
    if (this.checkHeadsetConnected() || this.isMobile) {
      var rendererSystem = self.getAttribute('renderer');
      vrManager.enabled = true;
      if (this.hasWebXR) {
        // XR API.
        if (this.xrSession) {
          this.xrSession.removeEventListener('end', this.exitVRBound);
        }
        var refspace = this.sceneEl.systems.webxr.sessionReferenceSpaceType;
        vrManager.setReferenceSpaceType(refspace);
        var xrMode = useAR ? 'immersive-ar' : 'immersive-vr';
        xrInit = this.sceneEl.systems.webxr.sessionConfiguration;
        return new Promise(function (resolve, reject) {
          var requestSession = useOfferSession ? navigator.xr.offerSession.bind(navigator.xr) : navigator.xr.requestSession.bind(navigator.xr);
          self.usedOfferSession |= useOfferSession;
          requestSession(xrMode, xrInit).then(function requestSuccess(xrSession) {
            if (useOfferSession) {
              self.usedOfferSession = false;
            }
            vrManager.layersEnabled = xrSession.enabledFeatures ? xrSession.enabledFeatures.indexOf('layers') !== -1 : true;
            vrManager.setSession(xrSession).then(function () {
              vrManager.setFoveation(rendererSystem.foveationLevel);
              self.xrSession = xrSession;
              self.systems.renderer.setWebXRFrameRate(xrSession);
              xrSession.addEventListener('end', self.exitVRBound);
              enterVRSuccess(resolve);
            });
          }, function requestFail(error) {
            var useAR = xrMode === 'immersive-ar';
            var mode = useAR ? 'AR' : 'VR';
            reject(new Error('Failed to enter ' + mode + ' mode (`requestSession`)', {
              cause: error
            }));
          });
        });
      } else {
        var mode = useAR ? 'AR' : 'VR';
        throw new Error('Failed to enter ' + mode + ' no WebXR');
      }
    }

    // No VR.
    enterVRSuccess();
    return Promise.resolve();

    // Callback that happens on enter VR success or enter fullscreen (any API).
    function enterVRSuccess(resolve) {
      if (useAR) {
        self.addState('ar-mode');
      } else {
        self.addState('vr-mode');
      }
      self.emit('enter-vr', {
        target: self
      });
      // Lock to landscape orientation on mobile.
      if (!self.hasWebXR && self.isMobile && screen.orientation && screen.orientation.lock) {
        screen.orientation.lock('landscape');
      }
      self.addFullScreenStyles();

      // Call `requestFullscreen` on desktop
      if (!self.isMobile && !self.checkHeadsetConnected()) {
        requestFullscreen(self.canvas);
      }
      self.resize();
      if (resolve) {
        resolve();
      }
    }
  }
Call `requestSession` if WebXR is supported.
Call `requestFullscreen` on desktop.
Handle events, states, fullscreen styles.

@param {?boolean} useAR - if true, try immersive-ar mode
@returns {Promise}