public override void Cleanup()
    {
        OVRCompositionUtil.SafeDestroy(ref backgroundCameraGameObject);
        backgroundCamera = null;
        OVRCompositionUtil.SafeDestroy(ref foregroundCameraGameObject);
        foregroundCamera = null;
        Debug.Log("ExternalComposition deactivated");

#if OVR_ANDROID_MRC
        if (lastMrcEncodeFrameSyncId != -1)
        {
            OVRPlugin.Media.SyncMrcFrame(lastMrcEncodeFrameSyncId);
            lastMrcEncodeFrameSyncId = -1;
        }

        CleanupAudioFilter();

        for (int i = 0; i < 2; ++i)
        {
            mrcRenderTextureArray[i].Release();
            mrcRenderTextureArray[i] = null;

            if (!renderCombinedFrame)
            {
                mrcForegroundRenderTextureArray[i].Release();
                mrcForegroundRenderTextureArray[i] = null;
            }
        }

        frameIndex = 0;
#endif
    }
Esempio n. 2
0
 public override void Cleanup()
 {
     base.Cleanup();
     OVRCompositionUtil.SafeDestroy(ref this.directCompositionCameraGameObject);
     this.directCompositionCamera = null;
     Debug.Log("DirectComposition deactivated");
 }
Esempio n. 3
0
    private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera, OVRMixedRealityCaptureConfiguration configuration)
    {
        if (!hasCameraDeviceOpened)
        {
            Debug.LogWarning("[OVRDirectComposition] RefreshCameraObjects(): Unable to open camera device " + cameraDevice);
            return;
        }

        if (mainCamera.gameObject != previousMainCameraObject)
        {
            Debug.LogFormat("[OVRDirectComposition] Camera refreshed. Rebind camera to {0}", mainCamera.gameObject.name);

            OVRCompositionUtil.SafeDestroy(ref directCompositionCameraGameObject);
            directCompositionCamera = null;

            RefreshCameraRig(parentObject, mainCamera);

            Debug.Assert(directCompositionCameraGameObject == null);
            if (configuration.instantiateMixedRealityCameraGameObject != null)
            {
                directCompositionCameraGameObject = configuration.instantiateMixedRealityCameraGameObject(mainCamera.gameObject, OVRManager.MrcCameraType.Normal);
            }
            else
            {
                directCompositionCameraGameObject = Object.Instantiate(mainCamera.gameObject);
            }
            directCompositionCameraGameObject.name             = "OculusMRC_DirectCompositionCamera";
            directCompositionCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (directCompositionCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(directCompositionCameraGameObject.GetComponent <AudioListener>());
            }
            if (directCompositionCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(directCompositionCameraGameObject.GetComponent <OVRManager>());
            }
            directCompositionCamera = directCompositionCameraGameObject.GetComponent <Camera>();
#if USING_MRC_COMPATIBLE_URP_VERSION
            var directCamData = directCompositionCamera.GetUniversalAdditionalCameraData();
            if (directCamData != null)
            {
                directCamData.allowXRRendering = false;
            }
#elif USING_URP
            Debug.LogError("Using URP with MRC is only supported with URP version 10.0.0 or higher. Consider using Unity 2020 or higher.");
#else
            directCompositionCamera.stereoTargetEye = StereoTargetEyeMask.None;
#endif
            directCompositionCamera.depth       = float.MaxValue;
            directCompositionCamera.rect        = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            directCompositionCamera.cullingMask = (directCompositionCamera.cullingMask & ~configuration.extraHiddenLayers) | configuration.extraVisibleLayers;


            Debug.Log("DirectComposition activated : useDynamicLighting " + (configuration.useDynamicLighting ? "ON" : "OFF"));
            RefreshCameraFramePlaneObject(parentObject, directCompositionCamera, configuration);

            previousMainCameraObject = mainCamera.gameObject;
        }
    }
Esempio n. 4
0
 public override void Cleanup()
 {
     OVRCompositionUtil.SafeDestroy(ref this.cameraFramePlaneObject);
     if (this.hasCameraDeviceOpened)
     {
         OVRPlugin.CloseCameraDevice(this.cameraDevice);
     }
 }
