コード例 #1
0
        public static void SetSceneUnderstandingConfig(SceneUnderstandingConfig config)
        {
            IntPtr pointer = Marshal.AllocCoTaskMem(Marshal.SizeOf(config));

            Marshal.StructureToPtr(config, pointer, true);
            ViveSR_Framework.SetParameterStruct(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.SCENE_UNDERSTANDING_CONFIG, pointer);
            Marshal.FreeCoTaskMem(pointer);
        }
コード例 #2
0
        protected virtual int ViveSR_StartFramework()
        {
            int result = (int)Error.FAILED;

            #region Start Modules Flow
            if (EnableSeeThroughModule)
            {
                result = ViveSR_Framework.StartModule(ViveSR_Framework.MODULE_ID_SEETHROUGH);
                if (result != (int)Error.WORK)
                {
                    Debug.LogWarning("[ViveSR] SEETHROUGH StartModule Error " + result); return(result);
                }

                if (EnableDepthModule)
                {
                    result = ViveSR_Framework.StartModule(ViveSR_Framework.MODULE_ID_DEPTH);
                    if (result != (int)Error.WORK)
                    {
                        Debug.LogWarning("[ViveSR] DEPTH StartModule Error " + result); return(result);
                    }

                    if (EnableReconstructionModule)
                    {
                        if (EnableAIModule)
                        {
                            // set AI_VISION module model path (default location as follows)
#if UNITY_EDITOR
                            string ModelPath = Application.dataPath + "/ViveSR/Plugins";
#else
                            string ModelPath = Application.dataPath + "/Plugins";
#endif
                            AI_VisionModuleInfo Info = new AI_VisionModuleInfo();
                            ViveSR_Framework.GetParameterStruct(ViveSR_Framework.MODULE_ID_AI_VISION, (int)AIVisionParam.MODULE_INFO, ref Info);
                            Info.Model_Path       = ModelPath;
                            Info.Model_PathLength = ModelPath.Length;
                            Info.ProcessUnit      = 2;
                            ViveSR_Framework.SetParameterStruct(ViveSR_Framework.MODULE_ID_AI_VISION, (int)AIVisionParam.MODULE_INFO, Info);

                            result = ViveSR_Framework.StartModule(ViveSR_Framework.MODULE_ID_AI_VISION);
                            if (result == 1)
                            {
                                Debug.LogWarning("[ViveSR] Please put the model folder in the assigned path: " + ModelPath + "/model");
                            }
                            if (result != (int)Error.WORK)
                            {
                                Debug.LogWarning("[ViveSR] AI_VISION StartModule Error " + result); return(result);
                            }
                        }

                        result = ViveSR_Framework.StartModule(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION);
                        if (result != (int)Error.WORK)
                        {
                            Debug.LogWarning("[ViveSR] RIGID_RECONSTRUCTION StartModule Error " + result); return(result);
                        }
                    }
                }
            }
            #endregion Start Modules Flow

            #region Link Modules

            //result = ViveSR_Framework.ModuleLink(ViveSR_Framework.MODULE_ID_SEETHROUGH, ViveSR_Framework.MODULE_ID_DEPTH, (int)WorkLinkMethod.ACTIVE);
            //if (result != (int)Error.WORK) { Debug.LogWarning("[ViveSR] SEETHROUGH Link DEPTH Error " + result); return result; }

            if (EnableDepthModule && EnableReconstructionModule)
            {
                result = ViveSR_Framework.ModuleLink(ViveSR_Framework.MODULE_ID_DEPTH, ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)WorkLinkMethod.ACTIVE);
                if (result != (int)Error.WORK)
                {
                    Debug.LogWarning("[ViveSR] DEPTH Link RIGID_RECONSTRUCTION Error " + result); return(result);
                }
            }

            if (EnableReconstructionModule && EnableAIModule)
            {
                result = ViveSR_Framework.ModuleLink(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, ViveSR_Framework.MODULE_ID_AI_VISION, (int)WorkLinkMethod.ACTIVE);
                if (result != (int)Error.WORK)
                {
                    Debug.LogWarning("[ViveSR] RIGID_RECONSTRUCTION Link AI_SCENE Error " + result); return(result);
                }
            }
            #endregion Link Modules

            return(result);
        }
コード例 #3
0
 public static int SetCameraQualityInfo(CameraQuality item, CameraQualityInfo paramInfo)
 {
     return(ViveSR_Framework.SetParameterStruct(ViveSR_Framework.MODULE_ID_SEETHROUGH, (int)item, paramInfo));
 }