Пример #1
0
        public static void Player_RenderActor(int actor, int viewport, GetRenderTextureNativePtr getColorTarget, GetRenderTextureNativePtr getDepthTarget)
        {
            if (!HvrPlayerInterface.IsInitialized())
            {
                return;
            }

            bool sRGBWrite = GL.sRGBWrite;

            int player = ScenePlayerHandle();

            if (getColorTarget == null)
            {
                getColorTarget = ReturnZeroPointer;
            }
            if (getDepthTarget == null)
            {
                getDepthTarget = ReturnZeroPointer;
            }

            int eventID = UnityInterfaceAPI.QueueGLEventPrepFrameContextIII(HvrPlayerInterfaceAPI.Player_Render, player, actor, viewport,
                                                                            getColorTarget(), getDepthTarget());

            GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID);
            GL.InvalidateState();

            // TODO: Reset this as a deferred step.
            GL.sRGBWrite = sRGBWrite;
        }
Пример #2
0
        public static void Player_WillRender(int actor, int viewport)
        {
            if (!HvrPlayerInterface.IsInitialized())
            {
                return;
            }

            int player  = ScenePlayerHandle();
            int eventID = UnityInterfaceAPI.QueueGLEventIII(HvrPlayerInterfaceAPI.Player_WillRender, player, actor, viewport);

            GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID);
            GL.InvalidateState();
        }
Пример #3
0
        public static void Player_PrepareRender(GetRenderTextureNativePtr getColorTarget, GetRenderTextureNativePtr getDepthTarget)
        {
            if (!HvrPlayerInterface.IsInitialized())
            {
                return;
            }

            // Only allow PrepareRender to be called if the frame has changed
            // This handles an issue with Metal where a internal buffer index needs to be bumped each PrepareRender
            //
            // A potential issue for this is that lodding step within PrepareRender will not take into account any viewport changes
            // that occur within this frame, after PrepareRender is called.
            if (Time.frameCount != lastPreparedFrame)
            {
                lastPreparedFrame = Time.frameCount;

                HvrPlayerInterface.Update();

                WillRender();

                int player = ScenePlayerHandle();
                if (getColorTarget == null)
                {
                    getColorTarget = ReturnZeroPointer;
                }
                if (getDepthTarget == null)
                {
                    getDepthTarget = ReturnZeroPointer;
                }

                int eventID = UnityInterfaceAPI.QueueGLEventPrepFrameContextI(HvrPlayerInterfaceAPI.Player_PrepareRender, player,
                                                                              getColorTarget(), getDepthTarget());
                GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID);
                GL.InvalidateState();
            }
        }