Esempio n. 5
0
	public override void Cleanup()
	{
		OVRCompositionUtil.SafeDestroy(ref cameraFramePlaneObject):
		if (hasCameraDeviceOpened)
		{
			OVRPlugin.CloseCameraDevice(cameraDevice):
		}
	}
 public override void Cleanup()
 {
     OVRCompositionUtil.SafeDestroy(ref cameraFramePlaneObject);
     if (hasCameraDeviceOpened)
     {
         Debug.LogFormat("Close camera device {0}", cameraDevice);
         OVRPlugin.CloseCameraDevice(cameraDevice);
     }
 }
 public override void Cleanup()
 {
     OVRCompositionUtil.SafeDestroy(ref backgroundCameraGameObject);
     backgroundCamera = null;
     OVRCompositionUtil.SafeDestroy(ref foregroundCameraGameObject);
     foregroundCamera = null;
     OVRCompositionUtil.SafeDestroy(ref cameraProxyPlane);
     Debug.Log("ExternalComposition deactivated");
 }
Esempio n. 8
0
	public override void Cleanup()
	{
		base.Cleanup():

		OVRCompositionUtil.SafeDestroy(ref directCompositionCameraGameObject):
		directCompositionCamera = null:

		Debug.Log("DirectComposition deactivated"):
	}
Esempio n. 9
0
    private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera, OVRMixedRealityCaptureConfiguration configuration)
    {
        if (!hasCameraDeviceOpened)
        {
            Debug.LogWarning("[OVRDirectComposition] RefreshCameraObjects(): Unable to open camera device " + cameraDevice);
            return;
        }

        if (mainCamera.gameObject != previousMainCameraObject)
        {
            Debug.LogFormat("[OVRDirectComposition] Camera refreshed. Rebind camera to {0}", mainCamera.gameObject.name);

            OVRCompositionUtil.SafeDestroy(ref directCompositionCameraGameObject);
            directCompositionCamera = null;

            RefreshCameraRig(parentObject, mainCamera);

            Debug.Assert(directCompositionCameraGameObject == null);
            if (configuration.instantiateMixedRealityCameraGameObject != null)
            {
                directCompositionCameraGameObject = configuration.instantiateMixedRealityCameraGameObject(mainCamera.gameObject, OVRManager.MrcCameraType.Normal);
            }
            else
            {
                directCompositionCameraGameObject = Object.Instantiate(mainCamera.gameObject);
            }
            directCompositionCameraGameObject.name             = "OculusMRC_DirectCompositionCamera";
            directCompositionCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (directCompositionCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(directCompositionCameraGameObject.GetComponent <AudioListener>());
            }
            if (directCompositionCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(directCompositionCameraGameObject.GetComponent <OVRManager>());
            }
            directCompositionCamera = directCompositionCameraGameObject.GetComponent <Camera>();
            directCompositionCamera.stereoTargetEye = StereoTargetEyeMask.None;
            directCompositionCamera.depth           = float.MaxValue;
            directCompositionCamera.rect            = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            directCompositionCamera.cullingMask     = (directCompositionCamera.cullingMask & ~configuration.extraHiddenLayers) | configuration.extraVisibleLayers;


            Debug.Log("DirectComposition activated : useDynamicLighting " + (configuration.useDynamicLighting ? "ON" : "OFF"));
            RefreshCameraFramePlaneObject(parentObject, directCompositionCamera, configuration);

            previousMainCameraObject = mainCamera.gameObject;
        }
    }
    public override void Cleanup()
    {
        base.Cleanup();

        Camera[] cameras = { fgCamera, bgCamera, compositionCamera };

        foreach (Camera c in cameras)
        {
            OVRCompositionUtil.SafeDestroy(c.gameObject);
        }

        fgCamera          = null;
        bgCamera          = null;
        compositionCamera = null;

        Debug.Log("SandwichComposition deactivated");
    }
