Exemplo n.º 1
0
    /************************************    IEnumerator  *************************************/
    IEnumerator EndOfFrame()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            if (renderedStereo)
            {
                GetComponent <Camera>().enabled = true;
                renderedStereo = false;
            }
#if ANDROID_DEVICE
            //if(!PicoVRManager.SDK.currentDevice.Async)
            //{
            //    GL.InvalidateState();
            //}
            //if (PicoVRManager.SDK.VRModeEnabled)
            //{
            //   PVRPluginEvent.IssueWithData(RenderEventType.TimeWarp, PicoVRManager.SDK.timewarpID);

            //    Debug.Log("kkk main EndOfFrame");
            //}
#elif WIN_DEVICE
            if (PicoVRManager.SDK.VRModeEnabled)
            {
                PVRPluginEvent.CallbackCoroutine();
            }
#elif UNITY_EDITOR
            if (PicoVRManager.SDK.IsVREditorDebug)
            {
                PVRPluginEvent.CallbackCoroutine();
            }
#endif
        }
    }
Exemplo n.º 2
0
 public override void Init()
 {
     if (!isInitrenderThread && PicoVRManager.SDK.VRModeEnabled)
     {
         PVRPluginEvent.Issue(RenderEventType.InitRenderThread);
         isInitrenderThread = true;
     }
 }
Exemplo n.º 3
0
    public static void LeaveVRMode()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        PVRPluginEvent.Issue(RenderEventType.Pause);
    }
Exemplo n.º 4
0
    public static void EnterVRMode()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        PVRPluginEvent.Issue(RenderEventType.Resume);
    }
Exemplo n.º 5
0
    void OnPostRender()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        if (PicoVRManager.SDK.IsVREditorDebug)
        {
            PVRPluginEvent.IssueWithDatapc(PicoVRManager.SDK.currentDevice.eyeTextures[0].GetNativeTexturePtr(), PicoVRManager.SDK.currentDevice.eyeTextures[1].GetNativeTexturePtr());
        }
    }
Exemplo n.º 6
0
    void OnPostRender()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        DrawVignetteLine();
        RenderEventType eventType = (eye == PicoVRManager.Eye.LeftEye) ?
                                    RenderEventType.LeftEyeEndFrame :
                                    RenderEventType.RightEyeEndFrame;
        int eyeTextureId = PicoVRManager.SDK.currentDevice.eyeTextureIds[PicoVRManager.SDK.currentDevice.currEyeTextureIdx + (int)eye * bufferSize];

        PVRPluginEvent.IssueWithData(eventType, eyeTextureId);
    }
Exemplo n.º 7
0
    void OnRenderObject()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        if (Camera.current != cam)
        {
            return;
        }


#if UNITY_ANDROID
        //Debug.Log("kkk Post OnRenderObject depth : " + cam.depth);

        //int eyeTextureId = PicoVRManager.SDK.currentDevice.eyeTextureIds[PicoVRManager.SDK.currentDevice.currEyeTextureIdx + (int)(PicoVRManager.Eye.LeftEye) * 3];
        //PVRPluginEvent.IssueWithData(RenderEventType.LeftEyeEndFrame, eyeTextureId);
        //eyeTextureId = PicoVRManager.SDK.currentDevice.eyeTextureIds[PicoVRManager.SDK.currentDevice.currEyeTextureIdx + (int)(PicoVRManager.Eye.RightEye) * 3];
        //PVRPluginEvent.IssueWithData(RenderEventType.RightEyeEndFrame, eyeTextureId);

        if (PicoVRManager.SDK.VRModeEnabled)
        {
            PVRPluginEvent.IssueWithData(RenderEventType.TimeWarp, PicoVRManager.SDK.timewarpID);
        }
#endif

#if UNITY_IOS
        PicoVRIOSDevice.PVR_SetRenderTextureID_Native(0, PicoVRManager.SDK.currentDevice.eyeTextureIds[0]);
        PicoVRIOSDevice.PVR_SetRenderTextureID_Native(1, PicoVRManager.SDK.currentDevice.eyeTextureIds[1]);

        if (PicoVRManager.SDK.VRModeEnabled)
        {
            GL.IssuePluginEvent(PicoVRIOSDevice.PVR_GLEventID);
        }

        PicoVRManager.SDK.currentDevice.eyeTextures[0].DiscardContents();
        PicoVRManager.SDK.currentDevice.eyeTextures[1].DiscardContents();
#endif
    }
Exemplo n.º 8
0
    /// <summary>
    /// 同步渲染
    /// </summary>
    public void Render()
    {
        Setup();
#if ANDROID_DEVICE
        if (!PicoVRManager.SDK.currentDevice.Async)
        {
            int index = (int)eye * bufferSize + PicoVRManager.SDK.currentDevice.currEyeTextureIdx;
            camera.targetTexture =
                PicoVRManager.SDK.currentDevice.eyeTextures[index];

            //camera.Render();
            //camera.targetTexture = null;
        }
        //if (camera.actualRenderingPath == RenderingPath.DeferredLighting)
        //     QualitySettings.antiAliasing = 0;
#endif
#if UNITY_EDITOR
        if (PicoVRManager.SDK.IsVREditorDebug)
        {
            if (eye == PicoVRManager.Eye.LeftEye)
            {
                camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[0];
            }
            else
            {
                camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[1];
            }
            camera.Render();

            camera.targetTexture = null;
            if (PicoVRManager.SDK.VRModeEnabled)
            {
                PVRPluginEvent.IssueWithAssetsPath();
            }
        }
        else
        {
            camera.targetTexture = controller.StereoScreen;
            camera.Render();
            camera.targetTexture = null;
        }
#elif WIN_DEVICE
        if (eye == PicoVRManager.Eye.LeftEye)
        {
            camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[0];
        }
        else
        {
            camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[1];
        }
        camera.Render();
        camera.targetTexture = null;
        if (PicoVRManager.SDK.VRModeEnabled)
        {
            PVRPluginEvent.IssueWithAssetsPath();
        }
#endif



#if IOS_DEVICE
        if (eye == PicoVRManager.Eye.LeftEye)
        {
            camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[0];
        }
        else
        {
            camera.targetTexture = PicoVRManager.SDK.currentDevice.eyeTextures[1];
        }

        camera.Render();
        camera.targetTexture = null;


        if (camera.actualRenderingPath == RenderingPath.DeferredLighting)
        {
            QualitySettings.antiAliasing = 0;
        }
#endif
    }