Esempio n. 1
0
    private void Awake()
    {
        if (OVRManager.instance != null)
        {
            base.enabled = false;
            UnityEngine.Object.DestroyImmediate(this);
            return;
        }
        OVRManager.instance = this;
        Debug.Log(string.Concat(new object[]
        {
            "Unity v",
            Application.unityVersion,
            ", Oculus Utilities v",
            OVRPlugin.wrapperVersion,
            ", OVRPlugin v",
            OVRPlugin.version,
            ", SDK v",
            OVRPlugin.nativeSDKVersion,
            "."
        }));
        string text = GraphicsDeviceType.Direct3D11.ToString() + ", " + GraphicsDeviceType.Direct3D12.ToString();

        if (!text.Contains(SystemInfo.graphicsDeviceType.ToString()))
        {
            Debug.LogWarning("VR rendering requires one of the following device types: (" + text + "). Your graphics device: " + SystemInfo.graphicsDeviceType.ToString());
        }
        RuntimePlatform platform = Application.platform;

        this.isSupportedPlatform |= (platform == RuntimePlatform.Android);
        this.isSupportedPlatform |= (platform == RuntimePlatform.OSXEditor);
        this.isSupportedPlatform |= (platform == RuntimePlatform.OSXPlayer);
        this.isSupportedPlatform |= (platform == RuntimePlatform.WindowsEditor);
        this.isSupportedPlatform |= (platform == RuntimePlatform.WindowsPlayer);
        if (!this.isSupportedPlatform)
        {
            Debug.LogWarning("This platform is unsupported");
            return;
        }
        this.enableMixedReality = false;
        bool flag  = OVRManager.LoadMixedRealityCaptureConfigurationFileFromCmd();
        bool flag2 = OVRManager.CreateMixedRealityCaptureConfigurationFileFromCmd();

        if (flag || flag2)
        {
            OVRMixedRealityCaptureSettings ovrmixedRealityCaptureSettings = ScriptableObject.CreateInstance <OVRMixedRealityCaptureSettings>();
            ovrmixedRealityCaptureSettings.ReadFrom(this);
            if (flag)
            {
                ovrmixedRealityCaptureSettings.CombineWithConfigurationFile();
                ovrmixedRealityCaptureSettings.ApplyTo(this);
            }
            if (flag2)
            {
                ovrmixedRealityCaptureSettings.WriteToConfigurationFile();
            }
            UnityEngine.Object.Destroy(ovrmixedRealityCaptureSettings);
        }
        if (OVRManager.MixedRealityEnabledFromCmd())
        {
            this.enableMixedReality = true;
        }
        if (this.enableMixedReality)
        {
            Debug.Log("OVR: Mixed Reality mode enabled");
            if (OVRManager.UseDirectCompositionFromCmd())
            {
                this.compositionMethod = OVRManager.CompositionMethod.Direct;
            }
            if (OVRManager.UseExternalCompositionFromCmd())
            {
                this.compositionMethod = OVRManager.CompositionMethod.External;
            }
            Debug.Log("OVR: CompositionMethod : " + this.compositionMethod);
        }
        if (this.enableAdaptiveResolution && !OVRManager.IsAdaptiveResSupportedByEngine())
        {
            this.enableAdaptiveResolution = false;
            Debug.LogError("Your current Unity Engine " + Application.unityVersion + " might have issues to support adaptive resolution, please disable it under OVRManager");
        }
        this.Initialize();
        if (this.resetTrackerOnLoad)
        {
            OVRManager.display.RecenterPose();
        }
        OVRPlugin.occlusionMesh = true;
    }