Example #1
0
    void Start()
    {
        MiddleVRTools.Log(4, "[>] VR Manager Start.");

#if !UNITY_3_4 && !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1
        m_AllowRenderTargetAA = true;
#endif

        InitializeVR();

        // Reset Manager's position so text display is correct.
        transform.position   = new UnityEngine.Vector3(0, 0, 0);
        transform.rotation   = new Quaternion();
        transform.localScale = new UnityEngine.Vector3(1, 1, 1);

        m_Wand = GameObject.Find("VRWand");

        if (ShowFPS)
        {
            guiText.enabled = true;
        }
        else
        {
            guiText.enabled = false;
        }

        if (ShowWand)
        {
            ShowWandGeometry(true);
        }
        else
        {
            ShowWandGeometry(false);
        }

        if (ForceQuality)
        {
#if UNITY_3_4
            QualitySettings.currentLevel = (QualityLevel)ForceQualityIndex;
#else
            QualitySettings.SetQualityLevel(ForceQualityIndex);
#endif
            //bool useOpenGLQuadbuffer = MiddleVR.VRDisplayMgr.GetActiveViewport(0).GetStereo() && (MiddleVR.VRDisplayMgr.GetActiveViewport(0).GetStereoMode()==0); //VRStereoMode_QuadBuffer = 0
            if (!Application.isEditor && (/* useOpenGLQuadbuffer || */ MiddleVR.VRClusterMgr.GetForceOpenGLConversion()))
            {
                m_NeedDelayedRenderingReset = true;
                m_RenderingResetDelay       = 1;
            }
        }

        // Manage VSync after the quality settings
        MiddleVRTools.ManageVSync();

        // Set AA from vrx configuration file
        //QualitySettings.antiAliasing = m_AntiAliasingLevel;

        MiddleVRTools.Log(4, "[<] End of VR Manager Start.");
    }
Example #2
0
    void Start()
    {
        MiddleVRTools.Log(4, "[>] VR Manager Start.");

#if !UNITY_3_4 && !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1
        m_AllowRenderTargetAA = true;
#endif

        InitializeVR();

        // Reset Manager's position so text display is correct.
        transform.position   = new UnityEngine.Vector3(0, 0, 0);
        transform.rotation   = new Quaternion();
        transform.localScale = new UnityEngine.Vector3(1, 1, 1);

        m_Wand = GameObject.Find("VRWand");

        if (ShowFPS)
        {
            guiText.enabled = true;
        }
        else
        {
            guiText.enabled = false;
        }

        if (ShowWand)
        {
            ShowWandGeometry(true);
        }
        else
        {
            ShowWandGeometry(false);
        }

        // Initialize navigation interaction technique
        switch (NavigationMethod)
        {
        case ENavigationMode.None:
            // None
            break;

        case ENavigationMode.Joystick:
            m_Wand.GetComponent <VRInteractionNavigationWandJoystick>().enabled = true;
            break;

        case ENavigationMode.Elastic:
            m_Wand.GetComponent <VRInteractionNavigationElastic>().enabled = true;
            break;

        case ENavigationMode.GrabWorld:
            m_Wand.GetComponent <VRInteractionNavigationGrabWorld>().enabled = true;
            break;

        default:
            break;
        }

        // Initialize navigation mode switch
        for (int i = 0; i < m_NavigationScipts.Count; ++i)
        {
            MonoBehaviour currentNavigation = (MonoBehaviour)this.GetComponent((string)m_NavigationScipts[i]);
            if (currentNavigation != null)
            {
                if (currentNavigation.enabled)
                {
                    m_CurrentNavigationNb = i;
                }
            }
        }

        if (ForceQuality)
        {
#if UNITY_3_4
            QualitySettings.currentLevel = (QualityLevel)ForceQualityIndex;
#else
            QualitySettings.SetQualityLevel(ForceQualityIndex);
#endif
            bool useOpenGLQuadbuffer = MiddleVR.VRDisplayMgr.GetActiveViewport(0).GetStereo() && (MiddleVR.VRDisplayMgr.GetActiveViewport(0).GetStereoMode() == 0); //VRStereoMode_QuadBuffer = 0
            if (!Application.isEditor && (useOpenGLQuadbuffer || MiddleVR.VRClusterMgr.GetForceOpenGLConversion()))
            {
                m_NeedDelayedRenderingReset = true;
                m_RenderingResetDelay       = 1;
            }
        }

        // Manage VSync after the quality settings
        MiddleVRTools.ManageVSync();

        // Set AA from vrx configuration file
        QualitySettings.antiAliasing = m_AntiAliasingLevel;

        MiddleVRTools.Log(4, "[<] End of VR Manager Start.");
    }