ve ?
                         xrImmersiveRefSpace :
                         inlineViewerHelper.referenceSpace;

        let pose = frame.getViewerPose(refSpace);
        scene.startFrame();
        session.requestAnimationFrame(onXRFrame);

        // Check for and respond to any gamepad state changes.
        for (let source of session.inputSources) {
          if (source.gamepad) {
            let pose = frame.getPose(source.gripSpace, refSpace);
            ProcessGamepad(source.gamepad, source.handedne