Exemple #1
0
        private void CheckParam()
        {
            float realTime = Time.realtimeSinceStartup;

            if (LiveParam.IsDirty && realTime - lastSaveParamTime > saveParamInterval)
            {
                LiveParam.SaveParam();
                lastSaveParamTime = realTime;
            }
        }
Exemple #2
0
        protected override void _TurnOn()
        {
            // 加载Live配置文件
            AppConfig config = AppConfig.Instance;

            config.LoadConfig(MEHoloConstant.LiveConfigFile);
            listenPort    = int.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Live_Port", "8099"));
            listenPortUDP = int.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Live_Port_UDP", "8098"));
            useUDP        = bool.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Use_UDP", "TRUE"));
            outputPath    = AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Out_Put_Path", "C:\\HologramCapture");

            config.LoadConfig(MEHoloConstant.CalibrationConfigFile);
            holoServerHost = config.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1");

            outputPath = config.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Out_Put_Path", "./");
            if (!outputPath.EndsWith("/") && !outputPath.EndsWith("\\"))
            {
                outputPath += "/";
            }

            // 读取参数设置
            if (!LiveParam.LoadParam())
            {
                LiveParam.SoundVolume = AudioListener.volume;
                LiveParam.SaveParam();
            }

            // 读取本地位置存储文件
            LoadTransformByFile();

            // 初始化并启动UI
            GameObject uiObj = PrefabUtils.CreateGameObjectToParent(this.gameObject, uiPrefab);

            liveUI = uiObj.GetComponent <LiveControllerUI>();
            liveUI.Init(this, (float)GetFrameWidth() / (float)GetFrameHeight());
            liveUI.TurnOn();

            // 初始化Windows device protocal
            wdpController.Init(this, liveUI);


            // 启动Lilve摄像机
            GameObject cameraObj = PrefabUtils.CreateGameObjectToParent(this.gameObject, holoCameraPrefab);

            holoCamera = cameraObj.GetComponent <HolographicCameraManager>();

            calibrationManager = holoCamera.gameObject.AddComponent <CalibrationManager>();
            calibrationManager.Init();

            // 延迟启动全息摄影机
            StartCoroutine(StartHoloCamera());

            // Log
            logManager = LogManager.Instance;

            // 关闭主摄影机的显示
            oldCameraMask = mainCamera.cullingMask;
            //mainCamera.cullingMask = 0;

            // 设置一下frameoffset
            SetFrameOffset(0.5f);

            // 停止input操作

            /*
             * if (inputManager != null)
             * {
             *  inputManager.StopCapture();
             * }
             */
        }
        protected override void _TurnOn()
        {
            // 加载Live配置文件
            AppConfig config = AppConfig.Instance;

            config.LoadConfig(MEHoloConstant.LiveConfigFile);
            listenPort    = int.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Live_Port", "8099"));
            listenPortUDP = int.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Live_Port_UDP", "8098"));
            useUDP        = bool.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Use_UDP", "TRUE"));
            outputPath    = AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Out_Put_Path", "C:\\HologramCapture");

            frameRate = int.Parse(AppConfig.Instance.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Frame_Rate", "60"));

            config.LoadConfig(MEHoloConstant.CalibrationConfigFile);
            holoServerHost = config.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Host", "127.0.0.1");
            int.TryParse(config.GetConfigByFileName(MEHoloConstant.NetworkConfigFile, "Server_Port", "8848"), out holoServerPort);

            outputPath = config.GetConfigByFileName(MEHoloConstant.LiveConfigFile, "Out_Put_Path", "./");
            if (!outputPath.EndsWith("/") && !outputPath.EndsWith("\\"))
            {
                outputPath += "/";
            }

            // 读取参数设置
            if (!LiveParam.LoadParam())
            {
                LiveParam.SoundVolume = AudioListener.volume;
                LiveParam.SaveParam();
            }



            // 读取本地位置存储文件
            LoadTransformByFile(LoadTransType.CameraAndAnchor);

            // 初始化并启动UI
            GameObject uiObj = PrefabUtils.CreateGameObjectToParent(this.gameObject, uiPrefab);

            liveUI = uiObj.GetComponent <LiveControllerUI>();
            liveUI.Init(this, (float)GetFrameWidth() / (float)GetFrameHeight());
            liveUI.TurnOn();

            // 初始化Windows device protocal
            wdpController.Init(this, liveUI);

            calibrationManager = holoCamera.gameObject.AddComponent <CalibrationManager>();
            calibrationManager.Init();

            // 刷新显示
            //  liveUI.mainPanel.RefreshFOVInput();

            // 延迟启动全息摄影机
            StartHoloCamera();

            // Log
            logManager = LogManager.Instance;

            // 关闭主摄影机的显示
            oldCameraMask = mainCamera.cullingMask;
            //mainCamera.cullingMask = 0;

            // 设置一下frameoffset
            SetFrameOffset(0f);

            // 停止input操作

            /*
             * if (inputManager != null)
             * {
             *  inputManager.StopCapture();
             * }
             */

            // 绑定Anchor回调
            anchorController.AddCallbackTurnOn(OnAnchorTurnOn);
            anchorController.AddCallbackTurnOff(OnAnchorTurnOff);
            StartCoroutine(WaitForSetAlpha());
            StartCoroutine(WaitForSetFilter());
        }