コード例 #1
0
        private void _SetSessionConfiguration(IntPtr sessionHandle, IntPtr configHandle)
        {
            if (configHandle == IntPtr.Zero)
            {
                Debug.LogWarning("Cannot set configuration for invalid configHanlde.");
                return;
            }

            if (sessionHandle == IntPtr.Zero && !InstantPreviewManager.IsProvidingPlatform)
            {
                Debug.LogWarning("Cannot set configuration for invalid sessionHandle.");
                return;
            }

            // Disable depth if the device doesn't support it.
            if (m_CachedConfig.DepthMode != DepthMode.Disabled)
            {
                NativeSession tempNativeSession = _GetNativeSession(sessionHandle);
                if (!tempNativeSession.SessionApi.IsDepthModeSupported(
                        m_CachedConfig.DepthMode.ToApiDepthMode()))
                {
                    m_CachedConfig.DepthMode = DepthMode.Disabled;
                }
            }

            SessionConfigApi.UpdateApiConfigWithARCoreSessionConfig(
                sessionHandle, configHandle, m_CachedConfig);

            if (OnSetConfiguration != null)
            {
                OnSetConfiguration(sessionHandle, configHandle);
            }
        }
コード例 #2
0
        public bool SetConfiguration(ARCoreSessionConfig sessionConfig)
        {
            IntPtr configHandle = m_NativeSession.SessionConfigApi.Create();

            SessionConfigApi.UpdateApiConfigWithARCoreSessionConfig(
                m_NativeSession.SessionHandle, configHandle, sessionConfig);

            bool ret =
                ExternApi.ArSession_configure(m_NativeSession.SessionHandle, configHandle) == 0;

            m_NativeSession.SessionConfigApi.Destroy(configHandle);

            return(ret);
        }
コード例 #3
0
        private void SetSessionConfiguration(IntPtr sessionHandle, IntPtr configHandle)
        {
            if (configHandle == IntPtr.Zero)
            {
                Debug.LogWarning("Cannot set configuration for invalid configHanlde.");
                return;
            }

            if (sessionHandle == IntPtr.Zero && !InstantPreviewManager.IsProvidingPlatform)
            {
                Debug.LogWarning("Cannot set configuration for invalid sessionHandle.");
                return;
            }

            if (_cachedConfig == null)
            {
                return;
            }

            // Disable depth if the device doesn't support it.
            if (_cachedConfig.DepthMode != DepthMode.Disabled)
            {
                NativeSession tempNativeSession = GetNativeSession(sessionHandle);
                if (!tempNativeSession.SessionApi.IsDepthModeSupported(
                        _cachedConfig.DepthMode.ToApiDepthMode()))
                {
                    _cachedConfig.DepthMode = DepthMode.Disabled;
                }
            }

            // Don't set session config before the camera direction has changed to desired one.
            NativeSession nativeSession = GetNativeSession(sessionHandle);

            if (_cachedCameraDirection != null &&
                nativeSession.SessionApi.GetCameraConfig().FacingDirection !=
                _cachedCameraDirection)
            {
                _cachedConfig = null;
                return;
            }

            SessionConfigApi.UpdateApiConfigWithARCoreSessionConfig(
                sessionHandle, configHandle, _cachedConfig);

            if (OnSetConfiguration != null)
            {
                OnSetConfiguration(sessionHandle, configHandle);
            }
        }
コード例 #4
0
        private void _SetSessionConfiguration(IntPtr sessionHandle, IntPtr configHandle)
        {
            if (configHandle == IntPtr.Zero)
            {
                Debug.LogWarning("Cannot set configuration for invalid configHanlde.");
                return;
            }

            if (sessionHandle == IntPtr.Zero && !InstantPreviewManager.IsProvidingPlatform)
            {
                Debug.LogWarning("Cannot set configuration for invalid sessionHandle.");
                return;
            }

            SessionConfigApi.UpdateApiConfigWithARCoreSessionConfig(
                sessionHandle, configHandle, m_CachedConfig);

            if (OnSetConfiguration != null)
            {
                OnSetConfiguration(sessionHandle, configHandle);
            }
        }