Example #1
0
    private bool CanCompleteScan()
    {
        SpatialUnderstandingDll.Imports.PlayspaceStats stats = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStats();

        if (!waiting)
        {
            StartCoroutine(TipsAndTricks(8));
        }

        if ((SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Scanning) ||
            !SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
        {
            return(false);
        }

        IntPtr statsPtr = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStatsPtr();

        if (SpatialUnderstandingDll.Imports.QueryPlayspaceStats(statsPtr) == 0)
        {
            return(false);
        }

        if (stats.UpSurfaceArea > area)
        {
            return(true);
        }

        return(false);
    }
Example #2
0
    private void Update_Display(float deltaTime)
    {
        // Basic checks
        if (MainText == null)
        {
            return;
        }

        MainText.GetComponent <Text>().text = PrimaryText;
        if ((SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Finishing) ||
            (SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Done))
        {
            TipsText.GetComponent <Text>().text = "";
        }
        else
        {
            TipsText.GetComponent <Text>().text = _tip;
        }


        //MainText.GetComponent<Text>().text = (foregroundImage.fillAmount).ToString() + " tot " + stats.TotalSurfaceArea + " floor " + stats.HorizSurfaceArea + " wall " + stats.WallSurfaceArea;
        if (SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Scanning)
        {
            float totalArea = kMinHorizAreaForComplete + kMinWallAreaForComplete;

            if (_progressBarOldfill < 1)
            {
                float fillAmount = 0;
                float floor;
                float wall;

                SpatialUnderstandingDll.Imports.PlayspaceStats stats =
                    SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStats();

                if (stats.HorizSurfaceArea < kMinHorizAreaForComplete)
                {
                    floor = stats.HorizSurfaceArea;
                }
                else
                {
                    floor = kMinHorizAreaForComplete;
                }

                if (stats.WallSurfaceArea < kMinWallAreaForComplete)
                {
                    wall = stats.WallSurfaceArea;
                }
                else
                {
                    wall = kMinWallAreaForComplete;
                }

                fillAmount = (floor + wall) / totalArea;
                foregroundImage.fillAmount = fillAmount;
                _progressBarOldfill        = fillAmount;
            }
        }
    }
    SpatialUnderstandingDll.Imports.PlayspaceStats GetScanStats()
    {
        System.IntPtr statsPtr = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStatsPtr();

        if (SpatialUnderstandingDll.Imports.QueryPlayspaceStats(statsPtr) != 0)
        {
            SpatialUnderstandingDll.Imports.PlayspaceStats stats = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStats();
            return(stats);
        }
        else
        {
            return(null);
        }
    }
Example #4
0
    private bool GetStats(out SpatialUnderstandingDll.Imports.PlayspaceStats stats)
    {
        IntPtr statsPtr = m_spatialUnderstanding.UnderstandingDLL.GetStaticPlayspaceStatsPtr();

        if (SpatialUnderstandingDll.Imports.QueryPlayspaceStats(statsPtr) != 0)
        {
            stats = m_spatialUnderstanding.UnderstandingDLL.GetStaticPlayspaceStats();
            return(true);
        }
        else
        {
            stats = new SpatialUnderstandingDll.Imports.PlayspaceStats();
            return(false);
        }
    }
Example #5
0
    void Update()
    {
        if (CurrentState == State.Scanning)
        {
            // Query the current playspace stats
            IntPtr statsPtr = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStatsPtr();
            if (SpatialUnderstandingDll.Imports.QueryPlayspaceStats(statsPtr) > 0)
            {
                // Check our preset requirements
                SpatialUnderstandingDll.Imports.PlayspaceStats stats = SpatialUnderstanding.Instance.UnderstandingDLL.GetStaticPlayspaceStats();

                if ((stats.TotalSurfaceArea > minAreaForComplete) ||
                    (stats.HorizSurfaceArea > minHorizontalAreaForComplete) ||
                    (stats.WallSurfaceArea > minVerticalAreaForComplete))
                {
                    CurrentState = State.ReadyToFinish;
                }
            }
        }
    }
 void UpdateMidScanState()
 {
     SpatialUnderstandingDll.Imports.PlayspaceStats stats = GetScanStats();
     UpdateText(ScanMinimumMet ? "Air Tap to Finish Scan" : "Scanning...", System.String.Format("Total Surface Area: {0:0.##}, Horizontal: {1:0.##}, Wall: {2:0.##}", stats.TotalSurfaceArea, stats.HorizSurfaceArea, stats.WallSurfaceArea));
 }