import { DirectionalLight } from './directional-light';
import { getSunDirection } from '@math.gl/sun';
export default class SunLight extends DirectionalLight {
  constructor(opts) {
    super(opts);
    this.timestamp = void 0;
    this.timestamp = opts.timestamp;
  }

  getProjectedLight({
    layer
  }) {
    const {
      viewport
    } = layer.context;
    const isGlobe = viewport.resolution && viewport.resolution > 0;

    if (isGlobe) {
      const [x, y, z] = getSunDirection(this.timestamp, 0, 0);
      this.direction = [x, -z, y];
    } else {
      const {
        latitude,
        longitude
      } = viewport;
      this.direction = getSunDirection(this.timestamp, latitude, longitude);
    }

    return this;
  }

}
//# sourceMappingURL=sun-light.js.map