示例#1
0
        } //END Start

        //---------------------------------//
        private void CallStart()
        //---------------------------------//
        {
            //Find the current XR device
            XRMode.GetCurrentXRDevice(out currentXRDevice);

            //Set the current Screen Orientation
            currentOrientation = Screen.orientation;
        } //END CallStart
示例#2
0
文件: XRMode.cs 项目: contrejo27/Jose
        } //END Awake

        //--------------------------------------------//
        private void DestroyDuplicateInstance()
        //--------------------------------------------//
        {

            //Ensure only one instance exists
            if( _instance == null )
            {
                _instance = this;
            }
            else if( this != _instance )
            {
                Destroy( this.gameObject );
            }

        } //END DestroyDuplicateInstance
示例#3
0
        } //END CreatePhysicsRaycaster


        //-----------------------------------//
        public void SetCenterOfScreen()
        //-----------------------------------//
        {

            // Center of screen is center of eye texture width
            if( XRMode.IsVRModeOn() )
            {
                centerOfScreen = new Vector2( (float)UnityEngine.XR.XRSettings.eyeTextureWidth / 2, (float)UnityEngine.XR.XRSettings.eyeTextureHeight / 2 );
            }
            // VR support is not on (Using Cardboard SDK)
            else
            {
                // Get center of screen the normal way
                centerOfScreen = new Vector2( Screen.width / 2, Screen.height / 2 );
            }

            //Debug.Log( "SetCenterOfScreen() GazeInputEnabled... centerOfScreen = " + centerOfScreen );

        } //END SetCenterOfScreen
示例#4
0
文件: XRMode.cs 项目: contrejo27/Jose
        } //END IsTouchInputEnabled




        //-----------------------------------//
        public void SetDistortionBasedOnSettings()
        //-----------------------------------//
        {

            //Make sure that the proper scripts exist in the scene
            AddBarrelDistortionScriptToCamera();

            //Find the current XR device, if we're supposed to, then set the barrel settings based on the current XR device
            if( FixLensDistortionSettings != null && FixLensDistortionSettings.Count > 0 && XRMode.GetCurrentXRDevice( out currentHelper.XRDeviceType ) )
            {
                
                foreach( XRCameraBarrelDistortionHelper helper in FixLensDistortionSettings )
                {
                    if( showDebug ) Debug.Log( "SetDistortionBasedOnSettings() helper.PlatformType( " + helper.PlatformType + " ) == Application.Platform( " + Application.platform + ") = " + ( helper.PlatformType == Application.platform ) + ", ......... and helper.device( " + helper.device + " ) == currentHelper.XRDeviceType( " + currentHelper.XRDeviceType + " ) = " + ( helper.device == currentHelper.XRDeviceType ) + ", ....... enableDistortion = " + helper.enableDistortion );

                    if( helper.PlatformType == Application.platform && helper.device == currentHelper.XRDeviceType )
                    {
                        if( XRCameraBarrelDistortion.instance != null )
                        {
                            XRCameraBarrelDistortion.instance.SetCameraDistortionCorrection( helper.enableDistortion, helper.strength );
                        }
                        
                        if( XRCameraBarrelDistortionLine.instance != null )
                        {
                            XRCameraBarrelDistortionLine.instance.SetDistortionLine( helper.showCenterLine );
                        }

                        return;
                    }
                }
            }

            //We didn't find any matching settings, disable distortion and the center line
            if( XRCameraBarrelDistortion.instance != null )
            {
                XRCameraBarrelDistortion.instance.enableDistortion = false;
            }

            if( XRCameraBarrelDistortionLine.instance != null )
            {
                XRCameraBarrelDistortionLine.instance.SetDistortionLine( false );
            }

        } //END SetDistortionBasedOnSettings