Esempio n. 1
0
        void TestSegmentationResult_done()
        {
            List <SceneUnderstandingObjects.Element> SegResults = StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR);

            StaticMeshScript.GenerateHintLocators(SegResults);

            chairNum = StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR).Count;

            ViveSR_Experience_Demo.instance.ButtonScripts[MenuButton.Segmentation].EnableButton(chairNum > 0);

            StaticMeshScript.SetSegmentation(false);
            StaticMeshScript.ExportModel(UpdatePercentage_Mesh, ExportModel_done);
        }
Esempio n. 2
0
        void Save()
        {
            if (!ViveSR_RigidReconstruction.IsScanning)
            {
                return;
            }

            LoadText.color = OriginalColor;
            ScanText.color = OriginalColor;
            StopText.color = OriginalColor;
            SaveText.color = OriginalColor;

            StaticMeshScript.ExportModel(Save_UpdatePercentage, Save_Done);
        }
        void Save()
        {
            bool allowSave = ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh;

            if (!allowSave)
            {
                return;
            }

            LoadText.color = OriginalColor;
            ScanText.color = OriginalColor;
            StopText.color = OriginalColor;
            SaveText.color = OriginalColor;
            ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_MeshOperation;

            StaticMeshScript.ExportModel(Save_UpdatePercentage, Save_done);
        }
Esempio n. 4
0
        void ExportSemanticMesh_done()
        {
            SegResults = StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR);

            if (SegResults.Count == 0)
            {
                HintText.text = "No Chair Identified";

                SetColor(Color_Bright, StopText, SaveText);

                StaticMeshScript.EnableDepthProcessingAndScanning(true);
                StaticMeshScript.SetSegmentation(true);
            }
            else
            {
                StaticMeshScript.ExportModel(ExportSemanticMesh_UpdatePercentage, ExportModel_done);
            }
        }
Esempio n. 5
0
        private void HandleTouchpad_MeshOperation(ButtonStage buttonStage, Vector2 axis)
        {
            if (!isTriggerDown)
            {
                switch (buttonStage)
                {
                case ButtonStage.PressDown:

                    TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false);

                    if (touchpadDirection == TouchpadDirection.Up)    //[Scan]
                    {
                        if (!ViveSR_RigidReconstruction.IsScanning && !StaticMeshScript.ModelIsLoading && !StaticMeshScript.SemanticMeshIsLoading)
                        {
                            //SemanticDrawer.DestroyAllObjects();
                            if (StaticMeshScript.CheckModelLoaded())
                            {
                                StaticMeshScript.LoadMesh(false);
                            }
                            StaticMeshScript.ActivateSemanticMesh(false);

                            DartText.text = "";
                            HintText.text = "";
                            GripText.text = "";
                            //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode;

                            StaticMeshScript.SetScanning(true);
                            StaticMeshScript.SetSegmentation(true);

                            LoadText.color = Color.gray;
                            ScanText.color = Color.gray;
                            SaveText.color = Color.white;
                            StopText.color = Color.white;
                        }
                    }
                    else if (touchpadDirection == TouchpadDirection.Left)    //[Stop]
                    {
                        if (ViveSR_RigidReconstruction.IsScanning)
                        {
                            StaticMeshScript.SetScanning(false);
                            StaticMeshScript.SetSegmentation(false);
                            if (StaticMeshScript.CheckModelLoaded())
                            {
                                StaticMeshScript.LoadMesh(true);
                            }
                            if (StaticMeshScript.SemanticMeshIsLoaded)
                            {
                                StaticMeshScript.ActivateSemanticMesh(true);
                            }

                            SetStaticMeshUI();
                            //ViveSR_Experience_ControllerDelegate.gripDelegate += HandleGrip_SwitchMode;
                        }
                    }
                    else if (touchpadDirection == TouchpadDirection.Right)    // [Save]
                    {
                        if (ViveSR_RigidReconstruction.IsScanning)
                        {
                            StaticMeshScript.UnloadSemanticMesh();

                            LoadText.color = Color.grey;
                            ScanText.color = Color.grey;
                            StopText.color = Color.grey;
                            SaveText.color = Color.grey;
                            ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_MeshOperation;

                            ViveSR_SceneUnderstanding.SetAllCustomSceneUnderstandingConfig(10, true);

                            StaticMeshScript.SetSegmentation(false);

                            StaticMeshScript.ExportSemanticMesh(UpdateSegmentationPercentage,
                                                                () =>
                            {
                                StaticMeshScript.ExportModel(UpdateModelPercentage,
                                                             () =>
                                {
                                    DartText.text  = "";
                                    HintText.text  = "Mesh Saved!";
                                    ScanText.color = Color.white;
                                    LoadText.color = Color.white;
                                    ViveSR_Experience_ControllerDelegate.touchpadDelegate += HandleTouchpad_MeshOperation;
                                }
                                                             );
                            }
                                                                );
                        }
                    }
                    else if (touchpadDirection == TouchpadDirection.Down)    //[Load]
                    {
                        if (!ViveSR_RigidReconstruction.IsScanning && StaticMeshScript.CheckModelExist() && !StaticMeshScript.CheckModelLoaded())
                        {
                            //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode;
                            StaticMeshScript.LoadMesh(
                                true,
                                () =>
                            {         // step 1
                                ScanText.color = Color.grey;
                                LoadText.color = Color.grey;
                                HintText.text  = "Loading Scene...";
                                DartText.text  = "";
                            },
                                () =>
                            {         // step 2
                                if (StaticMeshScript.CheckSemanticMeshDirExist())
                                {
                                    LoadSemanticMesh();
                                    StaticMeshScript.collisionMesh.SetActive(false);
                                }
                                else
                                {
                                    ScanText.color = Color.white;
                                    HintText.text  = "No Object is Found.\nPlease Rescan!";
                                }
                            }
                                );
                        }
                    }
                    break;
                }
            }
        }