예제 #1
0
        void Scan()
        {
            bool allowScan = !ViveSR_RigidReconstruction.IsScanning &&
                             !ViveSR_RigidReconstruction.IsExportingMesh &&
                             !StaticMeshScript.SemanticMeshIsExporting &&
                             !StaticMeshScript.ModelIsLoading &&
                             !StaticMeshScript.SemanticMeshIsLoading;

            if (!allowScan)
            {
                return;
            }

            HintText.text = "";

            // Clear
            StaticMeshScript.LoadMesh(false);
            StaticMeshScript.ActivateSemanticMesh(false);
            StaticMeshScript.ClearHintLocators();
            npcGenerator.ClearScene();
            NavFloor.SetActive(false);

            RigidReconstruction.SRWork_Rigid_Reconstruciton.RegisterDataErrorHandler((int)Error.GPU_MEMORY_FULL, GPUMemoryFull);
            StaticMeshScript.EnableDepthProcessingAndScanning(true);
            StaticMeshScript.SetSegmentation(true);

            ViveSR_SceneUnderstanding.SetCustomSceneUnderstandingConfig(SceneUnderstandingObjectType.CHAIR, 10, true);

            SetColor(Color_Dark, ScanText, StopText, PlayText);
            SetColor(Color_Bright, SaveText, StopText);
        }
        public override void ActionToDo()
        {
            ViveSR_Experience_Demo.instance.realWorldFloor.SetActive(isOn);
            if (isOn)
            {
                //wait for tutorial segmentation handler to reaction on UI before turning it off
                this.DelayOneFrame(() =>
                {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(false);
                    ViveSR_Experience_Demo.instance.Tutorial.ToggleTutorial(false);
                });

                ActionSequence = ViveSR_Experience_ActionSequence.CreateActionSequence(gameObject);

                ActionSequence.AddAction(() => StaticMeshScript.LoadMesh(true, false,
                                                                         () => ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "Loading Mesh...", false),
                                                                         () =>
                {
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "Mesh Loaded!", true, 0.5f);
                    ActionSequence.ActionFinished();
                }
                                                                         ));

                ActionSequence.AddAction(() =>
                {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(true);
                    ViveSR_Experience_Demo.instance.Tutorial.ToggleTutorial(true);
                    SegResults = StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR);

                    StaticMeshScript.GenerateHintLocators(SegResults);
                    LoadChair();
                    ViveSR_Experience_ControllerDelegate.touchpadDelegate += handleTouchpad_Play;
                    ActionSequence.ActionFinished();
                });
                ActionSequence.StartSequence();
            }
            else
            {
                ActionSequence.StopSequence();
                StaticMeshScript.LoadMesh(false);

                ViveSR_Experience_ControllerDelegate.touchpadDelegate -= handleTouchpad_Play;

                ViveSR_DualCameraRig.Instance.VirtualCamera.cullingMask |= (1 << LayerMask.NameToLayer("UI"));
                PortalScript.PortalManager.TurnOffCamera();

                PortalScript.PortalManager.gameObject.SetActive(false);

                StaticMeshScript.ClearHintLocators();
                npcGenerator.ClearScene();

                portalCamerasDisabledEvent.Invoke();
            }
        }