Example #1
0
        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(NibiruRenderEventType.PrepareFrame);
                }
                return;
            }

            if (NxrViewer.USE_DTR && NxrGlobal.supportDtr)
            {
                // 左右眼绘制结束
                NibiruRenderEventType eventType = eyeType == NxrViewer.Eye.Left ? NibiruRenderEventType.LeftEyeEndFrame : NibiruRenderEventType.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();
            }
        }
Example #2
0
        /// <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(NibiruRenderEventType 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));
        }
Example #3
0
 void OnPreRenderListener(int cacheTextureId, NxrViewer.Eye eyeType)
 {
     if (NxrGlobal.isVR9Platform)
     {
         return;
     }
     if (NxrViewer.USE_DTR && NxrGlobal.supportDtr)
     {
         // 左右眼绘制开始
         NibiruRenderEventType eventType = eyeType == NxrViewer.Eye.Left ? NibiruRenderEventType.LeftEyeBeginFrame : NibiruRenderEventType.RightEyeBeginFrame;
         NxrPluginEvent.IssueWithData(eventType, cacheTextureId);
         if (NxrGlobal.DEBUG_LOG_ENABLED)
         {
             Debug.Log("OnPreRender.eye[" + eyeType + "]");
         }
     }
 }
Example #4
0
 /// <summary>
 /// Immediately issues the given event.
 /// </summary>
 public static void Issue(NibiruRenderEventType eventType)
 {
     GL.IssuePluginEvent(EncodeType((int)eventType));
 }