Beispiel #1
0
        public void StartSession()
        {
            if (SessionState == SessionState.Running ||
                SessionState == SessionState.UnInitialized ||
                SessionState == SessionState.Destroyed)
            {
                return;
            }
            var config = NRSessionBehaviour.SessionConfig;

            if (config != null)
            {
                SetAppSettings(config.OptimizedRendering);
#if !UNITY_EDITOR
                if (config.OptimizedRendering)
                {
                    if (NRSessionBehaviour.gameObject.GetComponent <NRRenderer>() == null)
                    {
                        NRRenderer = NRSessionBehaviour.gameObject.AddComponent <NRRenderer>();
                        NRRenderer.Initialize(NRHMDPoseTracker.leftCamera, NRHMDPoseTracker.rightCamera, NRHMDPoseTracker.GetHeadPose);
                    }
                }
#endif
            }
            else
            {
                SetAppSettings(false);
            }
            NativeAPI.NativeTracking.Start();
            NativeAPI.NativeHeadTracking.Create();
#if UNITY_EDITOR
            InitEmulator();
#endif
            SessionState = SessionState.Running;
        }
Beispiel #2
0
 public void DestroySession()
 {
     if (SessionState == SessionState.Destroyed || SessionState == SessionState.UnInitialized)
     {
         return;
     }
     SessionState = SessionState.Destroyed;
     NRRenderer?.Destroy();
     NativeAPI.NativeHeadTracking.Destroy();
     NativeAPI.NativeTracking.Destroy();
     VirtualDisplayer?.Destory();
     NRDevice.Instance.Destroy();
     FrameCaptureContextFactory.DisposeAllContext();
 }
Beispiel #3
0
        public void ResumeSession()
        {
            if (SessionState != SessionState.Paused)
            {
                return;
            }

            SessionState = SessionState.Running;
            NRDevice.Instance.ResumeHMD();
            NRDevice.Instance.ResumeGlassesController();
            VirtualDisplayer?.Resume();
            NativeAPI.NativeTracking.Resume();
            NRRenderer?.Resume();
        }
Beispiel #4
0
        public void ResumeSession()
        {
            if (SessionState != SessionState.Paused)
            {
                return;
            }

            // Do not put it in other thread...
            VirtualDisplayer?.Resume();
            NativeAPI.NativeTracking.Resume();
            NRRenderer?.Resume();
            NRDevice.Instance.Resume();
            SessionState = SessionState.Running;
        }
 public void DestroySession()
 {
     if (!m_IsInitialized && m_IsDestroyed)
     {
         return;
     }
     m_IsDestroyed = true;
     NativeAPI.NativeHeadTracking.Destroy();
     NativeAPI.NativeTracking.Destroy();
     VirtualDisplayer?.Destory();
     NRRenderer?.Destroy();
     NRDevice.Instance.Destroy();
     FrameCaptureContextFactory.DisposeAllContext();
     m_IsInitialized = false;
 }
 public void ResumeSession()
 {
     if (!m_IsInitialized)
     {
         return;
     }
     NativeAPI.NativeTracking.Resume();
     if (NRRenderer != null)
     {
         NRRenderer.Resume();
     }
     if (VirtualDisplayer != null)
     {
         VirtualDisplayer.Resume();
     }
 }
Beispiel #7
0
        public void DisableSession()
        {
            if (SessionState != SessionState.Running)
            {
                return;
            }
            SessionState = SessionState.Paused;

            if (NRVirtualDisplayer.RunInBackground)
            {
                NRRenderer?.Pause();
                NativeAPI.NativeTracking?.Pause();
                VirtualDisplayer?.Pause();
                NRDevice.Instance.PauseGlassesController();
                NRDevice.Instance.PauseHMD();
            }
            else
            {
                NRDevice.ForceKill();
            }
        }
Beispiel #8
0
        public void DisableSession()
        {
            if (SessionState != SessionState.Running)
            {
                return;
            }

            // Do not put it in other thread...
            if (NRVirtualDisplayer.RunInBackground)
            {
                NRRenderer?.Pause();
                NativeAPI.NativeTracking?.Pause();
                VirtualDisplayer?.Pause();
                NRDevice.Instance.Pause();
                SessionState = SessionState.Paused;
            }
            else
            {
                NRDevice.ForceKill();
            }
        }
 public void DisableSession()
 {
     if (!m_IsInitialized)
     {
         return;
     }
     if (NRVirtualDisplayer.RunInBackground)
     {
         if (VirtualDisplayer != null)
         {
             VirtualDisplayer.Pause();
         }
         NativeAPI.NativeTracking.Pause();
         if (NRRenderer != null)
         {
             NRRenderer.Pause();
         }
     }
     else
     {
         NRDevice.Instance.ForceKill();
     }
 }