Esempio n. 11
0
 public override void Cleanup()
 {
     base.Cleanup();
     Camera[] array = new Camera[]
     {
         this.fgCamera,
         this.bgCamera,
         this.compositionCamera
     };
     foreach (Camera camera in array)
     {
         OVRCompositionUtil.SafeDestroy(camera.gameObject);
     }
     this.fgCamera          = null;
     this.bgCamera          = null;
     this.compositionCamera = null;
     Debug.Log("SandwichComposition deactivated");
 }
    protected void RefreshCameraFramePlaneObject(GameObject parentObject, Camera mixedRealityCamera, OVRMixedRealityCaptureConfiguration configuration)
    {
        OVRCompositionUtil.SafeDestroy(ref cameraFramePlaneObject);

        Debug.Assert(cameraFramePlaneObject == null);
        cameraFramePlaneObject                  = GameObject.CreatePrimitive(PrimitiveType.Quad);
        cameraFramePlaneObject.name             = "OculusMRC_CameraFrame";
        cameraFramePlaneObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
        cameraFramePlaneObject.GetComponent <Collider>().enabled = false;
        cameraFramePlaneObject.GetComponent <MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        Material cameraFrameMaterial = new Material(Shader.Find(configuration.useDynamicLighting ? "Oculus/OVRMRCameraFrameLit" : "Oculus/OVRMRCameraFrame"));

        cameraFramePlaneObject.GetComponent <MeshRenderer>().material = cameraFrameMaterial;
        cameraFrameMaterial.SetColor("_Color", Color.white);
        cameraFrameMaterial.SetFloat("_Visible", 0.0f);
        cameraFramePlaneObject.transform.localScale = new Vector3(4, 4, 4);
        cameraFramePlaneObject.SetActive(true);
        cameraFrameCompositionManager = mixedRealityCamera.gameObject.AddComponent <OVRCameraFrameCompositionManager>();
        cameraFrameCompositionManager.configuration      = configuration;
        cameraFrameCompositionManager.cameraFrameGameObj = cameraFramePlaneObject;
        cameraFrameCompositionManager.composition        = this;
    }
    private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera)
    {
        if (mainCamera.gameObject != previousMainCameraObject)
        {
            Debug.LogFormat("[OVRExternalComposition] Camera refreshed. Rebind camera to {0}", mainCamera.gameObject.name);

            OVRCompositionUtil.SafeDestroy(ref backgroundCameraGameObject);
            backgroundCamera = null;
            OVRCompositionUtil.SafeDestroy(ref foregroundCameraGameObject);
            foregroundCamera = null;

            RefreshCameraRig(parentObject, mainCamera);

            Debug.Assert(backgroundCameraGameObject == null);
            backgroundCameraGameObject                  = Object.Instantiate(mainCamera.gameObject);
            backgroundCameraGameObject.name             = "OculusMRC_BackgroundCamera";
            backgroundCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (backgroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <AudioListener>());
            }
            if (backgroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <OVRManager>());
            }
            backgroundCamera                 = backgroundCameraGameObject.GetComponent <Camera>();
            backgroundCamera.tag             = "Untagged";
            backgroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
            backgroundCamera.depth           = 99990.0f;
            backgroundCamera.rect            = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
            backgroundCamera.cullingMask     = mainCamera.cullingMask & (~OVRManager.instance.extraHiddenLayers);
#if OVR_ANDROID_MRC
            backgroundCamera.targetTexture = mrcRenderTextureArray[0];
            if (!renderCombinedFrame)
            {
                backgroundCamera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            }
#endif

            Debug.Assert(foregroundCameraGameObject == null);
            foregroundCameraGameObject                  = Object.Instantiate(mainCamera.gameObject);
            foregroundCameraGameObject.name             = "OculusMRC_ForgroundCamera";
            foregroundCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (foregroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <AudioListener>());
            }
            if (foregroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <OVRManager>());
            }
            foregroundCamera                 = foregroundCameraGameObject.GetComponent <Camera>();
            foregroundCamera.tag             = "Untagged";
            foregroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
            foregroundCamera.depth           = backgroundCamera.depth + 1.0f;       // enforce the forground be rendered after the background
            foregroundCamera.rect            = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
            foregroundCamera.clearFlags      = CameraClearFlags.Color;
#if OVR_ANDROID_MRC
            foregroundCamera.backgroundColor = OVRManager.instance.externalCompositionBackdropColorQuest;
#else
            foregroundCamera.backgroundColor = OVRManager.instance.externalCompositionBackdropColorRift;
#endif
            foregroundCamera.cullingMask = mainCamera.cullingMask & (~OVRManager.instance.extraHiddenLayers);
#if OVR_ANDROID_MRC
            if (renderCombinedFrame)
            {
                foregroundCamera.targetTexture = mrcRenderTextureArray[0];
            }
            else
            {
                foregroundCamera.targetTexture = mrcForegroundRenderTextureArray[0];
                foregroundCamera.rect          = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            }
#endif

            previousMainCameraObject = mainCamera.gameObject;
        }
    }
