void OnPostRenderListener(int cacheTextureId, NxrViewer.Eye eyeType) { if (NxrGlobal.isVR9Platform) { if (eyeType == NxrViewer.Eye.Right && Application.isMobilePlatform) { if (NxrGlobal.DEBUG_LOG_ENABLED) { Debug.Log("OnPostRenderListener.PrepareFrame.Right"); } NxrPluginEvent.Issue(HoloeverRenderEventType.PrepareFrame); } return; } if (NxrViewer.USE_DTR && NxrGlobal.supportDtr) { // 左右眼绘制结束 HoloeverRenderEventType eventType = eyeType == NxrViewer.Eye.Left ? HoloeverRenderEventType.LeftEyeEndFrame : HoloeverRenderEventType.RightEyeEndFrame; // 左右眼绘制结束事件 // int eyeTextureId = (int)cam.targetTexture.GetNativeTexturePtr(); NxrPluginEvent.IssueWithData(eventType, cacheTextureId); if (NxrGlobal.DEBUG_LOG_ENABLED) { Debug.Log("OnPostRender.eye[" + eyeType + "]"); } } if (NxrViewer.USE_DTR && eyeType == NxrViewer.Eye.Right) { // NxrViewer.Instance.EnterXRMode(); } }
/// <summary> /// Create a data channel through the single 32-bit integer we are given to /// communicate with the plugin. /// Split the 32-bit integer event data into two separate "send-two-bytes" /// plugin events. Then issue the explicit event that makes use of the data. /// </summary> public static void IssueWithData(HoloeverRenderEventType eventType, int eventData) { // Encode and send-two-bytes of data GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 0)); // Encode and send remaining two-bytes of data GL.IssuePluginEvent(EncodeData((int)eventType, eventData, 1)); // Explicit event that uses the data GL.IssuePluginEvent(EncodeType((int)eventType)); }
void OnPreRenderListener(int cacheTextureId, NxrViewer.Eye eyeType) { if (NxrGlobal.isVR9Platform) { return; } if (NxrViewer.USE_DTR && NxrGlobal.supportDtr) { // 左右眼绘制开始 HoloeverRenderEventType eventType = eyeType == NxrViewer.Eye.Left ? HoloeverRenderEventType.LeftEyeBeginFrame : HoloeverRenderEventType.RightEyeBeginFrame; NxrPluginEvent.IssueWithData(eventType, cacheTextureId); if (NxrGlobal.DEBUG_LOG_ENABLED) { Debug.Log("OnPreRender.eye[" + eyeType + "]"); } } }
/// <summary> /// Immediately issues the given event. /// </summary> public static void Issue(HoloeverRenderEventType eventType) { GL.IssuePluginEvent(EncodeType((int)eventType)); }