Esempio n. 1
0
        private void Update()
        {
            bool trackingQualityAvailable = false;

            if (ImmersalSDK.isHWAR)
            {
                                #if HWAR
                trackingQualityAvailable = HWARHelper.TryGetTrackingQuality(out m_SLAMTrackingQuality);
                                #endif
            }
            else
            {
                trackingQualityAvailable = ARHelper.TryGetTrackingQuality(out m_SLAMTrackingQuality);
            }

            if (trackingQualityAvailable && this.Localizer != null)
            {
                LocalizerStats stats = this.Localizer.stats;
                if (stats.localizationAttemptCount > 0)
                {
                    int q = CurrentResults(stats.localizationSuccessCount);
                    if (q > m_SLAMTrackingQuality)
                    {
                        q = m_SLAMTrackingQuality;
                    }

                    if (!m_HasPose && q > 1)
                    {
                        m_HasPose = true;
                        onPoseFound?.Invoke();
                    }

                    if (m_HasPose && q < 1 && m_SLAMTrackingQuality == 0)
                    {
                        m_HasPose = false;
                        onPoseLost?.Invoke();
                    }

                    this.TrackingQuality = q;
                }
            }

            if (!isHWAR)
            {
                if (!m_bCamConfigDone && cameraManager != null)
                {
                    ConfigureCamera();
                }
            }
        }
        void Update()
        {
            if (mapper != null && textMeshProUGUI != null && m_Sdk != null)
            {
                MapperStats    ms = mapper.stats;
                LocalizerStats ls = m_Sdk.Localizer.stats;

                switch (debugMode)
                {
                case DebugMode.imageCount:
                    textMeshProUGUI.text = string.Format("{0} {1}", textAppend, ms.imageCount);
                    break;

                case DebugMode.inQueue:
                    textMeshProUGUI.text = string.Format("{0} {1}", textAppend, ms.queueLen);
                    break;

                case DebugMode.posesFound:
                    textMeshProUGUI.text = string.Format("{0} {1}/{2}", textAppend, ls.localizationSuccessCount, ls.localizationAttemptCount);
                    break;
                }
            }
        }
Esempio n. 3
0
        void Update()
        {
            if (arSession != null && arSession.subsystem.running)
            {
                switch (arSession.subsystem.trackingState)
                {
                case TrackingState.Tracking:
                    m_trackingQuality = 4;
                    break;

                case TrackingState.Limited:
                    m_trackingQuality = 1;
                    break;

                case TrackingState.None:
                    m_trackingQuality = 0;
                    break;
                }
            }

            LocalizerStats stats = m_localizer.stats;

            if (stats.localizationAttemptCount > 0)
            {
                int q = CurrentResults(stats.localizationSuccessCount);
                if (q > m_trackingQuality)
                {
                    q = m_trackingQuality;
                }

                if (!m_hasPose && q > 1)
                {
                    m_hasPose = true;
                    if (onPoseFound != null)
                    {
                        onPoseFound.Invoke();
                    }
                }

                if (m_hasPose && q < 1 && m_trackingQuality == 0)
                {
                    m_hasPose = false;
                    if (onPoseLost != null)
                    {
                        onPoseLost.Invoke();
                    }
                }

                if (indicatorMode == IndicatorMode.multiplyColor)
                {
                    switch (q)
                    {
                    case 0:
                        m_image.color = noPose;
                        break;

                    case 1:
                        m_image.color = weakPose;
                        break;

                    case 2:
                        m_image.color = goodPose;
                        break;

                    default:
                        m_image.color = excellentPose;
                        break;
                    }
                }
                else if (indicatorMode == IndicatorMode.changeSprite)
                {
                    switch (q)
                    {
                    case 0:
                        m_image.sprite = noPoseSprite;
                        break;

                    case 1:
                        m_image.sprite = weakPoseSprite;
                        break;

                    case 2:
                        m_image.sprite = goodPoseSprite;
                        break;

                    default:
                        m_image.sprite = excellentPoseSprite;
                        break;
                    }
                }
            }
        }
Esempio n. 4
0
        void Update()
        {
            bool ok = false;

            if (ImmersalSDK.isHWAR)
            {
                                #if HWAR
                ok = HWARHelper.TryGetTrackingQuality(out m_TrackingQuality);
                                #endif
            }
            else
            {
                ok = ARHelper.TryGetTrackingQuality(out m_TrackingQuality);
            }

            if (ok)
            {
                LocalizerStats stats = m_Localizer.stats;
                if (stats.localizationAttemptCount > 0)
                {
                    int q = CurrentResults(stats.localizationSuccessCount);
                    if (q > m_TrackingQuality)
                    {
                        q = m_TrackingQuality;
                    }

                    if (!m_HasPose && q > 1)
                    {
                        m_HasPose = true;
                        onPoseFound?.Invoke();
                    }

                    if (m_HasPose && q < 1 && m_TrackingQuality == 0)
                    {
                        m_HasPose = false;
                        onPoseLost?.Invoke();
                    }

                    if (indicatorMode == IndicatorMode.multiplyColor)
                    {
                        switch (q)
                        {
                        case 0:
                            m_Image.color = noPose;
                            break;

                        case 1:
                            m_Image.color = weakPose;
                            break;

                        case 2:
                            m_Image.color = goodPose;
                            break;

                        default:
                            m_Image.color = excellentPose;
                            break;
                        }
                    }
                    else if (indicatorMode == IndicatorMode.changeSprite)
                    {
                        switch (q)
                        {
                        case 0:
                            m_Image.sprite = noPoseSprite;
                            break;

                        case 1:
                            m_Image.sprite = weakPoseSprite;
                            break;

                        case 2:
                            m_Image.sprite = goodPoseSprite;
                            break;

                        default:
                            m_Image.sprite = excellentPoseSprite;
                            break;
                        }
                    }
                }
            }
        }