/************************************ 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 } }
public override void Init() { if (!isInitrenderThread && PicoVRManager.SDK.VRModeEnabled) { PVRPluginEvent.Issue(RenderEventType.InitRenderThread); isInitrenderThread = true; } }
public static void LeaveVRMode() { if (!VrUtility.IsPicoVR) { return; } PVRPluginEvent.Issue(RenderEventType.Pause); }
public static void EnterVRMode() { if (!VrUtility.IsPicoVR) { return; } PVRPluginEvent.Issue(RenderEventType.Resume); }
void OnPostRender() { if (!VrUtility.IsPicoVR) { return; } if (PicoVRManager.SDK.IsVREditorDebug) { PVRPluginEvent.IssueWithDatapc(PicoVRManager.SDK.currentDevice.eyeTextures[0].GetNativeTexturePtr(), PicoVRManager.SDK.currentDevice.eyeTextures[1].GetNativeTexturePtr()); } }
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); }
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 }
/// <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 }