コード例 #1
0
    /// <summary>
    /// Updates the internal state of the Mixed Reality Camera. Called by OVRManager.
    /// </summary>

    public static void Update(GameObject parentObject, Camera mainCamera, OVRManager.CompositionMethod compositionMethod, bool useDynamicLighting, OVRManager.CameraDevice cameraDevice, OVRManager.DepthQuality depthQuality)
    {
        if (!OVRPlugin.initialized)
        {
            Debug.LogError("OVRPlugin not initialized");
            return;
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            OVRPlugin.InitializeMixedReality();
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            Debug.LogError("Unable to initialize MixedReality");
            return;
        }

        OVRPlugin.UpdateExternalCamera();
        OVRPlugin.UpdateCameraDevices();

        if (currentComposition != null && currentComposition.CompositionMethod() != compositionMethod)
        {
            currentComposition.Cleanup();
            currentComposition = null;
        }

        if (compositionMethod == OVRManager.CompositionMethod.External)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRExternalComposition(parentObject, mainCamera);
            }
        }
        else if (compositionMethod == OVRManager.CompositionMethod.Direct)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRDirectComposition(parentObject, mainCamera, cameraDevice, useDynamicLighting, depthQuality);
            }
        }
        else if (compositionMethod == OVRManager.CompositionMethod.Sandwich)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRSandwichComposition(parentObject, mainCamera, cameraDevice, useDynamicLighting, depthQuality);
            }
        }
        else
        {
            Debug.LogError("Unknown CompositionMethod : " + compositionMethod);
            return;
        }
        currentComposition.Update(mainCamera);
    }
コード例 #2
0
ファイル: OVRMixedReality.cs プロジェクト: bean710/Yonder
    /// <summary>
    /// Updates the internal state of the Mixed Reality Camera. Called by OVRManager.
    /// </summary>

    public static void Update(GameObject parentObject, Camera mainCamera, OVRMixedRealityCaptureConfiguration configuration, OVRManager.TrackingOrigin trackingOrigin)
    {
        if (!OVRPlugin.initialized)
        {
            Debug.LogError("OVRPlugin not initialized");
            return;
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            OVRPlugin.InitializeMixedReality();
            if (OVRPlugin.IsMixedRealityInitialized())
            {
                Debug.Log("OVRPlugin_MixedReality initialized");
            }
            else
            {
                Debug.LogError("Unable to initialize OVRPlugin_MixedReality");
                return;
            }
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            return;
        }

        OVRPlugin.UpdateExternalCamera();
#if !OVR_ANDROID_MRC
        OVRPlugin.UpdateCameraDevices();
#endif

#if OVR_ANDROID_MRC
        useFakeExternalCamera = OVRPlugin.Media.UseMrcDebugCamera();
#endif

        if (currentComposition != null && (currentComposition.CompositionMethod() != configuration.compositionMethod))
        {
            currentComposition.Cleanup();
            currentComposition = null;
        }

        if (configuration.compositionMethod == OVRManager.CompositionMethod.External)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRExternalComposition(parentObject, mainCamera, configuration);
            }
        }
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        else if (configuration.compositionMethod == OVRManager.CompositionMethod.Direct)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRDirectComposition(parentObject, mainCamera, configuration);
            }
        }
#endif
        else
        {
            Debug.LogError("Unknown CompositionMethod : " + configuration.compositionMethod);
            return;
        }
        currentComposition.Update(parentObject, mainCamera, configuration, trackingOrigin);
    }
コード例 #3
0
ファイル: OVRMixedReality.cs プロジェクト: boadle/CCTV-VR
    /// <summary>
    /// Updates the internal state of the Mixed Reality Camera. Called by OVRManager.
    /// </summary>

    public static void Update(GameObject parentObject, Camera mainCamera, OVRManager.CompositionMethod compositionMethod, bool useDynamicLighting, OVRManager.CameraDevice cameraDevice, OVRManager.DepthQuality depthQuality)
    {
        if (!OVRPlugin.initialized)
        {
            Debug.LogError("OVRPlugin not initialized");
            return;
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            OVRPlugin.InitializeMixedReality();
            if (OVRPlugin.IsMixedRealityInitialized())
            {
                Debug.Log("OVRPlugin_MixedReality initialized");
            }
            else
            {
                Debug.LogError("Unable to initialize OVRPlugin_MixedReality");
                return;
            }
        }

        if (!OVRPlugin.IsMixedRealityInitialized())
        {
            return;
        }

        OVRPlugin.UpdateExternalCamera();
#if !OVR_ANDROID_MRC
        OVRPlugin.UpdateCameraDevices();
#endif

#if OVR_ANDROID_MRC
        useFakeExternalCamera = OVRPlugin.Media.UseMrcDebugCamera();
#endif

        if (currentComposition != null && currentComposition.CompositionMethod() != compositionMethod)
        {
            currentComposition.Cleanup();
            currentComposition = null;
        }

        if (compositionMethod == OVRManager.CompositionMethod.External)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRExternalComposition(parentObject, mainCamera);
            }
        }
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        else if (compositionMethod == OVRManager.CompositionMethod.Direct)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRDirectComposition(parentObject, mainCamera, cameraDevice, useDynamicLighting, depthQuality);
            }
        }
        else if (compositionMethod == OVRManager.CompositionMethod.Sandwich)
        {
            if (currentComposition == null)
            {
                currentComposition = new OVRSandwichComposition(parentObject, mainCamera, cameraDevice, useDynamicLighting, depthQuality);
            }
        }
#endif
        else
        {
            Debug.LogError("Unknown CompositionMethod : " + compositionMethod);
            return;
        }
        currentComposition.Update(mainCamera);
    }