Ejemplo n.º 1
0
        public static int  EnableDepthProcess(bool active)
        {
            //Todo : Check module link status.
            //int result = ViveSR_Framework.ChangeModuleLinkStatus(ViveSR_Framework.MODULE_ID_SEETHROUGH, ViveSR_Framework.MODULE_ID_DEPTH, active ? (int)WorkLinkMethod.ACTIVE : (int)WorkLinkMethod.NONE);
            //if (result == (int)Error.WORK) DepthProcessing = active;
            //return result;
            int result = (int)Error.FAILED;

            if (active)
            {
                SRWorkModule_API.SetSkipVGAProcess(false);
                result = SRWorkModule_API.LinkModule((int)ModuleType.SEETHROUGH, (int)ModuleType.DEPTH);
                if (result == (int)Error.WORK)
                {
                    result          = SRWorkModule_API.TurnOnUndistortDataToDepth();
                    DepthProcessing = true;
                }
                else
                {
                    DepthProcessing = false;
                }
            }
            else
            {
                result = SRWorkModule_API.UnlinkModule((int)ModuleType.SEETHROUGH, (int)ModuleType.DEPTH);
                if (result == (int)Error.WORK)
                {
                    result          = SRWorkModule_API.TurnOffUndistortDataToDepth();
                    DepthProcessing = false;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void UpdateWhileWorking()
        {
            if (FrameworkStatus != FrameworkStatus.WORKING)
            {
                return;
            }

            if (EnableSeeThroughModule == true && EnableUnitySeeThrough == false)
            {
                Modules[0].Initial();
                SRWorkModule_API.TurnOffUndistortDataToDepth();
                SRWorkModule_API.UnlinkModule((int)ModuleType.SEETHROUGH, (int)ModuleType.DEPTH);
                if (SeeThrough.SRWork_SeeThrough.b4KImageReady)
                {
                    SeeThrough.SRWork_SeeThrough.SkipVGASeeThrough(true);
                }
                EnableUnitySeeThrough = true;
            }

            if (EnableSeeThroughNon4KDistortDataUse == true && EnableUnitySeeThroughNon4KDistortData == false)
            {
                bool result = SeeThrough.SRWork_SeeThrough.TurnOnSeeThroughDistortData();
                if (result)
                {
                    EnableUnitySeeThroughNon4KDistortData = true;
                }
            }
            else if (EnableSeeThroughNon4KDistortDataUse == false && EnableUnitySeeThroughNon4KDistortData == true)
            {
                bool result = SeeThrough.SRWork_SeeThrough.TurnOffSeeThroughDistortData();
                if (result)
                {
                    EnableUnitySeeThroughNon4KDistortData = false;
                }
            }

            if (EnableDepthMeshModule == true && EnableUnityDepthMesh == false)
            {
                Modules[1].Initial();
                //Get refinement setting of engine.
                int result = SRWorkModule_API.GetDepthParameterBool((int)DepthCmd.ENABLE_REFINEMENT, ref refinement_setting);
                if (result == (int)SR.Error.WORK)
                {
                    ViveSR_DualCameraImageCapture.DepthRefinement = refinement_setting;
                }
                SRWorkModule_API.UnlinkModule((int)ModuleType.DEPTH, (int)ModuleType.DEPTHMESH);
                EnableUnityDepthMesh = true;
            }

            if (EnableRigidReconstructionModule == true && EnableUnityReconstruction == false)
            {
                Modules[2].Initial();
                SRWorkModule_API.UnlinkModule((int)ModuleType.DEPTH, (int)ModuleType.RIGIDRECONSTRUCTION);
                EnableUnityReconstruction = true;
            }
        }