コード例 #1
0
 public static void StopScanning()
 {
     if (ReconstructionProcessing)
     {
         IsScanning = false;
         SRWorkModule_API.SetReconstructionParameterBool((int)(ReconstructionCmd.STOP), true);
         Debug.Log("stop");
     }
     ViveSR_RigidReconstruction.EnableReconstructionProcess(false);
 }
コード例 #2
0
 public static void StartScanning()
 {
     ViveSR_RigidReconstruction.EnableReconstructionProcess(true);
     if (ReconstructionProcessing)
     {
         SRWorkModule_API.SetReconstructionParameterBool((int)(ReconstructionCmd.START), true);
         IsScanning = true;
         IsScannedMeshPreviewCompleted = false;
         Debug.Log("start");
     }
 }
コード例 #3
0
        private void ReconstructionGUI()
        {
            GUIStyle StyleBold = new GUIStyle {
                fontStyle = FontStyle.Bold
            };

            GUILayout.Label(new GUIContent("[Runtime Command]"), StyleBold);        // start / stop
            string btnStrEnableReconstructionProcess = ViveSR_RigidReconstruction.ReconstructionProcessing ? "Disable Reconstruction Processing" : "Enable Reconstruction Processing";

            if (GUILayout.Button(btnStrEnableReconstructionProcess, GUILayout.ExpandWidth(false)))
            {
                ViveSR_RigidReconstruction.EnableReconstructionProcess(!ViveSR_RigidReconstruction.ReconstructionProcessing);
            }
            if (ViveSR_RigidReconstruction.ReconstructionProcessing)
            {
                GUILayout.Label(new GUIContent("--Start/Stop--"), StyleBold);
                if (!ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh && !ViveSR_RigidReconstruction.IsDuringScannedMeshPreview)
                {
                    if (GUILayout.Button("Start Reconstruction", GUILayout.ExpandWidth(false)))
                    {
                        ViveSR_RigidReconstruction.StartScanning();
                    }
                }
                if (ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh && !ViveSR_RigidReconstruction.IsDuringScannedMeshPreview)
                {
                    if (GUILayout.Button("Stop Reconstruction", GUILayout.ExpandWidth(false)))
                    {
                        ViveSR_RigidReconstruction.StopScanning();
                    }

                    GUILayout.Label(new GUIContent("--Live Extraction--"), StyleBold);
                    int curMode = (int)ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode;

                    if (curMode != (int)ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode)
                    {
                        ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode = (ReconstructionDisplayMode)curMode;
                    }
                    // adaptive tunning
                    if (curMode == (int)ReconstructionDisplayMode.ADAPTIVE_MESH)
                    {
                        GUILayout.Label(new GUIContent("--Live Adaptive Mesh Tuning--"), StyleBold);
                        DrawAdaptiveParamUI(ViveSR_RigidReconstruction.LiveAdaptiveMaxGridSize, ViveSR_RigidReconstruction.LiveAdaptiveMinGridSize, ViveSR_RigidReconstruction.LiveAdaptiveErrorThres);
                        ViveSR_RigidReconstruction.LiveAdaptiveMaxGridSize = adaptiveLevel[maxSelectID];
                        ViveSR_RigidReconstruction.LiveAdaptiveMinGridSize = adaptiveLevel[minSelectID];
                        ViveSR_RigidReconstruction.LiveAdaptiveErrorThres  = errorThres;
                    }
                }

                // export
                if (ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh && !ViveSR_RigidReconstruction.IsDuringScannedMeshPreview)
                {
                    GUILayout.Label(new GUIContent("--Export--"), StyleBold);
                    bool exportAdaptive = ViveSR_RigidReconstruction.ExportAdaptiveMesh;
                    ViveSR_RigidReconstruction.ExportAdaptiveMesh = GUILayout.Toggle(exportAdaptive, "Export Adaptive Model");

                    if (ViveSR_RigidReconstruction.ExportAdaptiveMesh)
                    {
                        // live extraction mode
                        GUILayout.Label(new GUIContent("--Export Adaptive Mesh Tuning--"), StyleBold);
                        DrawAdaptiveParamUI(ViveSR_RigidReconstruction.ExportAdaptiveMaxGridSize, ViveSR_RigidReconstruction.ExportAdaptiveMinGridSize, ViveSR_RigidReconstruction.ExportAdaptiveErrorThres);
                        ViveSR_RigidReconstruction.ExportAdaptiveMaxGridSize = adaptiveLevel[maxSelectID];
                        ViveSR_RigidReconstruction.ExportAdaptiveMinGridSize = adaptiveLevel[minSelectID];
                        ViveSR_RigidReconstruction.ExportAdaptiveErrorThres  = errorThres;
                    }

                    if (GUILayout.Button("Start Export Model", GUILayout.ExpandWidth(false)))
                    {
                        ViveSR_RigidReconstruction.StopScanning();
                        ViveSR_RigidReconstruction.ExportModel("Model");
                    }
                }
            }
        }