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();
            }
        }
Example #2
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);
        }
Example #3
0
        public void Init()
        {
            StaticMeshScript = FindObjectOfType <ViveSR_Experience_StaticMesh>();

            npcGenerator = GetComponent <ViveSR_Experience_NPCGenerator>();

            GameObject attachPointCanvas = ViveSR_Experience.instance.AttachPoint.transform.GetChild(ViveSR_Experience.instance.AttachPointIndex).transform.gameObject;

            ScanText = attachPointCanvas.transform.Find("TouchpadCanvas/ScanText").GetComponent <Text>();
            StopText = attachPointCanvas.transform.Find("TouchpadCanvas/StopText").GetComponent <Text>();
            SaveText = attachPointCanvas.transform.Find("TouchpadCanvas/SaveText").GetComponent <Text>();
            PlayText = attachPointCanvas.transform.Find("TouchpadCanvas/PlayText").GetComponent <Text>();
            HintText = attachPointCanvas.transform.Find("HintText").GetComponent <Text>();

            PlayText.text = "[Load]";
            if (StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR).Count > 0)
            {
                PlayText.color = Color_Bright;
            }

            ViveSR_DualCameraRig.Instance.VirtualCamera.cullingMask &= ~(1 << LayerMask.NameToLayer("UI"));
            FindObjectOfType <ViveSR_PortalMgr>().TurnOnCamera();

            RaycastStartPoint = ViveSR_Experience.instance.AttachPoint.transform.Find("RaycastStartPoint").gameObject;

            ViveSR_Experience_ControllerDelegate.touchpadDelegate += handleTouchpad_MRChair;
        }
Example #4
0
        void Stop()
        {
            if (!ViveSR_RigidReconstruction.IsScanning)
            {
                return;
            }

            StaticMeshScript.SetSegmentation(false);
            StaticMeshScript.EnableDepthProcessingAndScanning(false);
            StaticMeshScript.LoadMesh(true);
            StaticMeshScript.ActivateSemanticMesh(true);

            SetColor(Color_Bright, ScanText);
            SetColor(Color_Dark, SaveText, StopText);

            if (StaticMeshScript.GetSegmentationInfo(SceneUnderstandingObjectType.CHAIR).Count > 0)
            {
                SetColor(Color_Bright, PlayText);
            }

            RigidReconstruction.SRWork_Rigid_Reconstruciton.UnregisterDataErrorHandler((int)Error.GPU_MEMORY_FULL);
        }