コード例 #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);
        }
コード例 #2
0
        void Scan()
        {
            bool allowScan = !ViveSR_RigidReconstruction.IsScanning &&
                             !ViveSR_RigidReconstruction.IsExportingMesh &&
                             !StaticMeshScript.ModelIsLoading;

            if (!allowScan)
            {
                return;
            }

            SwitchMeshDisplayMode(0);
            dartGeneratorMgr.DestroyObjs();

            if (StaticMeshScript.CheckModelLoaded())
            {
                StaticMeshScript.LoadMesh(false);
                LoadText.color = BrightColor;
            }

            GripCanvas.SetActive(false);
            TriggerCanvas.SetActive(false);
            HintText.text = "";

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

            LoadText.color = OriginalColor;
            ScanText.color = OriginalColor;
            SaveText.color = BrightColor;
            StopText.color = BrightColor;
        }
        public override void ExecuteToDo()
        {
            DualCameraDisplayMode targetMode = isOn ? DualCameraDisplayMode.VIRTUAL : DualCameraDisplayMode.MIX;

            StaticMeshScript.SwitchModeScript.SwithMode(targetMode);
            if (isOn)
            {
                ViveSR_Experience_Demo.instance.SubButtonScripts[SubMenuButton.EnableMesh_Dynamic].ForceExcute(false);
                ViveSR_Experience_Demo.instance.SubButtonScripts[SubMenuButton.EnableMesh_StaticMR].ForceExcute(false);

                StaticMeshScript.LoadMesh(true, true,
                                          () => {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(false);
                    SubMenu.RenderSubBtns(false);
                    disabled = true;
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "[Enable Mesh]\nLoading...", false);
                },
                                          () => {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(true);
                    SubMenu.RenderSubBtns(true);
                    disabled = false;
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "", false);
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "Mesh Loaded!", true, 1f);
                    dartGeneratorMgr_static.gameObject.SetActive(true);
                    ViveSR_Experience_ControllerDelegate.triggerDelegate += HandleTrigger;
                });
            }
            else
            {
                StaticMeshScript.LoadMesh(false);
                dartGeneratorMgr_static.gameObject.SetActive(false);
                ViveSR_Experience_ControllerDelegate.triggerDelegate -= HandleTrigger;
                dartGeneratorMgr_static.DestroyObjs();
            }
        }
コード例 #4
0
        void Scan()
        {
            bool allowScan = !ViveSR_RigidReconstruction.IsScanning &&
                             !ViveSR_RigidReconstruction.IsExportingMesh &&
                             !StaticMeshScript.ModelIsLoading;

            if (!allowScan)
            {
                return;
            }

            dartGeneratorMgr.DestroyObjs();
            TileSpawnerScript.ClearTiles();
            if (StaticMeshScript.texturedMesh != null)
            {
                StaticMeshScript.LoadMesh(false);
                LoadText.color = BrightColor;
            }

            GripCanvas.SetActive(false);
            TriggerCanvas.SetActive(false);
            HintText.text = "";
            ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode;

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

            LoadText.color = OriginalColor;
            ScanText.color = OriginalColor;
            SaveText.color = BrightColor;
            StopText.color = BrightColor;
        }
        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();
            }
        }
コード例 #6
0
        void Scan()
        {
            bool allowScan = !ViveSR_RigidReconstruction.IsScanning &&
                             !ViveSR_RigidReconstruction.IsExportingMesh &&
                             !StaticMeshScript.SemanticMeshIsExporting &&
                             !StaticMeshScript.ModelIsLoading &&
                             !StaticMeshScript.SemanticMeshIsLoading;

            if (!allowScan)
            {
                return;
            }
            ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SemanticObjOperation;
            GripCanvas.SetActive(false);

            ViveSR_SceneUnderstanding.DestroySceneObjects();
            StaticMeshScript.LoadMesh(false);
            StaticMeshScript.ActivateSemanticMesh(false);

            HintText.text = "Scanning...";

            RigidReconstruction.SRWork_Rigid_Reconstruciton.RegisterDataErrorHandler((int)Error.GPU_MEMORY_FULL, GPUMemoryFull);
            StaticMeshScript.EnableDepthProcessingAndScanning(true);
            StaticMeshScript.SetSegmentation(true);
            LoadText.color = OriginalColor;
            ScanText.color = OriginalColor;
            SaveText.color = BrightColor;
            StopText.color = BrightColor;
        }
        public override void ExecuteToDo()
        {
            if (isOn)
            {
                ViveSR_Experience_Demo.instance.SubButtonScripts[SubMenuButton.EnableMesh_Dynamic].ForceExcute(false);
                ViveSR_Experience_Demo.instance.SubButtonScripts[SubMenuButton.EnableMesh_StaticVR].ForceExcute(false);

                StaticMeshScript.LoadMesh(true, false,
                                          () => {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(false);
                    SubMenu.RenderSubBtns(false);
                    disabled = true;
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "[Enable Mesh]\nLoading...", false);
                },
                                          () => {
                    ViveSR_Experience_Demo.instance.Rotator.RenderButtons(true);
                    SubMenu.RenderSubBtns(true);
                    disabled = false;
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "", false);
                    ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onHeadSet, "Mesh Loaded!", true);
                    dartGeneratorMgr_static.gameObject.SetActive(true);
                    ViveSR_Experience_ControllerDelegate.triggerDelegate += HandleTrigger;
                    ViveSR_Experience_ControllerDelegate.gripDelegate    += HandleGrip;
                }
                                          );
            }
            else
            {
                StaticMeshScript.SwitchShowCollider(ShowMode.None);
                StaticMeshScript.LoadMesh(false);
                dartGeneratorMgr_static.gameObject.SetActive(false);
                ViveSR_Experience_ControllerDelegate.triggerDelegate -= HandleTrigger;
                ViveSR_Experience_ControllerDelegate.gripDelegate    -= HandleGrip;
                dartGeneratorMgr_static.DestroyObjs();
            }
        }
コード例 #8
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;
                }
            }
        }