Exemple #1
0
        internal void EarlyUpdate()
        {
            // Get the latest session handle from presto.
            IntPtr sessionHandle = IntPtr.Zero;

            ExternApi.ArPresto_getSession(ref sessionHandle);

            // Update the display geometry if there is a non-null session.
            if (sessionHandle != IntPtr.Zero)
            {
                _SetDisplayGeometry(sessionHandle, Screen.orientation, Screen.width, Screen.height);
            }

            // Update ArPresto and potentially ArCore.
            ExternApi.ArPresto_update();

            // Update pending AsyncTasks.
            AsyncTask.OnUpdate();

            // Update the lifecycle state.
            _UpdateState();

            // Return if there is no session component in the scene.
            if (SessionComponent == null)
            {
                return;
            }

            ExternApi.ArPresto_getSession(ref sessionHandle);

            IntPtr frameHandle = IntPtr.Zero;

            ExternApi.ArPresto_getFrame(ref frameHandle);

            if (NativeSession == null && sessionHandle != IntPtr.Zero)
            {
                NativeSession = new NativeSession(sessionHandle, frameHandle);
                NativeSession.SessionApi.ReportEngineType();
            }

            if (NativeSession != null)
            {
                NativeSession.OnUpdate(frameHandle);
            }

            SetConfiguration(SessionComponent.SessionConfig);

            _UpdateTextureIfNeeded();

            InstantPreviewManager.OnEarlyUpdate();

            if (EarlyUpdateEvent != null)
            {
                EarlyUpdateEvent();
            }
        }
Exemple #2
0
        private void _EarlyUpdate()
        {
            AsyncTask.OnUpdate();
            _UpdateTextureIfNeeded();

            if (m_SessionComponent != null)
            {
                var config = m_SessionComponent.SessionConfig;
                if (config != null)
                {
                    ExternApi.ArPresto_setConfiguration(new ApiPrestoConfig(config));
                }
            }

            if (m_NativeSession != null)
            {
                m_NativeSession.SessionApi.SetDisplayGeometry(
                    Screen.orientation, Screen.width, Screen.height);
                m_NativeSession.OnUpdate();
            }

            InstantPreviewManager.OnEarlyUpdate(m_SessionComponent);
        }