UpdatePosition() public method

Updates the position of the volume popup.
public UpdatePosition ( Transform cameraTransform ) : void
cameraTransform Transform
return void
示例#1
0
 private void OnEnable()
 {
     if (volumeController != null)
     {
         volumeController.UpdatePosition(volumeControllerTransform);
     }
 }
示例#2
0
    private void OnEnable()
    {
#if !UNITY_ANDROID || UNITY_EDITOR
        Camera cam = GetComponent <Camera>();
        if (cam == null)
        {
            // Ensure there is a non-RT camera in the scene to force rendering of the left and right eyes.
            cam                     = gameObject.AddComponent <Camera>();
            cam.cullingMask         = 0;
            cam.clearFlags          = CameraClearFlags.SolidColor;
            cam.backgroundColor     = new Color(0.0f, 0.0f, 0.0f);
            cam.renderingPath       = RenderingPath.Forward;
            cam.orthographic        = true;
            cam.useOcclusionCulling = false;
        }
#endif

        bool isD3d = SystemInfo.graphicsDeviceVersion.Contains("Direct3D") ||
                     Application.platform == RuntimePlatform.WindowsEditor &&
                     SystemInfo.graphicsDeviceVersion.Contains("emulated");
        display.flipInput = isD3d;

        StartCoroutine(CallbackCoroutine());

#if UNITY_ANDROID && !UNITY_EDITOR
        if (VolumeController != null)
        {
            OVRPose pose = DK2Manager.display.GetHeadPose();
            VolumeController.UpdatePosition(pose.orientation, pose.position);
        }
#endif
    }
    /// <summary>
    /// Enable this instance.
    /// </summary>
    void OnEnable()
    {
#if (UNITY_ANDROID && !UNITY_EDITOR)
        // Start the coroutine to issue EndFrame events for the cameras
        StartCoroutine(CallPluginEndOfFrame());

        if (VolumeController != null)
        {
            VolumeController.UpdatePosition(CameraRight.transform.rotation, CameraRight.transform.position);
        }
#endif
    }
示例#4
0
    private void Update()
    {
        if (!usingPositionTrackingCached || usingPositionTracking != usePositionTracking)
        {
            tracker.isEnabled           = usePositionTracking;
            usingPositionTracking       = usePositionTracking;
            usingPositionTrackingCached = true;
        }

        // Dispatch any events.
        if (HMDLost != null && wasHmdPresent && !display.isPresent)
        {
            HMDLost();
        }

        if (HMDAcquired != null && !wasHmdPresent && display.isPresent)
        {
            HMDAcquired();
        }

        wasHmdPresent = display.isPresent;

        if (TrackingLost != null && wasPositionTracked && !tracker.isPositionTracked)
        {
            TrackingLost();
        }

        if (TrackingAcquired != null && !wasPositionTracked && tracker.isPositionTracked)
        {
            TrackingAcquired();
        }

        wasPositionTracked = tracker.isPositionTracked;

        if (NativeTextureScaleModified != null && nativeTextureScale != prevNativeTextureScale)
        {
            NativeTextureScaleModified(prevNativeTextureScale, nativeTextureScale);
        }

        prevNativeTextureScale = nativeTextureScale;

        if (VirtualTextureScaleModified != null && virtualTextureScale != prevVirtualTextureScale)
        {
            VirtualTextureScaleModified(prevVirtualTextureScale, virtualTextureScale);
        }

        prevVirtualTextureScale = virtualTextureScale;

        if (EyeTextureAntiAliasingModified != null && eyeTextureAntiAliasing != prevEyeTextureAntiAliasing)
        {
            EyeTextureAntiAliasingModified(prevEyeTextureAntiAliasing, eyeTextureAntiAliasing);
        }

        prevEyeTextureAntiAliasing = eyeTextureAntiAliasing;

        if (EyeTextureDepthModified != null && eyeTextureDepth != prevEyeTextureDepth)
        {
            EyeTextureDepthModified(prevEyeTextureDepth, eyeTextureDepth);
        }

        prevEyeTextureDepth = eyeTextureDepth;

        if (EyeTextureFormatModified != null && eyeTextureFormat != prevEyeTextureFormat)
        {
            EyeTextureFormatModified(prevEyeTextureFormat, eyeTextureFormat);
        }

        prevEyeTextureFormat = eyeTextureFormat;

        if (MonoscopicModified != null && monoscopic != prevMonoscopic)
        {
            MonoscopicModified(prevMonoscopic, monoscopic);
        }

        prevMonoscopic = monoscopic;

        if (HdrModified != null && hdr != prevHdr)
        {
            HdrModified(prevHdr, hdr);
        }

        prevHdr = hdr;

        if (isHSWDisplayed && Input.anyKeyDown)
        {
            DismissHSWDisplay();

            if (HSWDismissed != null)
            {
                HSWDismissed();
            }
        }

        display.timeWarp = timeWarp;

        display.Update();

                #if UNITY_ANDROID && !UNITY_EDITOR
        if (volumeController != null)
        {
            if (volumeControllerTransform == null)
            {
                volumeControllerTransform = gameObject.GetComponent <OVRCameraRig>().centerEyeAnchor;
            }
            volumeController.UpdatePosition(volumeControllerTransform);
        }
                #endif
    }
