updateMatrices method

  1. @override
void updateMatrices(
  1. Light light, {
  2. int viewportIndex = 0,
})
override

Implementation

@override
void updateMatrices(Light light, {int viewportIndex = 0}) {
  PerspectiveCamera camera = this.camera as PerspectiveCamera;

  var fov = MathUtils.RAD2DEG * 2 * light.angle! * focus;
  var aspect = mapSize.width / mapSize.height;
  var far = light.distance ?? camera.far;

  if (fov != camera.fov || aspect != camera.aspect || far != camera.far) {
    camera.fov = fov;
    camera.aspect = aspect;
    camera.far = far;
    camera.updateProjectionMatrix();
  }

  super.updateMatrices(light, viewportIndex: viewportIndex);
}