private void UpdateProjection() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return; } this.mLastAppliedNearClipPlane = this.mPrimaryCamera.nearClipPlane; this.mLastAppliedFarClipPlane = this.mPrimaryCamera.farClipPlane; this.mLastAppliedFoV = this.mPrimaryCamera.fieldOfView; Device instance = Device.Instance; this.mPrimaryCamera.projectionMatrix = instance.GetProjectionMatrix(View.VIEW_SINGULAR, this.mLastAppliedNearClipPlane, this.mLastAppliedFarClipPlane, this.mProjectionOrientation); if (Device.Instance.GetMode() == Device.Mode.MODE_VR) { float targetHorizontalFoVDeg = CameraConfigurationUtility.CalculateHorizontalFoVFromViewPortAspect(this.mLastAppliedFoV, (float)this.mCameraViewPortWidth / (float)this.mCameraViewPortHeight); this.mPrimaryCamera.projectionMatrix = CameraConfigurationUtility.ScalePerspectiveProjectionMatrix(this.mPrimaryCamera.projectionMatrix, this.mLastAppliedFoV, targetHorizontalFoVDeg); } else { CameraConfigurationUtility.SetFovForCustomProjection(this.mPrimaryCamera); this.mLastAppliedFoV = this.mPrimaryCamera.fieldOfView; } this.mPrimaryCamera.transform.localPosition = new Vector3(0f, 0f, 0f); this.mPrimaryCamera.transform.localRotation = Quaternion.identity; }
public ExternalStereoCameraConfiguration(Camera leftCamera, Camera rightCamera) : base(leftCamera, rightCamera) { this.mNewLeftNearClipPlane = leftCamera.nearClipPlane; this.mNewLeftFarClipPlane = leftCamera.farClipPlane; this.mNewLeftVerticalVirtualFoV = leftCamera.fieldOfView; this.mNewLeftHorizontalVirtualFoV = CameraConfigurationUtility.CalculateHorizontalFoVFromViewPortAspect(leftCamera.fieldOfView, leftCamera.aspect); this.mNewRightNearClipPlane = rightCamera.nearClipPlane; this.mNewRightFarClipPlane = rightCamera.farClipPlane; this.mNewRightVerticalVirtualFoV = rightCamera.fieldOfView; this.mNewRightHorizontalVirtualFoV = CameraConfigurationUtility.CalculateHorizontalFoVFromViewPortAspect(rightCamera.fieldOfView, rightCamera.aspect); }