Esempio n. 14
0
    private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera, OVRMixedRealityCaptureConfiguration configuration)
    {
        if (mainCamera.gameObject != previousMainCameraObject)
        {
            Debug.LogFormat("[OVRExternalComposition] Camera refreshed. Rebind camera to {0}", mainCamera.gameObject.name);

            OVRCompositionUtil.SafeDestroy(ref backgroundCameraGameObject);
            backgroundCamera = null;
            OVRCompositionUtil.SafeDestroy(ref foregroundCameraGameObject);
            foregroundCamera = null;

            RefreshCameraRig(parentObject, mainCamera);

            Debug.Assert(backgroundCameraGameObject == null);
            if (configuration.instantiateMixedRealityCameraGameObject != null)
            {
                backgroundCameraGameObject = configuration.instantiateMixedRealityCameraGameObject(mainCamera.gameObject, OVRManager.MrcCameraType.Background);
            }
            else
            {
                backgroundCameraGameObject = Object.Instantiate(mainCamera.gameObject);
            }

            backgroundCameraGameObject.name             = "OculusMRC_BackgroundCamera";
            backgroundCameraGameObject.transform.parent =
                cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (backgroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <AudioListener>());
            }

            if (backgroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <OVRManager>());
            }
            backgroundCamera     = backgroundCameraGameObject.GetComponent <Camera>();
            backgroundCamera.tag = "Untagged";
#if USING_MRC_COMPATIBLE_URP_VERSION
            var backgroundCamData = backgroundCamera.GetUniversalAdditionalCameraData();
            if (backgroundCamData != null)
            {
                backgroundCamData.allowXRRendering = false;
            }
#elif USING_URP
            Debug.LogError("Using URP with MRC is only supported with URP version 10.0.0 or higher. Consider using Unity 2020 or higher.");
#else
            backgroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
#endif
            backgroundCamera.depth       = 99990.0f;
            backgroundCamera.rect        = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
            backgroundCamera.cullingMask = (backgroundCamera.cullingMask & ~configuration.extraHiddenLayers) | configuration.extraVisibleLayers;
#if OVR_ANDROID_MRC
            backgroundCamera.targetTexture = mrcRenderTextureArray[0];
            if (!renderCombinedFrame)
            {
                backgroundCamera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            }
#endif

            Debug.Assert(foregroundCameraGameObject == null);
            if (configuration.instantiateMixedRealityCameraGameObject != null)
            {
                foregroundCameraGameObject = configuration.instantiateMixedRealityCameraGameObject(mainCamera.gameObject, OVRManager.MrcCameraType.Foreground);
            }
            else
            {
                foregroundCameraGameObject = Object.Instantiate(mainCamera.gameObject);
            }

            foregroundCameraGameObject.name             = "OculusMRC_ForgroundCamera";
            foregroundCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (foregroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <AudioListener>());
            }
            if (foregroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <OVRManager>());
            }
            foregroundCamera     = foregroundCameraGameObject.GetComponent <Camera>();
            foregroundCamera.tag = "Untagged";
#if USING_MRC_COMPATIBLE_URP_VERSION
            var foregroundCamData = foregroundCamera.GetUniversalAdditionalCameraData();
            if (foregroundCamData != null)
            {
                foregroundCamData.allowXRRendering = false;
            }
#elif USING_URP
            Debug.LogError("Using URP with MRC is only supported with URP version 10.0.0 or higher. Consider using Unity 2020 or higher.");
#else
            foregroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
#endif
            foregroundCamera.depth      = backgroundCamera.depth + 1.0f;            // enforce the forground be rendered after the background
            foregroundCamera.rect       = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
            foregroundCamera.clearFlags = CameraClearFlags.Color;
#if OVR_ANDROID_MRC
            foregroundCamera.backgroundColor = configuration.externalCompositionBackdropColorQuest;
#else
            foregroundCamera.backgroundColor = configuration.externalCompositionBackdropColorRift;
#endif
            foregroundCamera.cullingMask = (foregroundCamera.cullingMask & ~configuration.extraHiddenLayers) | configuration.extraVisibleLayers;

#if OVR_ANDROID_MRC
            if (renderCombinedFrame)
            {
                foregroundCamera.targetTexture = mrcRenderTextureArray[0];
            }
            else
            {
                foregroundCamera.targetTexture = mrcForegroundRenderTextureArray[0];
                foregroundCamera.rect          = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
            }
#endif

            previousMainCameraObject = mainCamera.gameObject;
        }
    }