示例#5
0
    private void Update()
    {
        if (!isVRPresent)
        {
            return;
        }

        if (!usingPositionTrackingCached || usingPositionTracking != usePositionTracking)
        {
            tracker.isEnabled           = usePositionTracking;
            usingPositionTracking       = usePositionTracking;
            usingPositionTrackingCached = true;
        }

        // Dispatch any events.
        if (HMDLost != null && wasHmdPresent && !display.isPresent)
        {
            HMDLost();
        }

        if (HMDAcquired != null && !wasHmdPresent && display.isPresent)
        {
            HMDAcquired();
        }

        wasHmdPresent = display.isPresent;

        if (Created != null && wasRecreated)
        {
            Created();
        }

        wasRecreated = false;

        if (TrackingLost != null && wasPositionTracked && !tracker.isPositionTracked)
        {
            TrackingLost();
        }

        if (TrackingAcquired != null && !wasPositionTracked && tracker.isPositionTracked)
        {
            TrackingAcquired();
        }

        wasPositionTracked = tracker.isPositionTracked;

#if (!UNITY_ANDROID || UNITY_EDITOR)
        OVRPlugin.nativeTextureScale  = nativeTextureScale;
        OVRPlugin.virtualTextureScale = virtualTextureScale;
#endif

        if (NativeTextureScaleModified != null && nativeTextureScale != prevNativeTextureScale)
        {
            NativeTextureScaleModified(prevNativeTextureScale, nativeTextureScale);
        }

        prevNativeTextureScale = nativeTextureScale;

        if (VirtualTextureScaleModified != null && virtualTextureScale != prevVirtualTextureScale)
        {
            VirtualTextureScaleModified(prevVirtualTextureScale, virtualTextureScale);
        }

        prevVirtualTextureScale = virtualTextureScale;

        if (EyeTextureAntiAliasingModified != null && eyeTextureAntiAliasing != prevEyeTextureAntiAliasing)
        {
            EyeTextureAntiAliasingModified(prevEyeTextureAntiAliasing, eyeTextureAntiAliasing);
        }

        prevEyeTextureAntiAliasing = eyeTextureAntiAliasing;

        if (EyeTextureDepthModified != null && eyeTextureDepth != prevEyeTextureDepth)
        {
            EyeTextureDepthModified(prevEyeTextureDepth, eyeTextureDepth);
        }

        prevEyeTextureDepth = eyeTextureDepth;

        if (EyeTextureFormatModified != null && eyeTextureFormat != prevEyeTextureFormat)
        {
            EyeTextureFormatModified(prevEyeTextureFormat, eyeTextureFormat);
        }

        prevEyeTextureFormat = eyeTextureFormat;

        if (MonoscopicModified != null && monoscopic != prevMonoscopic)
        {
            MonoscopicModified(prevMonoscopic, monoscopic);
        }

        prevMonoscopic = monoscopic;

        if (HdrModified != null && hdr != prevHdr)
        {
            HdrModified(prevHdr, hdr);
        }

        prevHdr = hdr;

        if (isHSWDisplayed && Input.anyKeyDown)
        {
            DismissHSWDisplay();

            if (HSWDismissed != null)
            {
                HSWDismissed();
            }
        }

        display.timeWarp = timeWarp;

        display.Update();
        input.Update();

#if UNITY_ANDROID && !UNITY_EDITOR
        if (volumeController != null)
        {
            if (volumeControllerTransform == null)
            {
                if (gameObject.GetComponent <OVRCameraRig>() != null)
                {
                    volumeControllerTransform = gameObject.GetComponent <OVRCameraRig>().centerEyeAnchor;
                }
            }
            volumeController.UpdatePosition(volumeControllerTransform);
        }

        // Service VrApi events
        // If this code is not called, internal VrApi events will never be pushed to the internal event queue.
        VrApiEventStatus pendingResult = (VrApiEventStatus)OVR_GetNextPendingEvent(EventData, (uint)MaxDataSize);
        while (pendingResult == VrApiEventStatus.PENDING)
        {
            if (OnVrApiEvent != null)
            {
                OnVrApiEvent(EventData.ToString());
            }
            else
            {
                Debug.Log("No OnVrApiEvent delegate set!");
            }

            EventData.Length = 0;
            pendingResult    = (VrApiEventStatus)OVR_GetNextPendingEvent(EventData, (uint)MaxDataSize);
        }
#endif
    }