updateProjectionMatrix method

  1. @override
void updateProjectionMatrix()
override

Implementation

@override
void updateProjectionMatrix() {
  var dx = (this.right - this.left) / (2 * zoom);
  var dy = (this.top - this.bottom) / (2 * zoom);
  var cx = (this.right + this.left) / 2;
  var cy = (this.top + this.bottom) / 2;

  var left = cx - dx;
  var right = cx + dx;
  var top = cy + dy;
  var bottom = cy - dy;

  if (view != null && view!["enabled"]) {
    var scaleW = (this.right - this.left) / view!["fullWidth"] / zoom;
    var scaleH = (this.top - this.bottom) / view!["fullHeight"] / zoom;

    left += scaleW * view!["offsetX"];
    right = left + scaleW * view!["width"];
    top -= scaleH * view!["offsetY"];
    bottom = top - scaleH * view!["height"];
  }

  projectionMatrix.makeOrthographic(left, right, top, bottom, near, far);

  projectionMatrixInverse.copy(projectionMatrix).invert();
}