protected virtual void Awake()
        {
            // Hide MouseCursor:
#if !UNITY_EDITOR
            Cursor.visible = isMouseVisible;
#endif
            _configManager = CmdConfigManager.Instance;

            if (_configManager.applicationType == CmdConfigManager.AppType.WALL)             // Wall
            {
                StartWall();
            }
            else             // Floor
            {
                StartFloor();
            }
        }
Пример #2
0
        private void Start()
        {
            _config = CmdConfigManager.Instance;

            if (_worldCameras.Length == 0)
            {
                Debug.LogWarning("No World Camera have been linked as reference.", gameObject);
            }
            else
            {
                // For Wall, use the first camera (it is a wall one), for floor, use the last one (it is a floor one).
                int camIndex = (_config.applicationType == CmdConfigManager.AppType.WALL ? 0 : (_worldCameras.Length - 1));
                inputEyeDistWorld.text = _worldCameras[camIndex].StereoSeparation.ToString();
                //// Just in case they are not equal at the beginning: Don't do this... Double invertation follows because of this...
                //for (int ii = 1; ii < _worldCameras.Length; ++ii)
                //{
                //	_worldCameras[ii].StereoSeparation = _worldCameras[0].StereoSeparation;
                //}
            }

            if (_stereoCanvasScaler.Length == 0)
            {
                Debug.LogWarning("No Stereo Canvas Scaler have been linked as reference.", gameObject);
            }
            else
            {
                // For Wall, use the first camera (it is a wall one), for floor, use the last one (it is a floor one).
                int canvasScalerIndex = (_config.applicationType == CmdConfigManager.AppType.WALL ? 0 : (_stereoCanvasScaler.Length - 1));
                inputUiCanvasScale.text = _stereoCanvasScaler[canvasScalerIndex].DefaultStereoScale.ToString();
                //// Just in case they are not equal at the beginning: This is not necessary.
                //for (int ii = 1; ii < _stereoCanvasScaler.Length; ++ii)
                //{
                //	_stereoCanvasScaler[ii].SetCanvasStereoScale(_stereoCanvasScaler[0].DefaultStereoScale);
                //}
            }

            // Default: Turn off the Debug UI:
#if !UNITY_EDITOR
            Cursor.visible = false;
#endif
            canvas.enabled = false;
            isUiVisible    = false;

            inputEyeDistWorld.onEndEdit.AddListener(delegate { OnChangeEyeSeperationWorld(inputEyeDistWorld.text); });
            inputUiCanvasScale.onEndEdit.AddListener(delegate { OnChangeConvergenceDistScale(inputUiCanvasScale.text); });
        }
Пример #3
0
    private void Awake()
    {
        _cam = GetComponent <Camera>();

        // Separation is done via slight position offsets, the _cam.stereoSeparation is "disabled" by setting it 0, because it interferes with our own calculations.
        _cam.stereoSeparation = 0f;

#if UNITY_EDITOR // If in editor, check if it is playing. If not playing, do not execute this code in editor (ExecuteInEditMode would run in too, if I don't check it.) But in a build, always do it.
        if (UnityEditor.EditorApplication.isPlaying == true)
#endif
        {
            DeepSpace.CmdConfigManager configMgr = DeepSpace.CmdConfigManager.Instance;

            if (configMgr != null)
            {
                _stereoSeparation *= (configMgr.invertStereo ? -1f : 1f);
            }

            UpdateStereoSeparation();
        }
    }