updateProjectionMatrix method

  1. @override
void updateProjectionMatrix()
override

Implementation

@override
void updateProjectionMatrix() {
  num near = this.near;
  num top = near * Math.tan(MathUtils.deg2rad * 0.5 * fov) / zoom;
  num height = 2 * top;
  num width = aspect * height;
  num left = -0.5 * width;

  if (view != null && view!["enabled"]) {
    var fullWidth = view!["fullWidth"]!;
    var fullHeight = view!["fullHeight"]!;

    left += view!["offsetX"]! * width / fullWidth;
    top -= view!["offsetY"]! * height / fullHeight;
    width *= view!["width"]! / fullWidth;
    height *= view!["height"]! / fullHeight;
  }

  num skew = filmOffset;
  if (skew != 0) left += near * skew / getFilmWidth();

  projectionMatrix.makePerspective(left, left + width, top, top - height, near, far);
  projectionMatrixInverse.copy(projectionMatrix).invert();
}