Gvr.Internal.BaseVRDevice.ComputeEyesFromProfile C# (CSharp) Method

ComputeEyesFromProfile() protected method

protected ComputeEyesFromProfile ( ) : void
return void
    protected void ComputeEyesFromProfile() {
      // Compute left eye matrices from screen and device params
      Matrix4x4 leftEyeView = Matrix4x4.identity;
      leftEyeView[0, 3] = -Profile.viewer.lenses.separation / 2;
      leftEyePose.Set(leftEyeView);

      float[] rect = new float[4];
      Profile.GetLeftEyeVisibleTanAngles(rect);
      leftEyeDistortedProjection = MakeProjection(rect[0], rect[1], rect[2], rect[3], 1, 1000);
      Profile.GetLeftEyeNoLensTanAngles(rect);
      leftEyeUndistortedProjection = MakeProjection(rect[0], rect[1], rect[2], rect[3], 1, 1000);

      leftEyeUndistortedViewport = Profile.GetLeftEyeVisibleScreenRect(rect);
      leftEyeDistortedViewport = leftEyeUndistortedViewport;

      // Right eye matrices same as left ones but for some sign flippage.
      Matrix4x4 rightEyeView = leftEyeView;
      rightEyeView[0, 3] *= -1;
      rightEyePose.Set(rightEyeView);

      rightEyeDistortedProjection = leftEyeDistortedProjection;
      rightEyeDistortedProjection[0, 2] *= -1;
      rightEyeUndistortedProjection = leftEyeUndistortedProjection;
      rightEyeUndistortedProjection[0, 2] *= -1;

      rightEyeUndistortedViewport = leftEyeUndistortedViewport;
      rightEyeUndistortedViewport.x = 1 - rightEyeUndistortedViewport.xMax;
      rightEyeDistortedViewport = rightEyeUndistortedViewport;

      float width = Screen.width * (leftEyeUndistortedViewport.width+rightEyeDistortedViewport.width);
      float height = Screen.height * Mathf.Max(leftEyeUndistortedViewport.height,
                                               rightEyeUndistortedViewport.height);
      recommendedTextureSize = new Vector2(width, height);
    }