Esempio n. 15
0
    private void RefreshCameraObjects(GameObject parentObject, Camera mainCamera)
    {
        if (mainCamera.gameObject != previousMainCameraObject)
        {
            Debug.LogFormat("[OVRExternalComposition] Camera refreshed. Rebind camera to {0}", mainCamera.gameObject.name);

            OVRCompositionUtil.SafeDestroy(ref backgroundCameraGameObject);
            backgroundCamera = null;
            OVRCompositionUtil.SafeDestroy(ref foregroundCameraGameObject);
            foregroundCamera = null;
            OVRCompositionUtil.SafeDestroy(ref cameraProxyPlane);

            RefreshCameraRig(parentObject, mainCamera);

            Debug.Assert(backgroundCameraGameObject == null);
            backgroundCameraGameObject                  = Object.Instantiate(mainCamera.gameObject);
            backgroundCameraGameObject.name             = "OculusMRC_BackgroundCamera";
            backgroundCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (backgroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <AudioListener>());
            }
            if (backgroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(backgroundCameraGameObject.GetComponent <OVRManager>());
            }
            backgroundCamera                 = backgroundCameraGameObject.GetComponent <Camera>();
            backgroundCamera.tag             = "Untagged";
            backgroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
            backgroundCamera.depth           = 99990.0f;
            backgroundCamera.rect            = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
            backgroundCamera.cullingMask     = mainCamera.cullingMask & (~OVRManager.instance.extraHiddenLayers);
#if OVR_ANDROID_MRC
            backgroundCamera.targetTexture = mrcRenderTextureArray[0];
#endif

            Debug.Assert(foregroundCameraGameObject == null);
            foregroundCameraGameObject                  = Object.Instantiate(mainCamera.gameObject);
            foregroundCameraGameObject.name             = "OculusMRC_ForgroundCamera";
            foregroundCameraGameObject.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            if (foregroundCameraGameObject.GetComponent <AudioListener>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <AudioListener>());
            }
            if (foregroundCameraGameObject.GetComponent <OVRManager>())
            {
                Object.Destroy(foregroundCameraGameObject.GetComponent <OVRManager>());
            }
            foregroundCamera                 = foregroundCameraGameObject.GetComponent <Camera>();
            foregroundCamera.tag             = "Untagged";
            foregroundCamera.stereoTargetEye = StereoTargetEyeMask.None;
            foregroundCamera.depth           = backgroundCamera.depth + 1.0f;       // enforce the forground be rendered after the background
            foregroundCamera.rect            = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
            foregroundCamera.clearFlags      = CameraClearFlags.Color;
#if OVR_ANDROID_MRC
            foregroundCamera.backgroundColor = OVRManager.instance.externalCompositionBackdropColorQuest;
#else
            foregroundCamera.backgroundColor = OVRManager.instance.externalCompositionBackdropColorRift;
#endif
            foregroundCamera.cullingMask = mainCamera.cullingMask & (~OVRManager.instance.extraHiddenLayers);
#if OVR_ANDROID_MRC
            foregroundCamera.targetTexture = mrcRenderTextureArray[0];
#endif

            // Create cameraProxyPlane for clipping
            Debug.Assert(cameraProxyPlane == null);
            cameraProxyPlane                  = GameObject.CreatePrimitive(PrimitiveType.Quad);
            cameraProxyPlane.name             = "OculusMRC_ProxyClipPlane";
            cameraProxyPlane.transform.parent = cameraInTrackingSpace ? cameraRig.trackingSpace : parentObject.transform;
            cameraProxyPlane.GetComponent <Collider>().enabled = false;
            cameraProxyPlane.GetComponent <MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            Material clipMaterial = new Material(Shader.Find("Oculus/OVRMRClipPlane"));
            cameraProxyPlane.GetComponent <MeshRenderer>().material = clipMaterial;
#if OVR_ANDROID_MRC
            clipMaterial.SetColor("_Color", OVRManager.instance.externalCompositionBackdropColorQuest);
#else
            clipMaterial.SetColor("_Color", OVRManager.instance.externalCompositionBackdropColorRift);
#endif
            clipMaterial.SetFloat("_Visible", 0.0f);
            cameraProxyPlane.transform.localScale = new Vector3(1000, 1000, 1000);
            cameraProxyPlane.SetActive(true);
            OVRMRForegroundCameraManager foregroundCameraManager = foregroundCameraGameObject.AddComponent <OVRMRForegroundCameraManager>();
            foregroundCameraManager.composition      = this;
            foregroundCameraManager.clipPlaneGameObj = cameraProxyPlane;

            previousMainCameraObject = mainCamera.gameObject;
        }
    }
Esempio n. 16
0
 public static void SafeDestroy(ref GameObject obj)
 {
     OVRCompositionUtil.SafeDestroy(obj);
     obj = null;
 }