コード例 #1
0
ファイル: VRSettingsURP.cs プロジェクト: NON906/HandMR
        void Start()
        {
            XRSettings.enabled = false;

            settingDefaultValues();

            fisheyes_ = HandMRManagerObj.MRObject.GetComponentsInChildren <FisheyeURP>();

            float iDistanceValue = PlayerPrefs.GetFloat("HandMR_InterpupillaryDistance", interpupillaryDistanceDefault_);

            InterpupillaryDistanceSlider.value    = iDistanceValue;
            InterpupillaryDistanceInputField.text = "" + (int)iDistanceValue;
            ScreenSizeDropdown.value = PlayerPrefs.GetInt("HandMR_ScreenSize", screenSizeDefault_);

            float fisheyeFieldOfView = PlayerPrefs.GetFloat("HandMR_FisheyeFieldOfView", fisheyeFieldOfViewDefault_);

            FisheyeFieldOfViewSlider.value    = fisheyeFieldOfView;
            FisheyeFieldOfViewInputField.text = "" + (int)fisheyeFieldOfView;
            float fisheyeRate = PlayerPrefs.GetFloat("HandMR_URP_Intensity", fisheyeRateDefault_);

            FisheyeRateSlider.value    = fisheyeRate;
            FisheyeRateInputField.text = "" + (int)fisheyeRate;
            float fisheyeCenter = PlayerPrefs.GetFloat("HandMR_FisheyeCenter", fisheyeCenterDefault_);

            FisheyeCenterSlider.value    = fisheyeCenter;
            FisheyeCenterInputField.text = "" + (int)fisheyeCenter;
            float scale = PlayerPrefs.GetFloat("HandMR_URP_Scale", scaleDefault_);

            ScaleSlider.value    = scale;
            ScaleInputField.text = "" + (int)scale;

            HandMRManagerObj.ViewModeChange(HandMRManager.Mode.VR);

            foreach (FisheyeURP fisheye in fisheyes_)
            {
                fisheye.Intensity      = PlayerPrefs.GetFloat("HandMR_URP_Intensity", fisheyeRateDefault_) * 0.01f;
                fisheye.CenterPosition = PlayerPrefs.GetFloat("HandMR_FisheyeCenter", fisheyeCenterDefault_) * 0.01f;
                fisheye.Scale          = PlayerPrefs.GetFloat("HandMR_URP_Scale", scaleDefault_) * 0.01f;
            }
            HandMRManagerObj.FieldOfView = PlayerPrefs.GetFloat("HandMR_FisheyeFieldOfView", fisheyeFieldOfViewDefault_);

            HologlaCameraManager hologlaCameraManager = HologlaCameraManagerObj.GetComponent <HologlaCameraManager>();

            hologlaCameraManager.ApplyIPD(PlayerPrefs.GetFloat("HandMR_InterpupillaryDistance", interpupillaryDistanceDefault_));
            hologlaCameraManager.SwitchViewSize((HologlaCameraManager.ViewSize)PlayerPrefs.GetInt("HandMR_ScreenSize", screenSizeDefault_));
        }
コード例 #2
0
        void Start()
        {
            if (HandMRManagerObj == null || HologlaCameraManagerObj == null || HandVRMainObj == null ||
                LeftButton == null || RightButton == null)
            {
                return;
            }

            HandVRMainObj.ShiftX = PlayerPrefs.GetFloat("HandMR_HandPositionX", 0f) * 0.001f;

            HandMRManagerObj.HandDetectionMode =
                (HandMRManager.HandDetection)PlayerPrefs.GetInt("HandMR_HandDetectionMode", (int)HandMRManager.HandDetection.Both);

            int mode = PlayerPrefs.GetInt("HandMR_GoogleMode", 0);

            if (mode <= 1)
            {
                HandMRManagerObj.ViewModeChange(HandMRManager.Mode.MR);

                if (PlayerPrefs.GetInt("HandMR_PhonePosition", 0) == 0)
                {
                    HandVRMainObj.ShiftY = PlayerPrefs.GetFloat("HandMR_HandPositionY", 0f) * -0.001f;
                }
                else
                {
                    HandVRMainObj.ShiftY   = PlayerPrefs.GetFloat("HandMR_HandPositionY", 0f) * 0.001f;
                    LeftButton.localScale  = new Vector3(LeftButton.localScale.x, -LeftButton.localScale.y, LeftButton.localScale.z);
                    RightButton.localScale = new Vector3(RightButton.localScale.x, -RightButton.localScale.y, RightButton.localScale.z);
                }

                HologlaCameraManager hologlaCameraManager = HologlaCameraManagerObj.GetComponent <HologlaCameraManager>();

                if (mode == 1)
                {
                    hologlaCameraManager.SwitchEyeMode(HologlaCameraManager.EyeMode.SingleEye);
                }

                hologlaCameraManager.ApplyIPD(PlayerPrefs.GetFloat("HandMR_InterpupillaryDistance", 64f));
                hologlaCameraManager.SwitchViewSize((HologlaCameraManager.ViewSize)PlayerPrefs.GetInt("HandMR_ScreenSize", 0));
            }
            else if (mode == 2)
            {
                HandMRManagerObj.ViewModeChange(HandMRManager.Mode.VR);

#if ENABLE_URP
                FisheyeURP[] fisheyeURPs = HandMRManagerObj.MRObject.GetComponentsInChildren <FisheyeURP>();
                foreach (FisheyeURP fisheye in fisheyeURPs)
                {
                    fisheye.Intensity      = PlayerPrefs.GetFloat("HandMR_URP_Intensity", 58f) * 0.01f;
                    fisheye.CenterPosition = PlayerPrefs.GetFloat("HandMR_FisheyeCenter", 50f) * 0.01f;
                    fisheye.Scale          = PlayerPrefs.GetFloat("HandMR_URP_Scale", 100f) * 0.01f;
                }
#else
                fisheyes_ = HandMRManagerObj.MRObject.GetComponentsInChildren <Fisheye>();
                foreach (Fisheye fisheye in fisheyes_)
                {
                    fisheye.Rate   = PlayerPrefs.GetFloat("HandMR_FisheyeRate", 58f) * 0.01f;
                    fisheye.Center = PlayerPrefs.GetFloat("HandMR_FisheyeCenter", 50f) * 0.01f;
                }
#endif
                HandMRManagerObj.FieldOfView = PlayerPrefs.GetFloat("HandMR_FisheyeFieldOfView", 90f);

                LeftButton.GetChild(0).GetComponent <Image>().enabled  = false;
                RightButton.GetChild(0).GetComponent <Image>().enabled = false;

                HologlaCameraManager hologlaCameraManager = HologlaCameraManagerObj.GetComponent <HologlaCameraManager>();
                hologlaCameraManager.ApplyIPD(PlayerPrefs.GetFloat("HandMR_InterpupillaryDistance", 64f));
                hologlaCameraManager.SwitchViewSize((HologlaCameraManager.ViewSize)PlayerPrefs.GetInt("HandMR_ScreenSize", 0));
            }
            else if (mode == 3)
            {
                HandMRManagerObj.ViewModeChange(HandMRManager.Mode.VRSingle);
            }
            else
            {
                HandVRMainObj.ShiftX = 0f;
                HandMRManagerObj.ViewModeChange(HandMRManager.Mode.AR);
            }

            if (HandAreaObj != null)
            {
                HandAreaObj.SetActive(PlayerPrefs.GetInt("HandMR_HandArea", 1) != 0);
            }
        }