private static void RunOnRenderThread(int eventID)
 {
     if (eventID == STARTNATIVERENDEREVENT)
     {
         m_NativeRenderring.Start();
     }
     else if (eventID == RESUMENATIVERENDEREVENT)
     {
         m_NativeRenderring.Resume();
     }
     else if (eventID == STOPNATIVERENDEREVENT)
     {
         m_NativeRenderring.Pause();
     }
     else if (eventID == STOPNATIVERENDEREVENT)
     {
         if (m_NativeRenderring != null)
         {
             m_NativeRenderring.Destroy();
             m_NativeRenderring = null;
         }
         NRDevice.Instance.Destroy();
     }
     else if (eventID == SETRENDERTEXTUREEVENT)
     {
         FrameInfo framinfo = (FrameInfo)Marshal.PtrToStructure(m_NativeRenderring.FrameInfoPtr, typeof(FrameInfo));
         m_NativeRenderring.DoRender(framinfo.leftTex, framinfo.rightTex, ref framinfo.pose);
     }
 }
        private void StartUp()
        {
#if !UNITY_EDITOR
            m_NativeRenderring = new NativeRenderring();
            m_NativeRenderring.Create();

            StartCoroutine(RenderCoroutine());
#endif
            GL.IssuePluginEvent(RenderThreadHandlePtr, STARTNATIVERENDEREVENT);
        }
Beispiel #3
0
        private void StartUp()
        {
            leftCamera.enabled  = true;
            rightCamera.enabled = true;
#if !UNITY_EDITOR
            m_NativeRenderring = new NativeRenderring();
            m_NativeRenderring.Create();
#if !UNITY_STANDALONE_WIN
            m_NativeRenderring.InitColorSpace();
#endif

            StartCoroutine(RenderCoroutine());
#endif
            m_CurrentState = RendererState.Running;
            GL.IssuePluginEvent(RenderThreadHandlePtr, STARTNATIVERENDEREVENT);
        }
Beispiel #4
0
        private IEnumerator StartUp()
        {
            var virtualDisplay = GameObject.FindObjectOfType <NRVirtualDisplayer>();

            while (virtualDisplay == null || !virtualDisplay.IsPlaying)
            {
                NRDebugger.Log("[NRRender] Wait virtual display ready...");
                yield return(new WaitForEndOfFrame());

                if (virtualDisplay == null)
                {
                    virtualDisplay = GameObject.FindObjectOfType <NRVirtualDisplayer>();
                }
            }

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            NRDebugger.Log("[NRRender] StartUp");
            CreateRenderTextures();

            leftCamera.enabled  = true;
            rightCamera.enabled = true;
#if !UNITY_EDITOR
            m_NativeRenderring = new NativeRenderring();
            m_NativeRenderring.Create();
#if !UNITY_STANDALONE_WIN
            m_NativeRenderring.InitColorSpace();
#endif
            StartCoroutine(RenderCoroutine());
#endif
            m_CurrentState = RendererState.Running;
            GL.IssuePluginEvent(RenderThreadHandlePtr, STARTNATIVERENDEREVENT);
        }