Esempio n. 1
0
        private static void Update()
        {
            if (!EditorApplication.isPlaying ||
                EditorApplication.isPaused)
            {
                // prevent memory keeps going up when in Unity Editor and the HvrActor is inactive
                HvrPlayerInterface.Update();
            }

            List <HvrActor> actors = new List <HvrActor>();

            HvrScene.GetObjects(actors);

            foreach (HvrActor actor in actors)
            {
                actor.EditorUpdate();
            }
        }
Esempio n. 2
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();
            }
        }