Beispiel #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);
            }
        }
        public NativeSession(IntPtr sessionHandle, IntPtr frameHandle)
        {
            SessionHandle      = sessionHandle;
            FrameHandle        = frameHandle;
            m_TrackableManager = new TrackableManager(this);

            AnchorApi                 = new AnchorApi(this);
            AugmentedImageApi         = new AugmentedImageApi(this);
            AugmentedImageDatabaseApi = new AugmentedImageDatabaseApi(this);
            CameraApi                 = new CameraApi(this);
            CameraMetadataApi         = new CameraMetadataApi(this);
            FrameApi         = new FrameApi(this);
            HitTestApi       = new HitTestApi(this);
            ImageApi         = new ImageApi(this);
            LightEstimateApi = new LightEstimateApi(this);
            PlaneApi         = new PlaneApi(this);
            PointApi         = new PointApi(this);
            PointCloudApi    = new PointCloudApi(this);
            PoseApi          = new PoseApi(this);
            SessionApi       = new SessionApi(this);
            SessionConfigApi = new SessionConfigApi(this);
            TrackableApi     = new TrackableApi(this);
            TrackableListApi = new TrackableListApi(this);

#if !UNITY_EDITOR
            if (!s_ReportedEngineType)
            {
                SessionApi.ReportEngineType();
                s_ReportedEngineType = true;
            }
#endif
        }
Beispiel #3
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);
        }
        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);
            }
        }
Beispiel #5
0
        public NativeSession(IntPtr sessionHandle, IntPtr frameHandle)
        {
            m_SessionHandle    = sessionHandle;
            m_FrameHandle      = frameHandle;
            m_TrackableManager = new TrackableManager(this);

            AnchorApi         = new AnchorApi(this);
            CameraApi         = new CameraApi(this);
            CameraMetadataApi = new CameraMetadataApi(this);
            FrameApi          = new FrameApi(this);
            HitTestApi        = new HitTestApi(this);
            LightEstimateApi  = new LightEstimateApi(this);
            PlaneApi          = new PlaneApi(this);
            PointApi          = new PointApi(this);
            PointCloudApi     = new PointCloudApi(this);
            PoseApi           = new PoseApi(this);
            SessionApi        = new SessionApi(this);
            SessionConfigApi  = new SessionConfigApi(this);
            TrackableApi      = new TrackableApi(this);
            TrackableListApi  = new TrackableListApi(this);
        }
Beispiel #6
0
        public NativeSession(IntPtr sessionHandle, IntPtr frameHandle)
        {
            IsDestroyed        = false;
            SessionHandle      = sessionHandle;
            FrameHandle        = frameHandle;
            _pointCloudManager = new PointCloudManager(this);
            _trackableManager  = new TrackableManager(this);

            AnchorApi                 = new AnchorApi(this);
            AugmentedFaceApi          = new AugmentedFaceApi(this);
            AugmentedImageApi         = new AugmentedImageApi(this);
            AugmentedImageDatabaseApi = new AugmentedImageDatabaseApi(this);
            CameraApi                 = new CameraApi(this);
            CameraConfigApi           = new CameraConfigApi(this);
            CameraConfigFilterApi     = new CameraConfigFilterApi(this);
            CameraConfigListApi       = new CameraConfigListApi(this);
            CameraMetadataApi         = new CameraMetadataApi(this);
            FrameApi           = new FrameApi(this);
            HitTestApi         = new HitTestApi(this);
            ImageApi           = new ImageApi(this);
            LightEstimateApi   = new LightEstimateApi(this);
            PlaneApi           = new PlaneApi(this);
            PointApi           = new PointApi(this);
            PointCloudApi      = new PointCloudApi(this);
            PoseApi            = new PoseApi(this);
            RecordingConfigApi = new RecordingConfigApi(this);
            TrackApi           = new TrackApi(this);
            TrackDataApi       = new TrackDataApi(this);
            TrackDataListApi   = new TrackDataListApi(this);
            SessionApi         = new SessionApi(this);
            SessionConfigApi   = new SessionConfigApi(this);
            TrackableApi       = new TrackableApi(this);
            TrackableListApi   = new TrackableListApi(this);

#if !UNITY_EDITOR
            // Engine type is per session. Hence setting it for each
            // native session.
            SessionApi.ReportEngineType();
#endif
        }
Beispiel #7
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);
            }
        }